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

Side by Side Diff: frog/frogsh

Issue 8591033: Support globals in frog isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 } 857 }
858 } 858 }
859 // ********** Library dart:coreimpl ************** 859 // ********** Library dart:coreimpl **************
860 // ********** Code for ListFactory ************** 860 // ********** Code for ListFactory **************
861 ListFactory = Array; 861 ListFactory = Array;
862 ListFactory.prototype.is$ListFactory = function(){return this;}; 862 ListFactory.prototype.is$ListFactory = function(){return this;};
863 ListFactory.prototype.is$List = function(){return this;}; 863 ListFactory.prototype.is$List = function(){return this;};
864 ListFactory.prototype.is$List$ArgumentNode = function(){return this;}; 864 ListFactory.prototype.is$List$ArgumentNode = function(){return this;};
865 ListFactory.prototype.is$List$Definition = function(){return this;}; 865 ListFactory.prototype.is$List$Definition = function(){return this;};
866 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;}; 866 ListFactory.prototype.is$List$EvaluatedValue = function(){return this;};
867 ListFactory.prototype.is$List$GlobalValue = function(){return this;};
867 ListFactory.prototype.is$List$String = function(){return this;}; 868 ListFactory.prototype.is$List$String = function(){return this;};
868 ListFactory.prototype.is$List$Type = function(){return this;}; 869 ListFactory.prototype.is$List$Type = function(){return this;};
869 ListFactory.prototype.is$List$Value = function(){return this;}; 870 ListFactory.prototype.is$List$Value = function(){return this;};
870 ListFactory.prototype.is$List$int = function(){return this;}; 871 ListFactory.prototype.is$List$int = function(){return this;};
871 ListFactory.prototype.is$Collection$E = function(){return this;}; 872 ListFactory.prototype.is$Collection$E = function(){return this;};
872 ListFactory.prototype.is$Collection$Object = function(){return this;}; 873 ListFactory.prototype.is$Collection$Object = function(){return this;};
873 ListFactory.prototype.is$Collection$Type = function(){return this;}; 874 ListFactory.prototype.is$Collection$Type = function(){return this;};
874 ListFactory.prototype.is$Iterable = function(){return this;}; 875 ListFactory.prototype.is$Iterable = function(){return this;};
875 ListFactory.ListFactory$from$factory = function(other) { 876 ListFactory.ListFactory$from$factory = function(other) {
876 var list = []; 877 var list = [];
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 for (var i = 0; 986 for (var i = 0;
986 i < other.length; i++) { 987 i < other.length; i++) {
987 list._setindex(i, other.$index(i)); 988 list._setindex(i, other.$index(i));
988 } 989 }
989 return list; 990 return list;
990 } 991 }
991 ImmutableList.prototype.get$length = function() { 992 ImmutableList.prototype.get$length = function() {
992 return this._length; 993 return this._length;
993 } 994 }
994 ImmutableList.prototype.set$length = function(length) { 995 ImmutableList.prototype.set$length = function(length) {
995 $throw(const$12/*const IllegalAccessException()*/); 996 $throw(const$14/*const IllegalAccessException()*/);
996 } 997 }
997 Object.defineProperty(ImmutableList.prototype, "length", { 998 Object.defineProperty(ImmutableList.prototype, "length", {
998 get: ImmutableList.prototype.get$length, 999 get: ImmutableList.prototype.get$length,
999 set: ImmutableList.prototype.set$length 1000 set: ImmutableList.prototype.set$length
1000 }); 1001 });
1001 ImmutableList.prototype._setindex = function(index, value) { 1002 ImmutableList.prototype._setindex = function(index, value) {
1002 return this[index] = value; 1003 return this[index] = value;
1003 } 1004 }
1004 ImmutableList.prototype.$setindex = function(index, value) { 1005 ImmutableList.prototype.$setindex = function(index, value) {
1005 $throw(const$12/*const IllegalAccessException()*/); 1006 $throw(const$14/*const IllegalAccessException()*/);
1006 } 1007 }
1007 ImmutableList.prototype.removeRange = function(start, length) { 1008 ImmutableList.prototype.removeRange = function(start, length) {
1008 $throw(const$12/*const IllegalAccessException()*/); 1009 $throw(const$14/*const IllegalAccessException()*/);
1009 } 1010 }
1010 ImmutableList.prototype.insertRange = function(start, length, initialValue) { 1011 ImmutableList.prototype.insertRange = function(start, length, initialValue) {
1011 $throw(const$12/*const IllegalAccessException()*/); 1012 $throw(const$14/*const IllegalAccessException()*/);
1012 } 1013 }
1013 ImmutableList.prototype.sort = function(compare) { 1014 ImmutableList.prototype.sort = function(compare) {
1014 $throw(const$12/*const IllegalAccessException()*/); 1015 $throw(const$14/*const IllegalAccessException()*/);
1015 } 1016 }
1016 ImmutableList.prototype.add = function(element) { 1017 ImmutableList.prototype.add = function(element) {
1017 $throw(const$12/*const IllegalAccessException()*/); 1018 $throw(const$14/*const IllegalAccessException()*/);
1018 } 1019 }
1019 ImmutableList.prototype.addLast = function(element) { 1020 ImmutableList.prototype.addLast = function(element) {
1020 $throw(const$12/*const IllegalAccessException()*/); 1021 $throw(const$14/*const IllegalAccessException()*/);
1021 } 1022 }
1022 ImmutableList.prototype.addAll = function(elements) { 1023 ImmutableList.prototype.addAll = function(elements) {
1023 $throw(const$12/*const IllegalAccessException()*/); 1024 $throw(const$14/*const IllegalAccessException()*/);
1024 } 1025 }
1025 ImmutableList.prototype.clear = function() { 1026 ImmutableList.prototype.clear = function() {
1026 $throw(const$12/*const IllegalAccessException()*/); 1027 $throw(const$14/*const IllegalAccessException()*/);
1027 } 1028 }
1028 ImmutableList.prototype.removeLast = function() { 1029 ImmutableList.prototype.removeLast = function() {
1029 $throw(const$12/*const IllegalAccessException()*/); 1030 $throw(const$14/*const IllegalAccessException()*/);
1030 } 1031 }
1031 ImmutableList.prototype.add$1 = ImmutableList.prototype.add; 1032 ImmutableList.prototype.add$1 = ImmutableList.prototype.add;
1032 ImmutableList.prototype.addAll$1 = function($0) { 1033 ImmutableList.prototype.addAll$1 = function($0) {
1033 return this.addAll(($0 && $0.is$Collection$E())); 1034 return this.addAll(($0 && $0.is$Collection$E()));
1034 }; 1035 };
1035 ImmutableList.prototype.removeLast$0 = function() { 1036 ImmutableList.prototype.removeLast$0 = function() {
1036 return this.removeLast(); 1037 return this.removeLast();
1037 }; 1038 };
1038 ImmutableList.prototype.sort$1 = ImmutableList.prototype.sort; 1039 ImmutableList.prototype.sort$1 = ImmutableList.prototype.sort;
1039 // ********** Code for ImmutableMap ************** 1040 // ********** Code for ImmutableMap **************
(...skipping 25 matching lines...) Expand all
1065 ImmutableMap.prototype.getKeys = function() { 1066 ImmutableMap.prototype.getKeys = function() {
1066 return this._internal.getKeys(); 1067 return this._internal.getKeys();
1067 } 1068 }
1068 ImmutableMap.prototype.getValues = function() { 1069 ImmutableMap.prototype.getValues = function() {
1069 return this._internal.getValues(); 1070 return this._internal.getValues();
1070 } 1071 }
1071 ImmutableMap.prototype.containsKey = function(key) { 1072 ImmutableMap.prototype.containsKey = function(key) {
1072 return this._internal.containsKey(key); 1073 return this._internal.containsKey(key);
1073 } 1074 }
1074 ImmutableMap.prototype.$setindex = function(key, value) { 1075 ImmutableMap.prototype.$setindex = function(key, value) {
1075 $throw(const$12/*const IllegalAccessException()*/); 1076 $throw(const$14/*const IllegalAccessException()*/);
1076 } 1077 }
1077 ImmutableMap.prototype.getKeys$0 = function() { 1078 ImmutableMap.prototype.getKeys$0 = function() {
1078 return this.getKeys(); 1079 return this.getKeys();
1079 }; 1080 };
1080 ImmutableMap.prototype.isEmpty$0 = function() { 1081 ImmutableMap.prototype.isEmpty$0 = function() {
1081 return this.isEmpty(); 1082 return this.isEmpty();
1082 }; 1083 };
1083 // ********** Code for NumImplementation ************** 1084 // ********** Code for NumImplementation **************
1084 NumImplementation = Number; 1085 NumImplementation = Number;
1085 NumImplementation.prototype.is$NumImplementation = function(){return this;}; 1086 NumImplementation.prototype.is$NumImplementation = function(){return this;};
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 } 1148 }
1148 ExceptionImplementation.prototype.toString = function() { 1149 ExceptionImplementation.prototype.toString = function() {
1149 return (this._msg == null) ? "Exception" : ("Exception: " + this._msg + ""); 1150 return (this._msg == null) ? "Exception" : ("Exception: " + this._msg + "");
1150 } 1151 }
1151 ExceptionImplementation.prototype.toString$0 = function() { 1152 ExceptionImplementation.prototype.toString$0 = function() {
1152 return this.toString(); 1153 return this.toString();
1153 }; 1154 };
1154 // ********** Code for HashMapImplementation ************** 1155 // ********** Code for HashMapImplementation **************
1155 function HashMapImplementation() { 1156 function HashMapImplementation() {
1156 // Initializers done 1157 // Initializers done
1157 if (HashMapImplementation._deletedKey == null) {
1158 HashMapImplementation._deletedKey = new Object();
1159 }
1160 this._numberOfEntries = 0; 1158 this._numberOfEntries = 0;
1161 this._numberOfDeleted = 0; 1159 this._numberOfDeleted = 0;
1162 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1160 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1163 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1161 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1164 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1162 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1165 } 1163 }
1166 HashMapImplementation.prototype.is$HashMapImplementation = function(){return thi s;}; 1164 HashMapImplementation.prototype.is$HashMapImplementation = function(){return thi s;};
1167 HashMapImplementation.prototype.is$Map$Node$Element = function(){return this;}; 1165 HashMapImplementation.prototype.is$Map$Node$Element = function(){return this;};
1168 HashMapImplementation.prototype.is$Map$String$Member = function(){return this;}; 1166 HashMapImplementation.prototype.is$Map$String$Member = function(){return this;};
1169 HashMapImplementation.HashMapImplementation$from$factory = function(other) { 1167 HashMapImplementation.HashMapImplementation$from$factory = function(other) {
(...skipping 20 matching lines...) Expand all
1190 var insertionIndex = -1; 1188 var insertionIndex = -1;
1191 while (true) { 1189 while (true) {
1192 var existingKey = this._keys.$index(hash); 1190 var existingKey = this._keys.$index(hash);
1193 if (existingKey == null) { 1191 if (existingKey == null) {
1194 if (insertionIndex < 0) return hash; 1192 if (insertionIndex < 0) return hash;
1195 return insertionIndex; 1193 return insertionIndex;
1196 } 1194 }
1197 else if ($notnull_bool($eq(existingKey, key))) { 1195 else if ($notnull_bool($eq(existingKey, key))) {
1198 return hash; 1196 return hash;
1199 } 1197 }
1200 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis tingKey)) { 1198 else if ((insertionIndex < 0) && (const$1/*HashMapImplementation._DELETED_KE Y*/ === existingKey)) {
1201 insertionIndex = hash; 1199 insertionIndex = hash;
1202 } 1200 }
1203 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); 1201 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength);
1204 } 1202 }
1205 } 1203 }
1206 HashMapImplementation.prototype._probeForLookup = function(key) { 1204 HashMapImplementation.prototype._probeForLookup = function(key) {
1207 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode$0()), th is._keys.length); 1205 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode$0()), th is._keys.length);
1208 var numberOfProbes = 1; 1206 var numberOfProbes = 1;
1209 var initialHash = hash; 1207 var initialHash = hash;
1210 while (true) { 1208 while (true) {
(...skipping 13 matching lines...) Expand all
1224 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; 1222 var numberOfFreeOrDeleted = capacity - newNumberOfEntries;
1225 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; 1223 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted;
1226 if (this._numberOfDeleted > numberOfFree) { 1224 if (this._numberOfDeleted > numberOfFree) {
1227 this._grow(this._keys.length); 1225 this._grow(this._keys.length);
1228 } 1226 }
1229 } 1227 }
1230 HashMapImplementation._isPowerOfTwo = function(x) { 1228 HashMapImplementation._isPowerOfTwo = function(x) {
1231 return ((x & (x - 1)) == 0); 1229 return ((x & (x - 1)) == 0);
1232 } 1230 }
1233 HashMapImplementation.prototype._grow = function(newCapacity) { 1231 HashMapImplementation.prototype._grow = function(newCapacity) {
1234 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "hash_map_set.dart", 153, 12); 1232 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "hash_map_set.dart", 149, 12);
1235 var capacity = this._keys.length; 1233 var capacity = this._keys.length;
1236 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); 1234 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity);
1237 var oldKeys = this._keys; 1235 var oldKeys = this._keys;
1238 var oldValues = this._values; 1236 var oldValues = this._values;
1239 this._keys = new ListFactory(newCapacity); 1237 this._keys = new ListFactory(newCapacity);
1240 this._values = new ListFactory(newCapacity); 1238 this._values = new ListFactory(newCapacity);
1241 for (var i = 0; 1239 for (var i = 0;
1242 i < capacity; i++) { 1240 i < capacity; i++) {
1243 var key = oldKeys.$index(i); 1241 var key = oldKeys.$index(i);
1244 if (key == null || key === HashMapImplementation._deletedKey) { 1242 if (key == null || key === const$1/*HashMapImplementation._DELETED_KEY*/) {
1245 continue; 1243 continue;
1246 } 1244 }
1247 var value = oldValues.$index(i); 1245 var value = oldValues.$index(i);
1248 var newIndex = this._probeForAdding(key); 1246 var newIndex = this._probeForAdding(key);
1249 this._keys.$setindex(newIndex, key); 1247 this._keys.$setindex(newIndex, key);
1250 this._values.$setindex(newIndex, value); 1248 this._values.$setindex(newIndex, value);
1251 } 1249 }
1252 this._numberOfDeleted = 0; 1250 this._numberOfDeleted = 0;
1253 } 1251 }
1254 HashMapImplementation.prototype.clear = function() { 1252 HashMapImplementation.prototype.clear = function() {
1255 this._numberOfEntries = 0; 1253 this._numberOfEntries = 0;
1256 this._numberOfDeleted = 0; 1254 this._numberOfDeleted = 0;
1257 var length = this._keys.length; 1255 var length = this._keys.length;
1258 for (var i = 0; 1256 for (var i = 0;
1259 i < length; i++) { 1257 i < length; i++) {
1260 this._keys.$setindex(i); 1258 this._keys.$setindex(i);
1261 this._values.$setindex(i); 1259 this._values.$setindex(i);
1262 } 1260 }
1263 } 1261 }
1264 HashMapImplementation.prototype.$setindex = function(key, value) { 1262 HashMapImplementation.prototype.$setindex = function(key, value) {
1265 this._ensureCapacity(); 1263 this._ensureCapacity();
1266 var index = this._probeForAdding(key); 1264 var index = this._probeForAdding(key);
1267 if ((this._keys.$index(index) == null) || (this._keys.$index(index) === HashMa pImplementation._deletedKey)) { 1265 if ((this._keys.$index(index) == null) || (this._keys.$index(index) === const$ 1/*HashMapImplementation._DELETED_KEY*/)) {
1268 this._numberOfEntries++; 1266 this._numberOfEntries++;
1269 } 1267 }
1270 this._keys.$setindex(index, key); 1268 this._keys.$setindex(index, key);
1271 this._values.$setindex(index, value); 1269 this._values.$setindex(index, value);
1272 } 1270 }
1273 HashMapImplementation.prototype.$index = function(key) { 1271 HashMapImplementation.prototype.$index = function(key) {
1274 var index = this._probeForLookup(key); 1272 var index = this._probeForLookup(key);
1275 if (index < 0) return null; 1273 if (index < 0) return null;
1276 return this._values.$index(index); 1274 return this._values.$index(index);
1277 } 1275 }
1278 HashMapImplementation.prototype.remove = function(key) { 1276 HashMapImplementation.prototype.remove = function(key) {
1279 var index = this._probeForLookup(key); 1277 var index = this._probeForLookup(key);
1280 if (index >= 0) { 1278 if (index >= 0) {
1281 this._numberOfEntries--; 1279 this._numberOfEntries--;
1282 var value = this._values.$index(index); 1280 var value = this._values.$index(index);
1283 this._values.$setindex(index); 1281 this._values.$setindex(index);
1284 this._keys.$setindex(index, HashMapImplementation._deletedKey); 1282 this._keys.$setindex(index, const$1/*HashMapImplementation._DELETED_KEY*/);
1285 this._numberOfDeleted++; 1283 this._numberOfDeleted++;
1286 return value; 1284 return value;
1287 } 1285 }
1288 return null; 1286 return null;
1289 } 1287 }
1290 HashMapImplementation.prototype.isEmpty = function() { 1288 HashMapImplementation.prototype.isEmpty = function() {
1291 return this._numberOfEntries == 0; 1289 return this._numberOfEntries == 0;
1292 } 1290 }
1293 HashMapImplementation.prototype.get$length = function() { 1291 HashMapImplementation.prototype.get$length = function() {
1294 return this._numberOfEntries; 1292 return this._numberOfEntries;
1295 } 1293 }
1296 Object.defineProperty(HashMapImplementation.prototype, "length", { 1294 Object.defineProperty(HashMapImplementation.prototype, "length", {
1297 get: HashMapImplementation.prototype.get$length 1295 get: HashMapImplementation.prototype.get$length
1298 }); 1296 });
1299 HashMapImplementation.prototype.forEach = function(f) { 1297 HashMapImplementation.prototype.forEach = function(f) {
1300 var length = this._keys.length; 1298 var length = this._keys.length;
1301 for (var i = 0; 1299 for (var i = 0;
1302 i < length; i++) { 1300 i < length; i++) {
1303 if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== HashMapImple mentation._deletedKey)) { 1301 if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== const$1/*Has hMapImplementation._DELETED_KEY*/)) {
1304 f(this._keys.$index(i), this._values.$index(i)); 1302 f(this._keys.$index(i), this._values.$index(i));
1305 } 1303 }
1306 } 1304 }
1307 } 1305 }
1308 HashMapImplementation.prototype.getKeys = function() { 1306 HashMapImplementation.prototype.getKeys = function() {
1309 var list = new ListFactory(this.get$length()); 1307 var list = new ListFactory(this.get$length());
1310 var i = 0; 1308 var i = 0;
1311 this.forEach(function _(key, value) { 1309 this.forEach(function _(key, value) {
1312 list.$setindex(i++, key); 1310 list.$setindex(i++, key);
1313 } 1311 }
(...skipping 14 matching lines...) Expand all
1328 } 1326 }
1329 HashMapImplementation.prototype.getKeys$0 = function() { 1327 HashMapImplementation.prototype.getKeys$0 = function() {
1330 return this.getKeys(); 1328 return this.getKeys();
1331 }; 1329 };
1332 HashMapImplementation.prototype.isEmpty$0 = function() { 1330 HashMapImplementation.prototype.isEmpty$0 = function() {
1333 return this.isEmpty(); 1331 return this.isEmpty();
1334 }; 1332 };
1335 // ********** Code for HashMapImplementation$E$E ************** 1333 // ********** Code for HashMapImplementation$E$E **************
1336 function HashMapImplementation$E$E() { 1334 function HashMapImplementation$E$E() {
1337 // Initializers done 1335 // Initializers done
1338 if (HashMapImplementation._deletedKey == null) {
1339 HashMapImplementation._deletedKey = new Object();
1340 }
1341 this._numberOfEntries = 0; 1336 this._numberOfEntries = 0;
1342 this._numberOfDeleted = 0; 1337 this._numberOfDeleted = 0;
1343 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/); 1338 this._loadLimit = HashMapImplementation._computeLoadLimit(8/*HashMapImplementa tion._INITIAL_CAPACITY*/);
1344 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1339 this._keys = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1345 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/); 1340 this._values = new ListFactory(8/*HashMapImplementation._INITIAL_CAPACITY*/);
1346 } 1341 }
1347 $inherits(HashMapImplementation$E$E, HashMapImplementation); 1342 $inherits(HashMapImplementation$E$E, HashMapImplementation);
1348 HashMapImplementation$E$E.prototype.is$Map$Node$Element = function(){return this ;}; 1343 HashMapImplementation$E$E.prototype.is$Map$Node$Element = function(){return this ;};
1349 HashMapImplementation$E$E.prototype.is$Map$String$Member = function(){return thi s;}; 1344 HashMapImplementation$E$E.prototype.is$Map$String$Member = function(){return thi s;};
1350 HashMapImplementation$E$E._computeLoadLimit = function(capacity) { 1345 HashMapImplementation$E$E._computeLoadLimit = function(capacity) {
(...skipping 12 matching lines...) Expand all
1363 var insertionIndex = -1; 1358 var insertionIndex = -1;
1364 while (true) { 1359 while (true) {
1365 var existingKey = this._keys.$index(hash); 1360 var existingKey = this._keys.$index(hash);
1366 if (existingKey == null) { 1361 if (existingKey == null) {
1367 if (insertionIndex < 0) return hash; 1362 if (insertionIndex < 0) return hash;
1368 return insertionIndex; 1363 return insertionIndex;
1369 } 1364 }
1370 else if ($notnull_bool($eq(existingKey, key))) { 1365 else if ($notnull_bool($eq(existingKey, key))) {
1371 return hash; 1366 return hash;
1372 } 1367 }
1373 else if ((insertionIndex < 0) && (HashMapImplementation._deletedKey === exis tingKey)) { 1368 else if ((insertionIndex < 0) && (const$1/*HashMapImplementation._DELETED_KE Y*/ === existingKey)) {
1374 insertionIndex = hash; 1369 insertionIndex = hash;
1375 } 1370 }
1376 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength); 1371 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.l ength);
1377 } 1372 }
1378 } 1373 }
1379 HashMapImplementation$E$E.prototype._probeForLookup = function(key) { 1374 HashMapImplementation$E$E.prototype._probeForLookup = function(key) {
1380 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode$0()), th is._keys.length); 1375 var hash = HashMapImplementation._firstProbe($assert_num(key.hashCode$0()), th is._keys.length);
1381 var numberOfProbes = 1; 1376 var numberOfProbes = 1;
1382 var initialHash = hash; 1377 var initialHash = hash;
1383 while (true) { 1378 while (true) {
(...skipping 13 matching lines...) Expand all
1397 var numberOfFreeOrDeleted = capacity - newNumberOfEntries; 1392 var numberOfFreeOrDeleted = capacity - newNumberOfEntries;
1398 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted; 1393 var numberOfFree = numberOfFreeOrDeleted - this._numberOfDeleted;
1399 if (this._numberOfDeleted > numberOfFree) { 1394 if (this._numberOfDeleted > numberOfFree) {
1400 this._grow(this._keys.length); 1395 this._grow(this._keys.length);
1401 } 1396 }
1402 } 1397 }
1403 HashMapImplementation$E$E._isPowerOfTwo = function(x) { 1398 HashMapImplementation$E$E._isPowerOfTwo = function(x) {
1404 return ((x & (x - 1)) == 0); 1399 return ((x & (x - 1)) == 0);
1405 } 1400 }
1406 HashMapImplementation$E$E.prototype._grow = function(newCapacity) { 1401 HashMapImplementation$E$E.prototype._grow = function(newCapacity) {
1407 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "hash_map_set.dart", 153, 12); 1402 $assert(HashMapImplementation._isPowerOfTwo(newCapacity), "_isPowerOfTwo(newCa pacity)", "hash_map_set.dart", 149, 12);
1408 var capacity = this._keys.length; 1403 var capacity = this._keys.length;
1409 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); 1404 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity);
1410 var oldKeys = this._keys; 1405 var oldKeys = this._keys;
1411 var oldValues = this._values; 1406 var oldValues = this._values;
1412 this._keys = new ListFactory(newCapacity); 1407 this._keys = new ListFactory(newCapacity);
1413 this._values = new ListFactory(newCapacity); 1408 this._values = new ListFactory(newCapacity);
1414 for (var i = 0; 1409 for (var i = 0;
1415 i < capacity; i++) { 1410 i < capacity; i++) {
1416 var key = oldKeys.$index(i); 1411 var key = oldKeys.$index(i);
1417 if (key == null || key === HashMapImplementation._deletedKey) { 1412 if (key == null || key === const$1/*HashMapImplementation._DELETED_KEY*/) {
1418 continue; 1413 continue;
1419 } 1414 }
1420 var value = oldValues.$index(i); 1415 var value = oldValues.$index(i);
1421 var newIndex = this._probeForAdding(key); 1416 var newIndex = this._probeForAdding(key);
1422 this._keys.$setindex(newIndex, key); 1417 this._keys.$setindex(newIndex, key);
1423 this._values.$setindex(newIndex, value); 1418 this._values.$setindex(newIndex, value);
1424 } 1419 }
1425 this._numberOfDeleted = 0; 1420 this._numberOfDeleted = 0;
1426 } 1421 }
1427 HashMapImplementation$E$E.prototype.clear = function() { 1422 HashMapImplementation$E$E.prototype.clear = function() {
1428 this._numberOfEntries = 0; 1423 this._numberOfEntries = 0;
1429 this._numberOfDeleted = 0; 1424 this._numberOfDeleted = 0;
1430 var length = this._keys.length; 1425 var length = this._keys.length;
1431 for (var i = 0; 1426 for (var i = 0;
1432 i < length; i++) { 1427 i < length; i++) {
1433 this._keys.$setindex(i); 1428 this._keys.$setindex(i);
1434 this._values.$setindex(i); 1429 this._values.$setindex(i);
1435 } 1430 }
1436 } 1431 }
1437 HashMapImplementation$E$E.prototype.$setindex = function(key, value) { 1432 HashMapImplementation$E$E.prototype.$setindex = function(key, value) {
1438 this._ensureCapacity(); 1433 this._ensureCapacity();
1439 var index = this._probeForAdding(key); 1434 var index = this._probeForAdding(key);
1440 if ((this._keys.$index(index) == null) || (this._keys.$index(index) === HashMa pImplementation._deletedKey)) { 1435 if ((this._keys.$index(index) == null) || (this._keys.$index(index) === const$ 1/*HashMapImplementation._DELETED_KEY*/)) {
1441 this._numberOfEntries++; 1436 this._numberOfEntries++;
1442 } 1437 }
1443 this._keys.$setindex(index, key); 1438 this._keys.$setindex(index, key);
1444 this._values.$setindex(index, value); 1439 this._values.$setindex(index, value);
1445 } 1440 }
1446 HashMapImplementation$E$E.prototype.remove = function(key) { 1441 HashMapImplementation$E$E.prototype.remove = function(key) {
1447 var index = this._probeForLookup(key); 1442 var index = this._probeForLookup(key);
1448 if (index >= 0) { 1443 if (index >= 0) {
1449 this._numberOfEntries--; 1444 this._numberOfEntries--;
1450 var value = this._values.$index(index); 1445 var value = this._values.$index(index);
1451 this._values.$setindex(index); 1446 this._values.$setindex(index);
1452 this._keys.$setindex(index, HashMapImplementation._deletedKey); 1447 this._keys.$setindex(index, const$1/*HashMapImplementation._DELETED_KEY*/);
1453 this._numberOfDeleted++; 1448 this._numberOfDeleted++;
1454 return value; 1449 return value;
1455 } 1450 }
1456 return null; 1451 return null;
1457 } 1452 }
1458 HashMapImplementation$E$E.prototype.isEmpty = function() { 1453 HashMapImplementation$E$E.prototype.isEmpty = function() {
1459 return this._numberOfEntries == 0; 1454 return this._numberOfEntries == 0;
1460 } 1455 }
1461 HashMapImplementation$E$E.prototype.forEach = function(f) { 1456 HashMapImplementation$E$E.prototype.forEach = function(f) {
1462 var length = this._keys.length; 1457 var length = this._keys.length;
1463 for (var i = 0; 1458 for (var i = 0;
1464 i < length; i++) { 1459 i < length; i++) {
1465 if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== HashMapImple mentation._deletedKey)) { 1460 if ((this._keys.$index(i) != null) && (this._keys.$index(i) !== const$1/*Has hMapImplementation._DELETED_KEY*/)) {
1466 f(this._keys.$index(i), this._values.$index(i)); 1461 f(this._keys.$index(i), this._values.$index(i));
1467 } 1462 }
1468 } 1463 }
1469 } 1464 }
1470 HashMapImplementation$E$E.prototype.getKeys = function() { 1465 HashMapImplementation$E$E.prototype.getKeys = function() {
1471 var list = new ListFactory(this.get$length()); 1466 var list = new ListFactory(this.get$length());
1472 var i = 0; 1467 var i = 0;
1473 this.forEach(function _(key, value) { 1468 this.forEach(function _(key, value) {
1474 list.$setindex(i++, key); 1469 list.$setindex(i++, key);
1475 } 1470 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 // ********** Code for HashSetIterator ************** 1612 // ********** Code for HashSetIterator **************
1618 function HashSetIterator(set_) { 1613 function HashSetIterator(set_) {
1619 this._nextValidIndex = -1; 1614 this._nextValidIndex = -1;
1620 this._entries = set_._backingMap._keys; 1615 this._entries = set_._backingMap._keys;
1621 // Initializers done 1616 // Initializers done
1622 this._advance(); 1617 this._advance();
1623 } 1618 }
1624 HashSetIterator.prototype.is$Iterator$T = function(){return this;}; 1619 HashSetIterator.prototype.is$Iterator$T = function(){return this;};
1625 HashSetIterator.prototype.hasNext = function() { 1620 HashSetIterator.prototype.hasNext = function() {
1626 if (this._nextValidIndex >= this._entries.length) return false; 1621 if (this._nextValidIndex >= this._entries.length) return false;
1627 if (this._entries.$index(this._nextValidIndex) === HashMapImplementation._dele tedKey) { 1622 if (this._entries.$index(this._nextValidIndex) === const$1/*HashMapImplementat ion._DELETED_KEY*/) {
1628 this._advance(); 1623 this._advance();
1629 } 1624 }
1630 return this._nextValidIndex < this._entries.length; 1625 return this._nextValidIndex < this._entries.length;
1631 } 1626 }
1632 HashSetIterator.prototype.next = function() { 1627 HashSetIterator.prototype.next = function() {
1633 if (!this.hasNext()) { 1628 if (!this.hasNext()) {
1634 $throw(const$0/*const NoMoreElementsException()*/); 1629 $throw(const$0/*const NoMoreElementsException()*/);
1635 } 1630 }
1636 var res = this._entries.$index(this._nextValidIndex); 1631 var res = this._entries.$index(this._nextValidIndex);
1637 this._advance(); 1632 this._advance();
1638 return res; 1633 return res;
1639 } 1634 }
1640 HashSetIterator.prototype._advance = function() { 1635 HashSetIterator.prototype._advance = function() {
1641 var length = this._entries.length; 1636 var length = this._entries.length;
1642 var entry; 1637 var entry;
1643 var deletedKey = HashMapImplementation._deletedKey; 1638 var deletedKey = const$1/*HashMapImplementation._DELETED_KEY*/;
1644 do { 1639 do {
1645 if (++this._nextValidIndex >= length) break; 1640 if (++this._nextValidIndex >= length) break;
1646 entry = this._entries.$index(this._nextValidIndex); 1641 entry = this._entries.$index(this._nextValidIndex);
1647 } 1642 }
1648 while ((entry == null) || (entry === deletedKey)) 1643 while ((entry == null) || (entry === deletedKey))
1649 } 1644 }
1650 HashSetIterator.prototype.hasNext$0 = function() { 1645 HashSetIterator.prototype.hasNext$0 = function() {
1651 return this.hasNext(); 1646 return this.hasNext();
1652 }; 1647 };
1653 HashSetIterator.prototype.next$0 = function() { 1648 HashSetIterator.prototype.next$0 = function() {
1654 return this.next(); 1649 return this.next();
1655 }; 1650 };
1656 // ********** Code for HashSetIterator$E ************** 1651 // ********** Code for HashSetIterator$E **************
1657 function HashSetIterator$E(set_) { 1652 function HashSetIterator$E(set_) {
1658 this._nextValidIndex = -1; 1653 this._nextValidIndex = -1;
1659 this._entries = set_._backingMap._keys; 1654 this._entries = set_._backingMap._keys;
1660 // Initializers done 1655 // Initializers done
1661 this._advance(); 1656 this._advance();
1662 } 1657 }
1663 $inherits(HashSetIterator$E, HashSetIterator); 1658 $inherits(HashSetIterator$E, HashSetIterator);
1664 HashSetIterator$E.prototype.is$Iterator$T = function(){return this;}; 1659 HashSetIterator$E.prototype.is$Iterator$T = function(){return this;};
1665 HashSetIterator$E.prototype._advance = function() { 1660 HashSetIterator$E.prototype._advance = function() {
1666 var length = this._entries.length; 1661 var length = this._entries.length;
1667 var entry; 1662 var entry;
1668 var deletedKey = HashMapImplementation._deletedKey; 1663 var deletedKey = const$1/*HashMapImplementation._DELETED_KEY*/;
1669 do { 1664 do {
1670 if (++this._nextValidIndex >= length) break; 1665 if (++this._nextValidIndex >= length) break;
1671 entry = this._entries.$index(this._nextValidIndex); 1666 entry = this._entries.$index(this._nextValidIndex);
1672 } 1667 }
1673 while ((entry == null) || (entry === deletedKey)) 1668 while ((entry == null) || (entry === deletedKey))
1674 } 1669 }
1670 // ********** Code for _DeletedKeySentinel **************
1671 function _DeletedKeySentinel() {
1672 // Initializers done
1673 }
1675 // ********** Code for KeyValuePair ************** 1674 // ********** Code for KeyValuePair **************
1676 function KeyValuePair(key, value) { 1675 function KeyValuePair(key, value) {
1677 this.key = key; 1676 this.key = key;
1678 this.value = value; 1677 this.value = value;
1679 // Initializers done 1678 // Initializers done
1680 } 1679 }
1681 KeyValuePair.prototype.get$value = function() { return this.value; }; 1680 KeyValuePair.prototype.get$value = function() { return this.value; };
1682 KeyValuePair.prototype.set$value = function(value) { return this.value = value; }; 1681 KeyValuePair.prototype.set$value = function(value) { return this.value = value; };
1683 // ********** Code for KeyValuePair$K$V ************** 1682 // ********** Code for KeyValuePair$K$V **************
1684 function KeyValuePair$K$V(key, value) { 1683 function KeyValuePair$K$V(key, value) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 $inherits(DoubleLinkedQueueEntry$KeyValuePair$K$V, DoubleLinkedQueueEntry); 1828 $inherits(DoubleLinkedQueueEntry$KeyValuePair$K$V, DoubleLinkedQueueEntry);
1830 DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V = function(){return this;}; 1829 DoubleLinkedQueueEntry$KeyValuePair$K$V.prototype.is$DoubleLinkedQueueEntry$KeyV aluePair$K$V = function(){return this;};
1831 // ********** Code for _DoubleLinkedQueueEntrySentinel ************** 1830 // ********** Code for _DoubleLinkedQueueEntrySentinel **************
1832 function _DoubleLinkedQueueEntrySentinel() { 1831 function _DoubleLinkedQueueEntrySentinel() {
1833 // Initializers done 1832 // Initializers done
1834 DoubleLinkedQueueEntry$E.call(this, null); 1833 DoubleLinkedQueueEntry$E.call(this, null);
1835 this._link(this, this); 1834 this._link(this, this);
1836 } 1835 }
1837 $inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry$E); 1836 $inherits(_DoubleLinkedQueueEntrySentinel, DoubleLinkedQueueEntry$E);
1838 _DoubleLinkedQueueEntrySentinel.prototype.remove = function() { 1837 _DoubleLinkedQueueEntrySentinel.prototype.remove = function() {
1839 $throw(const$3/*const EmptyQueueException()*/); 1838 $throw(const$5/*const EmptyQueueException()*/);
1840 } 1839 }
1841 _DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry = function() { 1840 _DoubleLinkedQueueEntrySentinel.prototype._asNonSentinelEntry = function() {
1842 return null; 1841 return null;
1843 } 1842 }
1844 _DoubleLinkedQueueEntrySentinel.prototype.get$element = function() { 1843 _DoubleLinkedQueueEntrySentinel.prototype.get$element = function() {
1845 $throw(const$3/*const EmptyQueueException()*/); 1844 $throw(const$5/*const EmptyQueueException()*/);
1846 } 1845 }
1847 // ********** Code for _DoubleLinkedQueueEntrySentinel$E ************** 1846 // ********** Code for _DoubleLinkedQueueEntrySentinel$E **************
1848 function _DoubleLinkedQueueEntrySentinel$E() { 1847 function _DoubleLinkedQueueEntrySentinel$E() {
1849 // Initializers done 1848 // Initializers done
1850 DoubleLinkedQueueEntry$E.call(this, null); 1849 DoubleLinkedQueueEntry$E.call(this, null);
1851 this._link(this, this); 1850 this._link(this, this);
1852 } 1851 }
1853 $inherits(_DoubleLinkedQueueEntrySentinel$E, _DoubleLinkedQueueEntrySentinel); 1852 $inherits(_DoubleLinkedQueueEntrySentinel$E, _DoubleLinkedQueueEntrySentinel);
1854 // ********** Code for _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V ******** ****** 1853 // ********** Code for _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V ******** ******
1855 function _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V() { 1854 function _DoubleLinkedQueueEntrySentinel$KeyValuePair$K$V() {
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 NodeFileSystem.prototype.fileExists = function(filename) { 2419 NodeFileSystem.prototype.fileExists = function(filename) {
2421 return path.existsSync(filename); 2420 return path.existsSync(filename);
2422 } 2421 }
2423 // ********** Code for top level ************** 2422 // ********** Code for top level **************
2424 // ********** Library io ************** 2423 // ********** Library io **************
2425 // ********** Code for top level ************** 2424 // ********** Code for top level **************
2426 function join(strings) { 2425 function join(strings) {
2427 return Strings.join(strings, '/'); 2426 return Strings.join(strings, '/');
2428 } 2427 }
2429 function readSync(fileName) { 2428 function readSync(fileName) {
2430 return new SourceFile(fileName, world.files.readAll(fileName)); 2429 return new SourceFile(fileName, $globals.world.files.readAll(fileName));
2431 } 2430 }
2432 // ********** Library util_implementation ************** 2431 // ********** Library util_implementation **************
2433 // ********** Code for LinkFactory ************** 2432 // ********** Code for LinkFactory **************
2434 function LinkFactory() {} 2433 function LinkFactory() {}
2435 LinkFactory.Link$factory = function(head, tail) { 2434 LinkFactory.Link$factory = function(head, tail) {
2436 var $0; 2435 var $0;
2437 return new LinkEntry(head, (($0 = (tail == null) ? const$14/*const EmptyLink() */ : tail) && $0.is$Link$T())); 2436 return new LinkEntry(head, (($0 = (tail == null) ? const$16/*const EmptyLink() */ : tail) && $0.is$Link$T()));
2438 } 2437 }
2439 // ********** Code for AbstractLink ************** 2438 // ********** Code for AbstractLink **************
2440 function AbstractLink() { 2439 function AbstractLink() {
2441 // Initializers done 2440 // Initializers done
2442 } 2441 }
2443 AbstractLink.prototype.is$Link = function(){return this;}; 2442 AbstractLink.prototype.is$Link = function(){return this;};
2444 AbstractLink.prototype.is$Link$Element = function(){return this;}; 2443 AbstractLink.prototype.is$Link$Element = function(){return this;};
2445 AbstractLink.prototype.is$Link$Node = function(){return this;}; 2444 AbstractLink.prototype.is$Link$Node = function(){return this;};
2446 AbstractLink.prototype.is$Link$T = function(){return this;}; 2445 AbstractLink.prototype.is$Link$T = function(){return this;};
2447 AbstractLink.prototype.is$Link$Token = function(){return this;}; 2446 AbstractLink.prototype.is$Link$Token = function(){return this;};
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 LinkTail.prototype.is$Link$Token = function(){return this;}; 2518 LinkTail.prototype.is$Link$Token = function(){return this;};
2520 LinkTail.prototype.is$Link$Type = function(){return this;}; 2519 LinkTail.prototype.is$Link$Type = function(){return this;};
2521 LinkTail.prototype.is$Iterable = function(){return this;}; 2520 LinkTail.prototype.is$Iterable = function(){return this;};
2522 LinkTail.prototype.get$head = function() { 2521 LinkTail.prototype.get$head = function() {
2523 return null; 2522 return null;
2524 } 2523 }
2525 LinkTail.prototype.get$tail = function() { 2524 LinkTail.prototype.get$tail = function() {
2526 return null; 2525 return null;
2527 } 2526 }
2528 LinkTail.prototype.toList = function() { 2527 LinkTail.prototype.toList = function() {
2529 return const$13/*const []*/; 2528 return const$15/*const []*/;
2530 } 2529 }
2531 LinkTail.prototype.isEmpty = function() { 2530 LinkTail.prototype.isEmpty = function() {
2532 return true; 2531 return true;
2533 } 2532 }
2534 LinkTail.prototype.isEmpty$0 = function() { 2533 LinkTail.prototype.isEmpty$0 = function() {
2535 return this.isEmpty(); 2534 return this.isEmpty();
2536 }; 2535 };
2537 // ********** Code for LinkTail$Node ************** 2536 // ********** Code for LinkTail$Node **************
2538 function LinkTail$Node() {} 2537 function LinkTail$Node() {}
2539 $inherits(LinkTail$Node, LinkTail); 2538 $inherits(LinkTail$Node, LinkTail);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 $inherits(LinkEntry$T, LinkEntry); 2600 $inherits(LinkEntry$T, LinkEntry);
2602 // ********** Code for LinkBuilderImplementation ************** 2601 // ********** Code for LinkBuilderImplementation **************
2603 function LinkBuilderImplementation() { 2602 function LinkBuilderImplementation() {
2604 this.head = null 2603 this.head = null
2605 this.lastLink = null 2604 this.lastLink = null
2606 // Initializers done 2605 // Initializers done
2607 } 2606 }
2608 LinkBuilderImplementation.prototype.get$head = function() { return this.head; }; 2607 LinkBuilderImplementation.prototype.get$head = function() { return this.head; };
2609 LinkBuilderImplementation.prototype.set$head = function(value) { return this.hea d = value; }; 2608 LinkBuilderImplementation.prototype.set$head = function(value) { return this.hea d = value; };
2610 LinkBuilderImplementation.prototype.toLink = function() { 2609 LinkBuilderImplementation.prototype.toLink = function() {
2611 if (this.head == null) return const$14/*const EmptyLink()*/; 2610 if (this.head == null) return const$16/*const EmptyLink()*/;
2612 this.lastLink.realTail = const$14/*const EmptyLink()*/; 2611 this.lastLink.realTail = const$16/*const EmptyLink()*/;
2613 var link = this.head; 2612 var link = this.head;
2614 this.lastLink = null; 2613 this.lastLink = null;
2615 this.head = null; 2614 this.head = null;
2616 return link; 2615 return link;
2617 } 2616 }
2618 LinkBuilderImplementation.prototype.addLast = function(t) { 2617 LinkBuilderImplementation.prototype.addLast = function(t) {
2619 var entry = new LinkEntry$T(t, null); 2618 var entry = new LinkEntry$T(t, null);
2620 if (this.head == null) { 2619 if (this.head == null) {
2621 this.head = entry; 2620 this.head = entry;
2622 } 2621 }
2623 else { 2622 else {
2624 this.lastLink.realTail = entry; 2623 this.lastLink.realTail = entry;
2625 } 2624 }
2626 this.lastLink = entry; 2625 this.lastLink = entry;
2627 } 2626 }
2628 // ********** Code for LinkBuilderImplementation$T ************** 2627 // ********** Code for LinkBuilderImplementation$T **************
2629 function LinkBuilderImplementation$T() {} 2628 function LinkBuilderImplementation$T() {}
2630 $inherits(LinkBuilderImplementation$T, LinkBuilderImplementation); 2629 $inherits(LinkBuilderImplementation$T, LinkBuilderImplementation);
2631 // ********** Code for LinkBuilderImplementation$Type ************** 2630 // ********** Code for LinkBuilderImplementation$Type **************
2632 function LinkBuilderImplementation$Type() {} 2631 function LinkBuilderImplementation$Type() {}
2633 $inherits(LinkBuilderImplementation$Type, LinkBuilderImplementation); 2632 $inherits(LinkBuilderImplementation$Type, LinkBuilderImplementation);
2634 // ********** Code for top level ************** 2633 // ********** Code for top level **************
2635 // ********** Library util ************** 2634 // ********** Library util **************
2636 // ********** Code for top level ************** 2635 // ********** Code for top level **************
2637 // ********** Library scanner_implementation ************** 2636 // ********** Library scanner_implementation **************
2638 // ********** Code for ArrayBasedScanner ************** 2637 // ********** Code for ArrayBasedScanner **************
2639 function ArrayBasedScanner() { 2638 function ArrayBasedScanner() {
2640 this.groupingStack = const$14/*const EmptyLink()*/ 2639 this.groupingStack = const$16/*const EmptyLink()*/
2641 this.extraCharOffset = 0; 2640 this.extraCharOffset = 0;
2642 this.tokenStart = -1; 2641 this.tokenStart = -1;
2643 this.byteOffset = -1; 2642 this.byteOffset = -1;
2644 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1); 2643 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1);
2645 // Initializers done 2644 // Initializers done
2646 AbstractScanner$S.call(this); 2645 AbstractScanner$S.call(this);
2647 this.tail = this.tokens; 2646 this.tail = this.tokens;
2648 } 2647 }
2649 $inherits(ArrayBasedScanner, AbstractScanner$S); 2648 $inherits(ArrayBasedScanner, AbstractScanner$S);
2650 ArrayBasedScanner.prototype.get$charOffset = function() { 2649 ArrayBasedScanner.prototype.get$charOffset = function() {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 2747 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2749 } 2748 }
2750 if ($notnull_bool(this.groupingStack.isEmpty())) return; 2749 if ($notnull_bool(this.groupingStack.isEmpty())) return;
2751 if (this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) { 2750 if (this.groupingStack.get$head().kind === 60/*null.LT_TOKEN*/) {
2752 this.groupingStack.get$head().endGroup = oldTail.next; 2751 this.groupingStack.get$head().endGroup = oldTail.next;
2753 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en()); 2752 this.groupingStack = (($0 = this.groupingStack.get$tail()) && $0.is$Link$Tok en());
2754 } 2753 }
2755 } 2754 }
2756 // ********** Code for ArrayBasedScanner$SourceString ************** 2755 // ********** Code for ArrayBasedScanner$SourceString **************
2757 function ArrayBasedScanner$SourceString() { 2756 function ArrayBasedScanner$SourceString() {
2758 this.groupingStack = const$14/*const EmptyLink()*/ 2757 this.groupingStack = const$16/*const EmptyLink()*/
2759 this.extraCharOffset = 0; 2758 this.extraCharOffset = 0;
2760 this.tokenStart = -1; 2759 this.tokenStart = -1;
2761 this.byteOffset = -1; 2760 this.byteOffset = -1;
2762 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1); 2761 this.tokens = new Token(0/*null.EOF_TOKEN*/, -1);
2763 // Initializers done 2762 // Initializers done
2764 AbstractScanner$S.call(this); 2763 AbstractScanner$S.call(this);
2765 this.tail = this.tokens; 2764 this.tail = this.tokens;
2766 } 2765 }
2767 $inherits(ArrayBasedScanner$SourceString, ArrayBasedScanner); 2766 $inherits(ArrayBasedScanner$SourceString, ArrayBasedScanner);
2768 // ********** Code for top level ************** 2767 // ********** Code for top level **************
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
5413 } 5412 }
5414 ParserError.prototype.toString = function() { 5413 ParserError.prototype.toString = function() {
5415 return this.reason; 5414 return this.reason;
5416 } 5415 }
5417 ParserError.prototype.toString$0 = function() { 5416 ParserError.prototype.toString$0 = function() {
5418 return this.toString(); 5417 return this.toString();
5419 }; 5418 };
5420 // ********** Code for ElementListener ************** 5419 // ********** Code for ElementListener **************
5421 function ElementListener(canceler) { 5420 function ElementListener(canceler) {
5422 this.previousIdentifier = null 5421 this.previousIdentifier = null
5423 this.nodes = const$14/*const EmptyLink()*/ 5422 this.nodes = const$16/*const EmptyLink()*/
5424 this.topLevelElements = const$14/*const EmptyLink()*/ 5423 this.topLevelElements = const$16/*const EmptyLink()*/
5425 this.canceler = canceler; 5424 this.canceler = canceler;
5426 // Initializers done 5425 // Initializers done
5427 Listener.call(this); 5426 Listener.call(this);
5428 } 5427 }
5429 $inherits(ElementListener, Listener); 5428 $inherits(ElementListener, Listener);
5430 ElementListener.prototype.beginLibraryTag = function(token) { 5429 ElementListener.prototype.beginLibraryTag = function(token) {
5431 this.canceler.cancel("Cannot handle library tags"); 5430 this.canceler.cancel("Cannot handle library tags");
5432 } 5431 }
5433 ElementListener.prototype.endClass = function(interfacesCount, beginToken, exten dsKeyword, implementsKeyword, endToken) { 5432 ElementListener.prototype.endClass = function(interfacesCount, beginToken, exten dsKeyword, implementsKeyword, endToken) {
5434 var $0; 5433 var $0;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
5701 this.pushNode(new Throw(null, throwToken, endToken)); 5700 this.pushNode(new Throw(null, throwToken, endToken));
5702 } 5701 }
5703 NodeListener.prototype.handleUnaryPostfixExpression = function(token) { 5702 NodeListener.prototype.handleUnaryPostfixExpression = function(token) {
5704 this.pushNode(new Send.postfix$ctor(this.popNode(), new Operator(token))); 5703 this.pushNode(new Send.postfix$ctor(this.popNode(), new Operator(token)));
5705 } 5704 }
5706 NodeListener.prototype.handleUnaryPrefixExpression = function(token) { 5705 NodeListener.prototype.handleUnaryPrefixExpression = function(token) {
5707 this.pushNode(new Send.prefix$ctor(this.popNode(), new Operator(token))); 5706 this.pushNode(new Send.prefix$ctor(this.popNode(), new Operator(token)));
5708 } 5707 }
5709 NodeListener.prototype.makeNodeList = function(count, beginToken, endToken, deli miter) { 5708 NodeListener.prototype.makeNodeList = function(count, beginToken, endToken, deli miter) {
5710 var $0; 5709 var $0;
5711 var nodes = const$14/*const EmptyLink()*/; 5710 var nodes = const$16/*const EmptyLink()*/;
5712 for (; count > 0; --count) { 5711 for (; count > 0; --count) {
5713 nodes = (($0 = nodes.prepend(this.popNode())) && $0.is$Link$Node()); 5712 nodes = (($0 = nodes.prepend(this.popNode())) && $0.is$Link$Node());
5714 } 5713 }
5715 var sourceDelimiter = (($0 = (delimiter == null) ? null : new StringWrapper(de limiter)) && $0.is$SourceString()); 5714 var sourceDelimiter = (($0 = (delimiter == null) ? null : new StringWrapper(de limiter)) && $0.is$SourceString());
5716 return new NodeList(beginToken, nodes, endToken, sourceDelimiter); 5715 return new NodeList(beginToken, nodes, endToken, sourceDelimiter);
5717 } 5716 }
5718 NodeListener.prototype.log = function(message) { 5717 NodeListener.prototype.log = function(message) {
5719 this.logger.log(message); 5718 this.logger.log(message);
5720 } 5719 }
5721 NodeListener.prototype.endArguments$3 = function($0, $1, $2) { 5720 NodeListener.prototype.endArguments$3 = function($0, $1, $2) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
5904 }; 5903 };
5905 // ********** Code for Token ************** 5904 // ********** Code for Token **************
5906 function Token(kind, charOffset) { 5905 function Token(kind, charOffset) {
5907 this.kind = kind; 5906 this.kind = kind;
5908 this.charOffset = charOffset; 5907 this.charOffset = charOffset;
5909 // Initializers done 5908 // Initializers done
5910 } 5909 }
5911 Token.prototype.is$Token = function(){return this;}; 5910 Token.prototype.is$Token = function(){return this;};
5912 Token.prototype.get$charOffset = function() { return this.charOffset; }; 5911 Token.prototype.get$charOffset = function() { return this.charOffset; };
5913 Token.prototype.get$value = function() { 5912 Token.prototype.get$value = function() {
5914 return const$112/*const SourceString('EOF')*/; 5913 return const$114/*const SourceString('EOF')*/;
5915 } 5914 }
5916 Token.prototype.get$stringValue = function() { 5915 Token.prototype.get$stringValue = function() {
5917 return 'EOF'; 5916 return 'EOF';
5918 } 5917 }
5919 Token.prototype.toString = function() { 5918 Token.prototype.toString = function() {
5920 return Strings.String$fromCharCodes$factory([this.kind]); 5919 return Strings.String$fromCharCodes$factory([this.kind]);
5921 } 5920 }
5922 Token.prototype.next$0 = function() { 5921 Token.prototype.next$0 = function() {
5923 return this.next(); 5922 return this.next();
5924 }; 5923 };
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
6002 $inherits(BeginGroupToken, StringToken); 6001 $inherits(BeginGroupToken, StringToken);
6003 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;}; 6002 BeginGroupToken.prototype.is$BeginGroupToken = function(){return this;};
6004 // ********** Code for Keyword ************** 6003 // ********** Code for Keyword **************
6005 function Keyword(syntax, isPseudo) { 6004 function Keyword(syntax, isPseudo) {
6006 this.syntax = syntax; 6005 this.syntax = syntax;
6007 this.isPseudo = isPseudo; 6006 this.isPseudo = isPseudo;
6008 // Initializers done 6007 // Initializers done
6009 } 6008 }
6010 Keyword.prototype.is$SourceString = function(){return this;}; 6009 Keyword.prototype.is$SourceString = function(){return this;};
6011 Keyword.get$keywords = function() { 6010 Keyword.get$keywords = function() {
6012 if (Keyword._keywords == null) { 6011 if ($globals.Keyword__keywords == null) {
6013 Keyword._keywords = Keyword.computeKeywordMap(); 6012 $globals.Keyword__keywords = Keyword.computeKeywordMap();
6014 } 6013 }
6015 return Keyword._keywords; 6014 return $globals.Keyword__keywords;
6016 } 6015 }
6017 Keyword.computeKeywordMap = function() { 6016 Keyword.computeKeywordMap = function() {
6018 var result = new LinkedHashMapImplementation(); 6017 var result = new LinkedHashMapImplementation();
6019 for (var $i0 = const$110/*Keyword.values*/.iterator(); $i0.hasNext(); ) { 6018 for (var $i0 = const$112/*Keyword.values*/.iterator(); $i0.hasNext(); ) {
6020 var keyword = $i0.next(); 6019 var keyword = $i0.next();
6021 result.$setindex(keyword.syntax, keyword); 6020 result.$setindex(keyword.syntax, keyword);
6022 } 6021 }
6023 return result; 6022 return result;
6024 } 6023 }
6025 Keyword.prototype.hashCode = function() { 6024 Keyword.prototype.hashCode = function() {
6026 return this.syntax.hashCode(); 6025 return this.syntax.hashCode();
6027 } 6026 }
6028 Keyword.prototype.$eq = function(other) { 6027 Keyword.prototype.$eq = function(other) {
6029 return !!(other && other.is$SourceString) && this.toString() == other.toString $0(); 6028 return !!(other && other.is$SourceString) && this.toString() == other.toString $0();
(...skipping 15 matching lines...) Expand all
6045 }; 6044 };
6046 Keyword.prototype.toString$0 = function() { 6045 Keyword.prototype.toString$0 = function() {
6047 return this.toString(); 6046 return this.toString();
6048 }; 6047 };
6049 // ********** Code for KeywordState ************** 6048 // ********** Code for KeywordState **************
6050 function KeywordState() { 6049 function KeywordState() {
6051 // Initializers done 6050 // Initializers done
6052 } 6051 }
6053 KeywordState.prototype.is$KeywordState = function(){return this;}; 6052 KeywordState.prototype.is$KeywordState = function(){return this;};
6054 KeywordState.get$KEYWORD_STATE = function() { 6053 KeywordState.get$KEYWORD_STATE = function() {
6055 if (KeywordState._KEYWORD_STATE == null) { 6054 if ($globals.KeywordState__KEYWORD_STATE == null) {
6056 var strings = new ListFactory(const$110/*Keyword.values*/.get$length()); 6055 var strings = new ListFactory(const$112/*Keyword.values*/.get$length());
6057 for (var i = 0; 6056 for (var i = 0;
6058 i < const$110/*Keyword.values*/.get$length(); i++) { 6057 i < const$112/*Keyword.values*/.get$length(); i++) {
6059 strings.$setindex(i, const$110/*Keyword.values*/[i].syntax); 6058 strings.$setindex(i, const$112/*Keyword.values*/[i].syntax);
6060 } 6059 }
6061 strings.sort((function (a, b) { 6060 strings.sort((function (a, b) {
6062 return a.compareTo$1(b); 6061 return a.compareTo$1(b);
6063 }) 6062 })
6064 ); 6063 );
6065 KeywordState._KEYWORD_STATE = KeywordState.computeKeywordStateTable(0, strin gs, 0, strings.length); 6064 $globals.KeywordState__KEYWORD_STATE = KeywordState.computeKeywordStateTable (0, strings, 0, strings.length);
6066 } 6065 }
6067 return KeywordState._KEYWORD_STATE; 6066 return $globals.KeywordState__KEYWORD_STATE;
6068 } 6067 }
6069 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) { 6068 KeywordState.computeKeywordStateTable = function(start, strings, offset, length) {
6070 var result = new ListFactory(26); 6069 var result = new ListFactory(26);
6071 $assert(length != 0, "length != 0", "keyword.dart", 161, 12); 6070 $assert(length != 0, "length != 0", "keyword.dart", 161, 12);
6072 var chunk = 0; 6071 var chunk = 0;
6073 var chunkStart = -1; 6072 var chunkStart = -1;
6074 for (var i = offset; 6073 for (var i = offset;
6075 i < offset + length; i++) { 6074 i < offset + length; i++) {
6076 if (strings.$index(i).length > start) { 6075 if (strings.$index(i).length > start) {
6077 var c = strings.$index(i).charCodeAt$1(start); 6076 var c = strings.$index(i).charCodeAt$1(start);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
6252 function Send(receiver, selector, argumentsNode) { 6251 function Send(receiver, selector, argumentsNode) {
6253 this.receiver = receiver; 6252 this.receiver = receiver;
6254 this.selector = selector; 6253 this.selector = selector;
6255 this.argumentsNode = argumentsNode; 6254 this.argumentsNode = argumentsNode;
6256 // Initializers done 6255 // Initializers done
6257 Expression.call(this); 6256 Expression.call(this);
6258 } 6257 }
6259 Send.postfix$ctor = function(receiver, selector) { 6258 Send.postfix$ctor = function(receiver, selector) {
6260 this.receiver = receiver; 6259 this.receiver = receiver;
6261 this.selector = selector; 6260 this.selector = selector;
6262 this.argumentsNode = const$211/*const Postfix()*/; 6261 this.argumentsNode = const$213/*const Postfix()*/;
6263 // Initializers done 6262 // Initializers done
6264 Expression.call(this); 6263 Expression.call(this);
6265 } 6264 }
6266 Send.postfix$ctor.prototype = Send.prototype; 6265 Send.postfix$ctor.prototype = Send.prototype;
6267 Send.prefix$ctor = function(receiver, selector) { 6266 Send.prefix$ctor = function(receiver, selector) {
6268 this.receiver = receiver; 6267 this.receiver = receiver;
6269 this.selector = selector; 6268 this.selector = selector;
6270 this.argumentsNode = const$210/*const Prefix()*/; 6269 this.argumentsNode = const$212/*const Prefix()*/;
6271 // Initializers done 6270 // Initializers done
6272 Expression.call(this); 6271 Expression.call(this);
6273 } 6272 }
6274 Send.prefix$ctor.prototype = Send.prototype; 6273 Send.prefix$ctor.prototype = Send.prototype;
6275 $inherits(Send, Expression); 6274 $inherits(Send, Expression);
6276 Send.prototype.is$Send = function(){return this;}; 6275 Send.prototype.is$Send = function(){return this;};
6277 Send.prototype.get$arguments = function() { 6276 Send.prototype.get$arguments = function() {
6278 return this.argumentsNode.nodes; 6277 return this.argumentsNode.nodes;
6279 } 6278 }
6280 Send.prototype.accept = function(visitor) { 6279 Send.prototype.accept = function(visitor) {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
6609 return this.accept(($0 && $0.is$Visitor())); 6608 return this.accept(($0 && $0.is$Visitor()));
6610 }; 6609 };
6611 // ********** Code for LiteralBool ************** 6610 // ********** Code for LiteralBool **************
6612 function LiteralBool(token, handler) { 6611 function LiteralBool(token, handler) {
6613 // Initializers done 6612 // Initializers done
6614 Literal$bool.call(this, token, handler); 6613 Literal$bool.call(this, token, handler);
6615 } 6614 }
6616 $inherits(LiteralBool, Literal$bool); 6615 $inherits(LiteralBool, Literal$bool);
6617 LiteralBool.prototype.get$value = function() { 6616 LiteralBool.prototype.get$value = function() {
6618 switch (this.token.get$value()) { 6617 switch (this.token.get$value()) {
6619 case const$66/*Keyword.TRUE*/: 6618 case const$68/*Keyword.TRUE*/:
6620 6619
6621 return true; 6620 return true;
6622 6621
6623 case const$38/*Keyword.FALSE*/: 6622 case const$40/*Keyword.FALSE*/:
6624 6623
6625 return false; 6624 return false;
6626 6625
6627 default: 6626 default:
6628 6627
6629 (this.handler)(this.token, ("not a bool " + this.token.get$value() + "")); 6628 (this.handler)(this.token, ("not a bool " + this.token.get$value() + ""));
6630 6629
6631 } 6630 }
6632 } 6631 }
6633 LiteralBool.prototype.accept = function(visitor) { 6632 LiteralBool.prototype.accept = function(visitor) {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
6976 Unparser.prototype.visitVariableDefinitions = function(node) { 6975 Unparser.prototype.visitVariableDefinitions = function(node) {
6977 var $0; 6976 var $0;
6978 if (node.type != null) { 6977 if (node.type != null) {
6979 this.visit(node.type); 6978 this.visit(node.type);
6980 } 6979 }
6981 else { 6980 else {
6982 this.sb.add('var'); 6981 this.sb.add('var');
6983 } 6982 }
6984 this.sb.add(' '); 6983 this.sb.add(' ');
6985 this.visit(node.definitions); 6984 this.visit(node.definitions);
6986 if ($notnull_bool($eq(node.endToken.get$value(), const$208/*const SourceString (';')*/))) { 6985 if ($notnull_bool($eq(node.endToken.get$value(), const$210/*const SourceString (';')*/))) {
6987 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString())); 6986 this.add((($0 = node.endToken.get$value()) && $0.is$SourceString()));
6988 } 6987 }
6989 } 6988 }
6990 Unparser.prototype.add$1 = function($0) { 6989 Unparser.prototype.add$1 = function($0) {
6991 return this.add(($0 && $0.is$SourceString())); 6990 return this.add(($0 && $0.is$SourceString()));
6992 }; 6991 };
6993 Unparser.prototype.visit$1 = function($0) { 6992 Unparser.prototype.visit$1 = function($0) {
6994 return this.visit(($0 && $0.is$Node())); 6993 return this.visit(($0 && $0.is$Node()));
6995 }; 6994 };
6996 // ********** Code for top level ************** 6995 // ********** Code for top level **************
(...skipping 23 matching lines...) Expand all
7020 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 7019 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
7021 }; 7020 };
7022 Element.prototype.hashCode$0 = function() { 7021 Element.prototype.hashCode$0 = function() {
7023 return this.hashCode(); 7022 return this.hashCode();
7024 }; 7023 };
7025 // ********** Code for VariableElement ************** 7024 // ********** Code for VariableElement **************
7026 function VariableElement(node, typeAnnotation, name, enclosingElement) { 7025 function VariableElement(node, typeAnnotation, name, enclosingElement) {
7027 this.node = node; 7026 this.node = node;
7028 this.typeAnnotation = typeAnnotation; 7027 this.typeAnnotation = typeAnnotation;
7029 // Initializers done 7028 // Initializers done
7030 Element.call(this, name, const$228, enclosingElement); 7029 Element.call(this, name, const$230, enclosingElement);
7031 } 7030 }
7032 $inherits(VariableElement, Element); 7031 $inherits(VariableElement, Element);
7033 VariableElement.prototype.get$type = function() { return this.type; }; 7032 VariableElement.prototype.get$type = function() { return this.type; };
7034 VariableElement.prototype.set$type = function(value) { return this.type = value; }; 7033 VariableElement.prototype.set$type = function(value) { return this.type = value; };
7035 VariableElement.prototype.parseNode = function(canceler, logger) { 7034 VariableElement.prototype.parseNode = function(canceler, logger) {
7036 return this.node; 7035 return this.node;
7037 } 7036 }
7038 VariableElement.prototype.computeType = function(compiler, types) { 7037 VariableElement.prototype.computeType = function(compiler, types) {
7039 return getType(this.typeAnnotation, types); 7038 return getType(this.typeAnnotation, types);
7040 } 7039 }
7041 VariableElement.prototype.computeType$2 = function($0, $1) { 7040 VariableElement.prototype.computeType$2 = function($0, $1) {
7042 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 7041 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
7043 }; 7042 };
7044 // ********** Code for ForeignElement ************** 7043 // ********** Code for ForeignElement **************
7045 function ForeignElement(name) { 7044 function ForeignElement(name) {
7046 // Initializers done 7045 // Initializers done
7047 Element.call(this, name, const$204, null); 7046 Element.call(this, name, const$206, null);
7048 } 7047 }
7049 $inherits(ForeignElement, Element); 7048 $inherits(ForeignElement, Element);
7050 ForeignElement.prototype.computeType = function(compiler, types) { 7049 ForeignElement.prototype.computeType = function(compiler, types) {
7051 return types.dynamicType; 7050 return types.dynamicType;
7052 } 7051 }
7053 ForeignElement.prototype.computeType$2 = function($0, $1) { 7052 ForeignElement.prototype.computeType$2 = function($0, $1) {
7054 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types())); 7053 return this.computeType(($0 && $0.is$Compiler()), ($1 && $1.is$Types()));
7055 }; 7054 };
7056 // ********** Code for FunctionElement ************** 7055 // ********** Code for FunctionElement **************
7057 function FunctionElement(name) { 7056 function FunctionElement(name) {
7058 // Initializers done 7057 // Initializers done
7059 Element.call(this, name, const$201, null); 7058 Element.call(this, name, const$203, null);
7060 } 7059 }
7061 $inherits(FunctionElement, Element); 7060 $inherits(FunctionElement, Element);
7062 FunctionElement.prototype.get$type = function() { return this.type; }; 7061 FunctionElement.prototype.get$type = function() { return this.type; };
7063 FunctionElement.prototype.set$type = function(value) { return this.type = value; }; 7062 FunctionElement.prototype.set$type = function(value) { return this.type = value; };
7064 FunctionElement.prototype.computeType = function(compiler, types) { 7063 FunctionElement.prototype.computeType = function(compiler, types) {
7065 var $0; 7064 var $0;
7066 if (this.type != null) return (($0 = this.type) && $0.is$FunctionType()); 7065 if (this.type != null) return (($0 = this.type) && $0.is$FunctionType());
7067 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion()); 7066 var node = (($0 = this.parseNode(compiler, compiler)) && $0.is$FunctionExpress ion());
7068 var returnType = getType(node.returnType, types); 7067 var returnType = getType(node.returnType, types);
7069 if (returnType == null) compiler.cancel(('unknown type ' + returnType + '')); 7068 if (returnType == null) compiler.cancel(('unknown type ' + returnType + ''));
7070 var parameterTypes = new LinkBuilderImplementation(); 7069 var parameterTypes = new LinkBuilderImplementation();
7071 for (var link = node.parameters.nodes; 7070 for (var link = node.parameters.nodes;
7072 !$notnull_bool(link.isEmpty$0()); link = link.get$tail()) { 7071 !$notnull_bool(link.isEmpty$0()); link = link.get$tail()) {
7073 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions()); 7072 var parameter = (($0 = link.get$head()) && $0.is$VariableDefinitions());
7074 parameterTypes.addLast(getType(parameter.type, types)); 7073 parameterTypes.addLast(getType(parameter.type, types));
7075 } 7074 }
7076 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type())); 7075 this.type = new FunctionType(returnType, (($0 = parameterTypes.toLink()) && $0 .is$Link$Type()));
7077 return (($0 = this.type) && $0.is$FunctionType()); 7076 return (($0 = this.type) && $0.is$FunctionType());
7078 } 7077 }
7079 FunctionElement.prototype.computeType$2 = FunctionElement.prototype.computeType; 7078 FunctionElement.prototype.computeType$2 = FunctionElement.prototype.computeType;
7080 // ********** Code for ClassElement ************** 7079 // ********** Code for ClassElement **************
7081 function ClassElement(name) { 7080 function ClassElement(name) {
7082 this.interfaces = const$14/*const EmptyLink()*/ 7081 this.interfaces = const$16/*const EmptyLink()*/
7083 this.isResolved = false 7082 this.isResolved = false
7084 // Initializers done 7083 // Initializers done
7085 Element.call(this, name, const$199, null); 7084 Element.call(this, name, const$201, null);
7086 } 7085 }
7087 $inherits(ClassElement, Element); 7086 $inherits(ClassElement, Element);
7088 ClassElement.prototype.is$ClassElement = function(){return this;}; 7087 ClassElement.prototype.is$ClassElement = function(){return this;};
7089 ClassElement.prototype.get$type = function() { return this.type; }; 7088 ClassElement.prototype.get$type = function() { return this.type; };
7090 ClassElement.prototype.set$type = function(value) { return this.type = value; }; 7089 ClassElement.prototype.set$type = function(value) { return this.type = value; };
7091 ClassElement.prototype.get$interfaces = function() { return this.interfaces; }; 7090 ClassElement.prototype.get$interfaces = function() { return this.interfaces; };
7092 ClassElement.prototype.set$interfaces = function(value) { return this.interfaces = value; }; 7091 ClassElement.prototype.set$interfaces = function(value) { return this.interfaces = value; };
7093 ClassElement.prototype.computeType = function(compiler, types) { 7092 ClassElement.prototype.computeType = function(compiler, types) {
7094 if (this.type == null) { 7093 if (this.type == null) {
7095 this.type = new SimpleType(this.name, this); 7094 this.type = new SimpleType(this.name, this);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
7367 } 7366 }
7368 SsaBuilder.prototype.visitSend = function(node) { 7367 SsaBuilder.prototype.visitSend = function(node) {
7369 var $0; 7368 var $0;
7370 var element = (($0 = this.elements.$index(node)) && $0.is$Element()); 7369 var element = (($0 = this.elements.$index(node)) && $0.is$Element());
7371 if ((node.selector instanceof Operator)) { 7370 if ((node.selector instanceof Operator)) {
7372 this.visit(node.receiver); 7371 this.visit(node.receiver);
7373 this.visit(node.argumentsNode); 7372 this.visit(node.argumentsNode);
7374 var right = this.pop(); 7373 var right = this.pop();
7375 var left = this.pop(); 7374 var left = this.pop();
7376 var op = (($0 = node.selector) && $0.is$Operator()); 7375 var op = (($0 = node.selector) && $0.is$Operator());
7377 if ($notnull_bool($eq(const$253/*const SourceString("+")*/, op.get$source()) )) { 7376 if ($notnull_bool($eq(const$255/*const SourceString("+")*/, op.get$source()) )) {
7378 this.push(new HAdd(element, [left, right])); 7377 this.push(new HAdd(element, [left, right]));
7379 } 7378 }
7380 else if ($notnull_bool($eq(const$254/*const SourceString("-")*/, op.get$sour ce()))) { 7379 else if ($notnull_bool($eq(const$256/*const SourceString("-")*/, op.get$sour ce()))) {
7381 this.push(new HSubtract(element, [left, right])); 7380 this.push(new HSubtract(element, [left, right]));
7382 } 7381 }
7383 else if ($notnull_bool($eq(const$255/*const SourceString("*")*/, op.get$sour ce()))) { 7382 else if ($notnull_bool($eq(const$257/*const SourceString("*")*/, op.get$sour ce()))) {
7384 this.push(new HMultiply(element, [left, right])); 7383 this.push(new HMultiply(element, [left, right]));
7385 } 7384 }
7386 else if ($notnull_bool($eq(const$256/*const SourceString("/")*/, op.get$sour ce()))) { 7385 else if ($notnull_bool($eq(const$258/*const SourceString("/")*/, op.get$sour ce()))) {
7387 this.push(new HDivide(element, [left, right])); 7386 this.push(new HDivide(element, [left, right]));
7388 } 7387 }
7389 else if ($notnull_bool($eq(const$257/*const SourceString("~/")*/, op.get$sou rce()))) { 7388 else if ($notnull_bool($eq(const$259/*const SourceString("~/")*/, op.get$sou rce()))) {
7390 this.push(new HTruncatingDivide(element, [left, right])); 7389 this.push(new HTruncatingDivide(element, [left, right]));
7391 } 7390 }
7392 else if ($notnull_bool($eq(const$258/*const SourceString("==")*/, op.get$sou rce()))) { 7391 else if ($notnull_bool($eq(const$260/*const SourceString("==")*/, op.get$sou rce()))) {
7393 this.push(new HEquals(element, [left, right])); 7392 this.push(new HEquals(element, [left, right]));
7394 } 7393 }
7395 } 7394 }
7396 else if ($notnull_bool(node.get$isPropertyAccess())) { 7395 else if ($notnull_bool(node.get$isPropertyAccess())) {
7397 if (node.receiver != null) { 7396 if (node.receiver != null) {
7398 this.compiler.unimplemented("SsaBuilder.visitSend with receiver"); 7397 this.compiler.unimplemented("SsaBuilder.visitSend with receiver");
7399 } 7398 }
7400 this.stack.add(this.definitions.$index(element)); 7399 this.stack.add(this.definitions.$index(element));
7401 } 7400 }
7402 else { 7401 else {
7403 var link = node.get$arguments(); 7402 var link = node.get$arguments();
7404 if (element.kind === const$204/*ElementKind.FOREIGN*/) { 7403 if (element.kind === const$206/*ElementKind.FOREIGN*/) {
7405 link = (($0 = link.get$tail()) && $0.is$Link$Node()); 7404 link = (($0 = link.get$tail()) && $0.is$Link$Node());
7406 } 7405 }
7407 var arguments = []; 7406 var arguments = [];
7408 for (; !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0. is$Link$Node())) { 7407 for (; !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0. is$Link$Node())) {
7409 this.visit((($0 = link.get$head()) && $0.is$Node())); 7408 this.visit((($0 = link.get$head()) && $0.is$Node()));
7410 arguments.add$1(this.pop()); 7409 arguments.add$1(this.pop());
7411 } 7410 }
7412 if (element.kind === const$204/*ElementKind.FOREIGN*/) { 7411 if (element.kind === const$206/*ElementKind.FOREIGN*/) {
7413 var literal = (($0 = node.get$arguments().get$head()) && $0.is$LiteralStri ng()); 7412 var literal = (($0 = node.get$arguments().get$head()) && $0.is$LiteralStri ng());
7414 this.compiler.ensure((literal instanceof LiteralString)); 7413 this.compiler.ensure((literal instanceof LiteralString));
7415 this.push(new HInvokeForeign(element, arguments, this.unquote(literal))); 7414 this.push(new HInvokeForeign(element, arguments, this.unquote(literal)));
7416 } 7415 }
7417 else { 7416 else {
7418 var selector = (($0 = node.selector) && $0.is$Identifier()); 7417 var selector = (($0 = node.selector) && $0.is$Identifier());
7419 this.push(new HInvoke(element, arguments)); 7418 this.push(new HInvoke(element, arguments));
7420 } 7419 }
7421 } 7420 }
7422 } 7421 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
7775 var $0; 7774 var $0;
7776 this.buffer.add(('' + this.local((($0 = node.inputs.$index(0)) && $0.is$HLocal ())) + '')); 7775 this.buffer.add(('' + this.local((($0 = node.inputs.$index(0)) && $0.is$HLocal ())) + ''));
7777 } 7776 }
7778 SsaCodeGenerator.prototype.visitLocal = function(node) { 7777 SsaCodeGenerator.prototype.visitLocal = function(node) {
7779 this.buffer.add(('var ' + this.local(node) + '')); 7778 this.buffer.add(('var ' + this.local(node) + ''));
7780 } 7779 }
7781 SsaCodeGenerator.prototype.visit$1 = SsaCodeGenerator.prototype.visit; 7780 SsaCodeGenerator.prototype.visit$1 = SsaCodeGenerator.prototype.visit;
7782 // ********** Code for JsNames ************** 7781 // ********** Code for JsNames **************
7783 function JsNames() {} 7782 function JsNames() {}
7784 JsNames.get$reserved = function() { 7783 JsNames.get$reserved = function() {
7785 if (JsNames._reserved == null) { 7784 if ($globals.JsNames__reserved == null) {
7786 JsNames._reserved = new HashSetImplementation(); 7785 $globals.JsNames__reserved = new HashSetImplementation();
7787 JsNames._reserved.addAll(const$261/*JsNames.reservedPropertySymbols*/); 7786 $globals.JsNames__reserved.addAll(const$263/*JsNames.reservedPropertySymbols */);
7788 JsNames._reserved.addAll(const$263/*JsNames.reservedGlobalSymbols*/); 7787 $globals.JsNames__reserved.addAll(const$265/*JsNames.reservedGlobalSymbols*/ );
7789 JsNames._reserved.addAll(const$265/*JsNames.javaScriptKeywords*/); 7788 $globals.JsNames__reserved.addAll(const$267/*JsNames.javaScriptKeywords*/);
7790 } 7789 }
7791 return JsNames._reserved; 7790 return $globals.JsNames__reserved;
7792 } 7791 }
7793 JsNames.getValid = function(name) { 7792 JsNames.getValid = function(name) {
7794 if (JsNames.get$reserved().contains(name)) { 7793 if (JsNames.get$reserved().contains(name)) {
7795 name = ('\$' + name + ''); 7794 name = ('\$' + name + '');
7796 $assert(!JsNames.get$reserved().contains(name), "!reserved.contains(name)", "js_names.dart", 171, 14); 7795 $assert(!JsNames.get$reserved().contains(name), "!reserved.contains(name)", "js_names.dart", 171, 14);
7797 } 7796 }
7798 else if (name.contains("$")) { 7797 else if (name.contains("$")) {
7799 name = name.replaceAll("$", "_$"); 7798 name = name.replaceAll("$", "_$");
7800 } 7799 }
7801 return name; 7800 return name;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
8084 // Initializers done 8083 // Initializers done
8085 HBasicBlock.withId$ctor.call(this, null); 8084 HBasicBlock.withId$ctor.call(this, null);
8086 } 8085 }
8087 HBasicBlock.withId$ctor = function(id) { 8086 HBasicBlock.withId$ctor = function(id) {
8088 this.status = 0/*HBasicBlock.STATUS_NEW*/ 8087 this.status = 0/*HBasicBlock.STATUS_NEW*/
8089 this.isLoopHeader = false 8088 this.isLoopHeader = false
8090 this.dominator = null 8089 this.dominator = null
8091 this.id = id; 8090 this.id = id;
8092 this.phis = new HInstructionList(); 8091 this.phis = new HInstructionList();
8093 this.predecessors = []; 8092 this.predecessors = [];
8094 this.successors = const$13/*const []*/; 8093 this.successors = const$15/*const []*/;
8095 this.dominatedBlocks = []; 8094 this.dominatedBlocks = [];
8096 // Initializers done 8095 // Initializers done
8097 HInstructionList.call(this); 8096 HInstructionList.call(this);
8098 } 8097 }
8099 HBasicBlock.withId$ctor.prototype = HBasicBlock.prototype; 8098 HBasicBlock.withId$ctor.prototype = HBasicBlock.prototype;
8100 $inherits(HBasicBlock, HInstructionList); 8099 $inherits(HBasicBlock, HInstructionList);
8101 HBasicBlock.prototype.is$HBasicBlock = function(){return this;}; 8100 HBasicBlock.prototype.is$HBasicBlock = function(){return this;};
8102 HBasicBlock.prototype.isNew = function() { 8101 HBasicBlock.prototype.isNew = function() {
8103 return this.status == 0/*HBasicBlock.STATUS_NEW*/; 8102 return this.status == 0/*HBasicBlock.STATUS_NEW*/;
8104 } 8103 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
8303 HInstruction.prototype.setGenerateAtUseSite = function() { 8302 HInstruction.prototype.setGenerateAtUseSite = function() {
8304 this.setFlag(2/*HInstruction.FLAG_GENERATE_AT_USE_SITE*/); 8303 this.setFlag(2/*HInstruction.FLAG_GENERATE_AT_USE_SITE*/);
8305 } 8304 }
8306 HInstruction.prototype.useGvn = function() { 8305 HInstruction.prototype.useGvn = function() {
8307 return this.getFlag(3/*HInstruction.FLAG_USE_GVN*/); 8306 return this.getFlag(3/*HInstruction.FLAG_USE_GVN*/);
8308 } 8307 }
8309 HInstruction.prototype.setUseGvn = function() { 8308 HInstruction.prototype.setUseGvn = function() {
8310 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/); 8309 this.setFlag(3/*HInstruction.FLAG_USE_GVN*/);
8311 } 8310 }
8312 HInstruction.prototype.get$usedBy = function() { 8311 HInstruction.prototype.get$usedBy = function() {
8313 if (this._usedBy == null) return const$13/*const []*/; 8312 if (this._usedBy == null) return const$15/*const []*/;
8314 return this._usedBy; 8313 return this._usedBy;
8315 } 8314 }
8316 HInstruction.prototype.isInBasicBlock = function() { 8315 HInstruction.prototype.isInBasicBlock = function() {
8317 return this._usedBy != null; 8316 return this._usedBy != null;
8318 } 8317 }
8319 HInstruction.prototype.equals = function(other) { 8318 HInstruction.prototype.equals = function(other) {
8320 $assert($notnull_bool(this.useGvn()) && $notnull_bool(other.useGvn()), "useGvn () && other.useGvn()", "nodes.dart", 539, 12); 8319 $assert($notnull_bool(this.useGvn()) && $notnull_bool(other.useGvn()), "useGvn () && other.useGvn()", "nodes.dart", 539, 12);
8321 if (!$notnull_bool(this.typeEquals(other))) return false; 8320 if (!$notnull_bool(this.typeEquals(other))) return false;
8322 if (this.flags != other.flags) return false; 8321 if (this.flags != other.flags) return false;
8323 var inputsLength = this.inputs.length; 8322 var inputsLength = this.inputs.length;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
8583 } 8582 }
8584 HEquals.prototype.dataEquals = function(other) { 8583 HEquals.prototype.dataEquals = function(other) {
8585 return true; 8584 return true;
8586 } 8585 }
8587 HEquals.prototype.accept$1 = function($0) { 8586 HEquals.prototype.accept$1 = function($0) {
8588 return this.accept(($0 && $0.is$HVisitor())); 8587 return this.accept(($0 && $0.is$HVisitor()));
8589 }; 8588 };
8590 // ********** Code for HExit ************** 8589 // ********** Code for HExit **************
8591 function HExit() { 8590 function HExit() {
8592 // Initializers done 8591 // Initializers done
8593 HControlFlow.call(this, const$13/*const []*/); 8592 HControlFlow.call(this, const$15/*const []*/);
8594 } 8593 }
8595 $inherits(HExit, HControlFlow); 8594 $inherits(HExit, HControlFlow);
8596 HExit.prototype.toString = function() { 8595 HExit.prototype.toString = function() {
8597 return 'exit'; 8596 return 'exit';
8598 } 8597 }
8599 HExit.prototype.accept = function(visitor) { 8598 HExit.prototype.accept = function(visitor) {
8600 return visitor.visitExit(this); 8599 return visitor.visitExit(this);
8601 } 8600 }
8602 HExit.prototype.accept$1 = function($0) { 8601 HExit.prototype.accept$1 = function($0) {
8603 return this.accept(($0 && $0.is$HVisitor())); 8602 return this.accept(($0 && $0.is$HVisitor()));
8604 }; 8603 };
8605 HExit.prototype.toString$0 = function() { 8604 HExit.prototype.toString$0 = function() {
8606 return this.toString(); 8605 return this.toString();
8607 }; 8606 };
8608 // ********** Code for HGoto ************** 8607 // ********** Code for HGoto **************
8609 function HGoto() { 8608 function HGoto() {
8610 // Initializers done 8609 // Initializers done
8611 HControlFlow.call(this, const$13/*const []*/); 8610 HControlFlow.call(this, const$15/*const []*/);
8612 } 8611 }
8613 $inherits(HGoto, HControlFlow); 8612 $inherits(HGoto, HControlFlow);
8614 HGoto.prototype.toString = function() { 8613 HGoto.prototype.toString = function() {
8615 return 'goto'; 8614 return 'goto';
8616 } 8615 }
8617 HGoto.prototype.accept = function(visitor) { 8616 HGoto.prototype.accept = function(visitor) {
8618 return visitor.visitGoto(this); 8617 return visitor.visitGoto(this);
8619 } 8618 }
8620 HGoto.prototype.accept$1 = function($0) { 8619 HGoto.prototype.accept$1 = function($0) {
8621 return this.accept(($0 && $0.is$HVisitor())); 8620 return this.accept(($0 && $0.is$HVisitor()));
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
9107 function HTracer() {} 9106 function HTracer() {}
9108 HTracer._internal$ctor = function() { 9107 HTracer._internal$ctor = function() {
9109 this.indent = 0 9108 this.indent = 0
9110 this.output = new StringBufferImpl(""); 9109 this.output = new StringBufferImpl("");
9111 // Initializers done 9110 // Initializers done
9112 HGraphVisitor.call(this); 9111 HGraphVisitor.call(this);
9113 } 9112 }
9114 HTracer._internal$ctor.prototype = HTracer.prototype; 9113 HTracer._internal$ctor.prototype = HTracer.prototype;
9115 $inherits(HTracer, HGraphVisitor); 9114 $inherits(HTracer, HGraphVisitor);
9116 HTracer.HTracer$singleton$factory = function() { 9115 HTracer.HTracer$singleton$factory = function() {
9117 if (HTracer._singleton == null) HTracer._singleton = new HTracer._internal$cto r(); 9116 if ($globals.HTracer__singleton == null) $globals.HTracer__singleton = new HTr acer._internal$ctor();
9118 return HTracer._singleton; 9117 return $globals.HTracer__singleton;
9119 } 9118 }
9120 HTracer.prototype.traceCompilation = function(methodName) { 9119 HTracer.prototype.traceCompilation = function(methodName) {
9121 var $this = this; // closure support 9120 var $this = this; // closure support
9122 this.tag("compilation", (function () { 9121 this.tag("compilation", (function () {
9123 $this.printProperty("name", methodName); 9122 $this.printProperty("name", methodName);
9124 $this.printProperty("method", methodName); 9123 $this.printProperty("method", methodName);
9125 $this.printProperty("date", new DateImplementation.now$ctor().value); 9124 $this.printProperty("date", new DateImplementation.now$ctor().value);
9126 }) 9125 })
9127 ); 9126 );
9128 } 9127 }
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
9561 // ********** Code for top level ************** 9560 // ********** Code for top level **************
9562 // ********** Library leg ************** 9561 // ********** Library leg **************
9563 // ********** Code for WorldCompiler ************** 9562 // ********** Code for WorldCompiler **************
9564 function WorldCompiler(world, script) { 9563 function WorldCompiler(world, script) {
9565 this.world = world; 9564 this.world = world;
9566 // Initializers done 9565 // Initializers done
9567 Compiler.call(this, script); 9566 Compiler.call(this, script);
9568 } 9567 }
9569 $inherits(WorldCompiler, Compiler); 9568 $inherits(WorldCompiler, Compiler);
9570 WorldCompiler.prototype.log = function(message) { 9569 WorldCompiler.prototype.log = function(message) {
9571 if ($notnull_bool(options.showInfo)) { 9570 if ($notnull_bool($globals.options.showInfo)) {
9572 this.world.info(('[leg] ' + message + '')); 9571 this.world.info(('[leg] ' + message + ''));
9573 } 9572 }
9574 } 9573 }
9575 WorldCompiler.prototype.run = function() { 9574 WorldCompiler.prototype.run = function() {
9576 var success = Compiler.prototype.run.call(this); 9575 var success = Compiler.prototype.run.call(this);
9577 if ($notnull_bool(success)) { 9576 if ($notnull_bool(success)) {
9578 var code = this.getGeneratedCode(); 9577 var code = this.getGeneratedCode();
9579 this.world.legCode = $assert_String(code); 9578 this.world.legCode = $assert_String(code);
9580 this.world.jsBytesWritten = code.length; 9579 this.world.jsBytesWritten = code.length;
9581 var $list = this.tasks; 9580 var $list = this.tasks;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
9640 } 9639 }
9641 if (false/*null.GENERATE_SSA_TRACE*/) { 9640 if (false/*null.GENERATE_SSA_TRACE*/) {
9642 print("------------------"); 9641 print("------------------");
9643 print(HTracer.HTracer$singleton$factory()); 9642 print(HTracer.HTracer$singleton$factory());
9644 print("------------------"); 9643 print("------------------");
9645 } 9644 }
9646 this.log('compilation succeeded'); 9645 this.log('compilation succeeded');
9647 return true; 9646 return true;
9648 } 9647 }
9649 Compiler.prototype.scanCoreLibrary = function() { 9648 Compiler.prototype.scanCoreLibrary = function() {
9650 var fileName = join([options.libDir, '..', 'leg', 'lib', 'core.dart']); 9649 var fileName = join([$globals.options.libDir, '..', 'leg', 'lib', 'core.dart'] );
9651 var file = readSync(fileName); 9650 var file = readSync(fileName);
9652 this.scanner.scan(new leg_Script(file)); 9651 this.scanner.scan(new leg_Script(file));
9653 var element = new ForeignElement(const$203/*const SourceString('JS')*/); 9652 var element = new ForeignElement(const$205/*const SourceString('JS')*/);
9654 this.universe.define(element); 9653 this.universe.define(element);
9655 } 9654 }
9656 Compiler.prototype.runCompiler = function() { 9655 Compiler.prototype.runCompiler = function() {
9657 var $0; 9656 var $0;
9658 this.scanCoreLibrary(); 9657 this.scanCoreLibrary();
9659 this.scanner.scan(this.script); 9658 this.scanner.scan(this.script);
9660 var element = this.universe.find(const$206/*Compiler.MAIN*/); 9659 var element = this.universe.find(const$208/*Compiler.MAIN*/);
9661 if (element == null) this.cancel(('Could not find ' + const$206/*Compiler.MAIN */ + '')); 9660 if (element == null) this.cancel(('Could not find ' + const$208/*Compiler.MAIN */ + ''));
9662 this.compileMethod(element); 9661 this.compileMethod(element);
9663 while (!this.worklist.isEmpty()) { 9662 while (!this.worklist.isEmpty()) {
9664 this.compileMethod((($0 = this.worklist.removeLast()) && $0.is$Element())); 9663 this.compileMethod((($0 = this.worklist.removeLast()) && $0.is$Element()));
9665 } 9664 }
9666 } 9665 }
9667 Compiler.prototype.compileMethod = function(element) { 9666 Compiler.prototype.compileMethod = function(element) {
9668 var tree = this.parser.parse(element); 9667 var tree = this.parser.parse(element);
9669 var elements = this.resolver.resolve(tree); 9668 var elements = this.resolver.resolve(tree);
9670 this.checker.check(tree, elements); 9669 this.checker.check(tree, elements);
9671 var graph = this.builder.build(tree, elements); 9670 var graph = this.builder.build(tree, elements);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
9820 var element = this.context.lookup(node.get$source()); 9819 var element = this.context.lookup(node.get$source());
9821 if (element == null) this.fail(node, ErrorMessages.cannotResolve(node)); 9820 if (element == null) this.fail(node, ErrorMessages.cannotResolve(node));
9822 return this.useElement(node, element); 9821 return this.useElement(node, element);
9823 } 9822 }
9824 ResolverVisitor.prototype.visitIf = function(node) { 9823 ResolverVisitor.prototype.visitIf = function(node) {
9825 this.visit(node.condition); 9824 this.visit(node.condition);
9826 this.visit(node.thenPart); 9825 this.visit(node.thenPart);
9827 this.visit(node.elsePart); 9826 this.visit(node.elsePart);
9828 } 9827 }
9829 ResolverVisitor.prototype.potentiallyMapOperatorToMethodName = function(name) { 9828 ResolverVisitor.prototype.potentiallyMapOperatorToMethodName = function(name) {
9830 if ($notnull_bool($eq(name, const$213/*const SourceString('+')*/))) return con st$214/*const SourceString('add')*/; 9829 if ($notnull_bool($eq(name, const$215/*const SourceString('+')*/))) return con st$216/*const SourceString('add')*/;
9831 if ($notnull_bool($eq(name, const$215/*const SourceString('-')*/))) return con st$216/*const SourceString('sub')*/; 9830 if ($notnull_bool($eq(name, const$217/*const SourceString('-')*/))) return con st$218/*const SourceString('sub')*/;
9832 if ($notnull_bool($eq(name, const$217/*const SourceString('*')*/))) return con st$218/*const SourceString('mul')*/; 9831 if ($notnull_bool($eq(name, const$219/*const SourceString('*')*/))) return con st$220/*const SourceString('mul')*/;
9833 if ($notnull_bool($eq(name, const$219/*const SourceString('/')*/))) return con st$220/*const SourceString('div')*/; 9832 if ($notnull_bool($eq(name, const$221/*const SourceString('/')*/))) return con st$222/*const SourceString('div')*/;
9834 if ($notnull_bool($eq(name, const$221/*const SourceString('~/')*/))) return co nst$222/*const SourceString('tdiv')*/; 9833 if ($notnull_bool($eq(name, const$223/*const SourceString('~/')*/))) return co nst$224/*const SourceString('tdiv')*/;
9835 if ($notnull_bool($eq(name, const$223/*const SourceString('==')*/))) return co nst$224/*const SourceString('eq')*/; 9834 if ($notnull_bool($eq(name, const$225/*const SourceString('==')*/))) return co nst$226/*const SourceString('eq')*/;
9836 if ($notnull_bool($eq(name, const$225/*const SourceString('<')*/))) return con st$226/*const SourceString('lt')*/; 9835 if ($notnull_bool($eq(name, const$227/*const SourceString('<')*/))) return con st$228/*const SourceString('lt')*/;
9837 return name; 9836 return name;
9838 } 9837 }
9839 ResolverVisitor.prototype.visitSend = function(node) { 9838 ResolverVisitor.prototype.visitSend = function(node) {
9840 var $0; 9839 var $0;
9841 this.visit(node.receiver); 9840 this.visit(node.receiver);
9842 var identifier = (($0 = node.selector) && $0.is$Identifier()); 9841 var identifier = (($0 = node.selector) && $0.is$Identifier());
9843 var name = this.potentiallyMapOperatorToMethodName(identifier.get$source()); 9842 var name = this.potentiallyMapOperatorToMethodName(identifier.get$source());
9844 var target = this.context.lookup(name); 9843 var target = this.context.lookup(name);
9845 if (target == null) this.fail(node, ErrorMessages.cannotResolve(name)); 9844 if (target == null) this.fail(node, ErrorMessages.cannotResolve(name));
9846 this.visit(node.argumentsNode); 9845 this.visit(node.argumentsNode);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
9881 this.fail(node, "Unimplemented in the resolver"); 9880 this.fail(node, "Unimplemented in the resolver");
9882 } 9881 }
9883 ResolverVisitor.prototype.visitReturn = function(node) { 9882 ResolverVisitor.prototype.visitReturn = function(node) {
9884 this.visit(node.expression); 9883 this.visit(node.expression);
9885 } 9884 }
9886 ResolverVisitor.prototype.visitThrow = function(node) { 9885 ResolverVisitor.prototype.visitThrow = function(node) {
9887 this.visit(node.expression); 9886 this.visit(node.expression);
9888 } 9887 }
9889 ResolverVisitor.prototype.visitTypeAnnotation = function(node) { 9888 ResolverVisitor.prototype.visitTypeAnnotation = function(node) {
9890 var name = node.typeName; 9889 var name = node.typeName;
9891 if ($notnull_bool($eq(name.get$source(), const$227/*const SourceString('var')* /))) return null; 9890 if ($notnull_bool($eq(name.get$source(), const$229/*const SourceString('var')* /))) return null;
9892 if ($notnull_bool($eq(name.get$source(), const$4/*const SourceString('void')*/ ))) return null; 9891 if ($notnull_bool($eq(name.get$source(), const$6/*const SourceString('void')*/ ))) return null;
9893 var element = this.context.lookup(name.get$source()); 9892 var element = this.context.lookup(name.get$source());
9894 if (element == null) { 9893 if (element == null) {
9895 this.warning(node, ErrorMessages.cannotResolveType(name)); 9894 this.warning(node, ErrorMessages.cannotResolveType(name));
9896 } 9895 }
9897 else if (element.kind !== const$199/*ElementKind.CLASS*/) { 9896 else if (element.kind !== const$201/*ElementKind.CLASS*/) {
9898 this.warning(node, ErrorMessages.notAType(name)); 9897 this.warning(node, ErrorMessages.notAType(name));
9899 } 9898 }
9900 else { 9899 else {
9901 var cls = (element && element.is$ClassElement()); 9900 var cls = (element && element.is$ClassElement());
9902 this.compiler.resolver.toResolve.add(element); 9901 this.compiler.resolver.toResolve.add(element);
9903 } 9902 }
9904 return this.useElement(node, element); 9903 return this.useElement(node, element);
9905 } 9904 }
9906 ResolverVisitor.prototype.visitVariableDefinitions = function(node) { 9905 ResolverVisitor.prototype.visitVariableDefinitions = function(node) {
9907 this.visit(node.type); 9906 this.visit(node.type);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
9941 } 9940 }
9942 return element.computeType(this.compiler, null); 9941 return element.computeType(this.compiler, null);
9943 } 9942 }
9944 ClassResolverVisitor.prototype.visitTypeAnnotation = function(node) { 9943 ClassResolverVisitor.prototype.visitTypeAnnotation = function(node) {
9945 var $0; 9944 var $0;
9946 var name = node.typeName; 9945 var name = node.typeName;
9947 var element = this.context.lookup(name.get$source()); 9946 var element = this.context.lookup(name.get$source());
9948 if (element == null) { 9947 if (element == null) {
9949 this.compiler.cancel(ErrorMessages.cannotResolveType(name)); 9948 this.compiler.cancel(ErrorMessages.cannotResolveType(name));
9950 } 9949 }
9951 else if (element.kind !== const$199/*ElementKind.CLASS*/) { 9950 else if (element.kind !== const$201/*ElementKind.CLASS*/) {
9952 this.compiler.cancel(ErrorMessages.notAType(name)); 9951 this.compiler.cancel(ErrorMessages.notAType(name));
9953 } 9952 }
9954 else { 9953 else {
9955 this.compiler.resolver.toResolve.add(element); 9954 this.compiler.resolver.toResolve.add(element);
9956 return (($0 = element.computeType(this.compiler, null)) && $0.is$Type()); 9955 return (($0 = element.computeType(this.compiler, null)) && $0.is$Type());
9957 } 9956 }
9958 return null; 9957 return null;
9959 } 9958 }
9960 ClassResolverVisitor.prototype.visit = function(node) { 9959 ClassResolverVisitor.prototype.visit = function(node) {
9961 var $0; 9960 var $0;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
10003 VariableDefinitionsVisitor.prototype.visit$1 = function($0) { 10002 VariableDefinitionsVisitor.prototype.visit$1 = function($0) {
10004 return this.visit(($0 && $0.is$Node())); 10003 return this.visit(($0 && $0.is$Node()));
10005 }; 10004 };
10006 // ********** Code for Scope ************** 10005 // ********** Code for Scope **************
10007 function Scope(parent) { 10006 function Scope(parent) {
10008 // Initializers done 10007 // Initializers done
10009 Scope.enclosing$ctor.call(this, parent, parent.enclosingElement); 10008 Scope.enclosing$ctor.call(this, parent, parent.enclosingElement);
10010 } 10009 }
10011 Scope.top$ctor = function() { 10010 Scope.top$ctor = function() {
10012 this.parent = null; 10011 this.parent = null;
10013 this.elements = const$212/*const {}*/; 10012 this.elements = const$214/*const {}*/;
10014 this.enclosingElement = null; 10013 this.enclosingElement = null;
10015 // Initializers done 10014 // Initializers done
10016 } 10015 }
10017 Scope.top$ctor.prototype = Scope.prototype; 10016 Scope.top$ctor.prototype = Scope.prototype;
10018 Scope.enclosing$ctor = function(parent, enclosingElement) { 10017 Scope.enclosing$ctor = function(parent, enclosingElement) {
10019 this.parent = parent; 10018 this.parent = parent;
10020 this.enclosingElement = enclosingElement; 10019 this.enclosingElement = enclosingElement;
10021 this.elements = $map([]); 10020 this.elements = $map([]);
10022 // Initializers done 10021 // Initializers done
10023 } 10022 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
10152 sb.add('('); 10151 sb.add('(');
10153 this.parameterTypes.printOn(sb, ', '); 10152 this.parameterTypes.printOn(sb, ', ');
10154 sb.add((') -> ' + this.returnType + '')); 10153 sb.add((') -> ' + this.returnType + ''));
10155 return sb.toString(); 10154 return sb.toString();
10156 } 10155 }
10157 FunctionType.prototype.toString$0 = function() { 10156 FunctionType.prototype.toString$0 = function() {
10158 return this.toString(); 10157 return this.toString();
10159 }; 10158 };
10160 // ********** Code for Types ************** 10159 // ********** Code for Types **************
10161 function Types() { 10160 function Types() {
10162 this.voidType = new SimpleType.named$ctor(const$4/*Types.VOID*/); 10161 this.voidType = new SimpleType.named$ctor(const$6/*Types.VOID*/);
10163 this.intType = new SimpleType.named$ctor(const$6/*Types.INT*/); 10162 this.intType = new SimpleType.named$ctor(const$8/*Types.INT*/);
10164 this.dynamicType = new SimpleType.named$ctor(const$8/*Types.DYNAMIC*/); 10163 this.dynamicType = new SimpleType.named$ctor(const$10/*Types.DYNAMIC*/);
10165 this.stringType = new SimpleType.named$ctor(const$10/*Types.STRING*/); 10164 this.stringType = new SimpleType.named$ctor(const$12/*Types.STRING*/);
10166 // Initializers done 10165 // Initializers done
10167 } 10166 }
10168 Types.prototype.is$Types = function(){return this;}; 10167 Types.prototype.is$Types = function(){return this;};
10169 Types.prototype.lookup = function(s) { 10168 Types.prototype.lookup = function(s) {
10170 if ($notnull_bool($eq(const$4/*Types.VOID*/, s))) { 10169 if ($notnull_bool($eq(const$6/*Types.VOID*/, s))) {
10171 return this.voidType; 10170 return this.voidType;
10172 } 10171 }
10173 else if ($notnull_bool($eq(const$6/*Types.INT*/, s))) { 10172 else if ($notnull_bool($eq(const$8/*Types.INT*/, s))) {
10174 return this.intType; 10173 return this.intType;
10175 } 10174 }
10176 else if ($notnull_bool($eq(const$8/*Types.DYNAMIC*/, s)) || s.get$stringValue( ) === 'var') { 10175 else if ($notnull_bool($eq(const$10/*Types.DYNAMIC*/, s)) || s.get$stringValue () === 'var') {
10177 return this.dynamicType; 10176 return this.dynamicType;
10178 } 10177 }
10179 else if ($notnull_bool($eq(const$10/*Types.STRING*/, s))) { 10178 else if ($notnull_bool($eq(const$12/*Types.STRING*/, s))) {
10180 return this.stringType; 10179 return this.stringType;
10181 } 10180 }
10182 return null; 10181 return null;
10183 } 10182 }
10184 Types.prototype.isSubtype = function(r, s) { 10183 Types.prototype.isSubtype = function(r, s) {
10185 return r === s || r === this.dynamicType || s === this.dynamicType; 10184 return r === s || r === this.dynamicType || s === this.dynamicType;
10186 } 10185 }
10187 Types.prototype.isAssignable = function(r, s) { 10186 Types.prototype.isAssignable = function(r, s) {
10188 return $notnull_bool(this.isSubtype(r, s)) || $notnull_bool(this.isSubtype(s, r)); 10187 return $notnull_bool(this.isSubtype(r, s)) || $notnull_bool(this.isSubtype(s, r));
10189 } 10188 }
(...skipping 20 matching lines...) Expand all
10210 message = ('' + message + ': ' + reason + ''); 10209 message = ('' + message + ': ' + reason + '');
10211 } 10210 }
10212 $throw(new CancelTypeCheckException(node, message)); 10211 $throw(new CancelTypeCheckException(node, message));
10213 } 10212 }
10214 TypeCheckerVisitor.prototype.reportTypeWarning = function(node, kind, arguments) { 10213 TypeCheckerVisitor.prototype.reportTypeWarning = function(node, kind, arguments) {
10215 this.compiler.reportWarning(node, new TypeWarning(kind, arguments).getMessage( )); 10214 this.compiler.reportWarning(node, new TypeWarning(kind, arguments).getMessage( ));
10216 } 10215 }
10217 TypeCheckerVisitor.prototype.nonVoidType = function(node) { 10216 TypeCheckerVisitor.prototype.nonVoidType = function(node) {
10218 var type = this.type(node); 10217 var type = this.type(node);
10219 if ($eq(type, this.types.voidType)) { 10218 if ($eq(type, this.types.voidType)) {
10220 this.reportTypeWarning(node, const$243/*WarningKind.VOID_EXPRESSION*/, const $13/*const []*/); 10219 this.reportTypeWarning(node, const$245/*WarningKind.VOID_EXPRESSION*/, const $15/*const []*/);
10221 } 10220 }
10222 return type; 10221 return type;
10223 } 10222 }
10224 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) { 10223 TypeCheckerVisitor.prototype.typeWithDefault = function(node, defaultValue) {
10225 return node != null ? this.type(node) : defaultValue; 10224 return node != null ? this.type(node) : defaultValue;
10226 } 10225 }
10227 TypeCheckerVisitor.prototype.type = function(node) { 10226 TypeCheckerVisitor.prototype.type = function(node) {
10228 var $0; 10227 var $0;
10229 if (node == null) this.fail(null, 'unexpected node: null'); 10228 if (node == null) this.fail(null, 'unexpected node: null');
10230 var result = (($0 = node.accept(this)) && $0.is$Type()); 10229 var result = (($0 = node.accept(this)) && $0.is$Type());
10231 return result; 10230 return result;
10232 } 10231 }
10233 TypeCheckerVisitor.prototype.get$type = function() { 10232 TypeCheckerVisitor.prototype.get$type = function() {
10234 return TypeCheckerVisitor.prototype.type.bind(this); 10233 return TypeCheckerVisitor.prototype.type.bind(this);
10235 } 10234 }
10236 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) { 10235 TypeCheckerVisitor.prototype.checkAssignable = function(node, s, t) {
10237 if (!$notnull_bool(this.types.isAssignable(s, t))) { 10236 if (!$notnull_bool(this.types.isAssignable(s, t))) {
10238 this.reportTypeWarning(node, const$236/*WarningKind.NOT_ASSIGNABLE*/, [s, t] ); 10237 this.reportTypeWarning(node, const$238/*WarningKind.NOT_ASSIGNABLE*/, [s, t] );
10239 } 10238 }
10240 } 10239 }
10241 TypeCheckerVisitor.prototype.visitBlock = function(node) { 10240 TypeCheckerVisitor.prototype.visitBlock = function(node) {
10242 this.type(node.statements); 10241 this.type(node.statements);
10243 return this.types.voidType; 10242 return this.types.voidType;
10244 } 10243 }
10245 TypeCheckerVisitor.prototype.visitClassNode = function(node) { 10244 TypeCheckerVisitor.prototype.visitClassNode = function(node) {
10246 this.fail(node); 10245 this.fail(node);
10247 } 10246 }
10248 TypeCheckerVisitor.prototype.visitExpressionStatement = function(node) { 10247 TypeCheckerVisitor.prototype.visitExpressionStatement = function(node) {
(...skipping 20 matching lines...) Expand all
10269 this.type(node.thenPart); 10268 this.type(node.thenPart);
10270 if ($notnull_bool(node.get$hasElsePart())) this.type(node.elsePart); 10269 if ($notnull_bool(node.get$hasElsePart())) this.type(node.elsePart);
10271 return this.types.voidType; 10270 return this.types.voidType;
10272 } 10271 }
10273 TypeCheckerVisitor.prototype.visitSend = function(node) { 10272 TypeCheckerVisitor.prototype.visitSend = function(node) {
10274 var $0; 10273 var $0;
10275 var target = this.elements.$index(node); 10274 var target = this.elements.$index(node);
10276 var selector = (($0 = node.selector) && $0.is$Identifier()); 10275 var selector = (($0 = node.selector) && $0.is$Identifier());
10277 if (target != null) { 10276 if (target != null) {
10278 var name = selector.get$source(); 10277 var name = selector.get$source();
10279 if ($notnull_bool($eq(name, const$213/*const SourceString('+')*/)) || $notnu ll_bool($eq(name, const$240/*const SourceString('=')*/)) || $notnull_bool($eq(na me, const$215/*const SourceString('-')*/)) || $notnull_bool($eq(name, const$217/ *const SourceString('*')*/)) || $notnull_bool($eq(name, const$219/*const SourceS tring('/')*/)) || $notnull_bool($eq(name, const$225/*const SourceString('<')*/)) || $notnull_bool($eq(name, const$221/*const SourceString('~/')*/))) { 10278 if ($notnull_bool($eq(name, const$215/*const SourceString('+')*/)) || $notnu ll_bool($eq(name, const$242/*const SourceString('=')*/)) || $notnull_bool($eq(na me, const$217/*const SourceString('-')*/)) || $notnull_bool($eq(name, const$219/ *const SourceString('*')*/)) || $notnull_bool($eq(name, const$221/*const SourceS tring('/')*/)) || $notnull_bool($eq(name, const$227/*const SourceString('<')*/)) || $notnull_bool($eq(name, const$223/*const SourceString('~/')*/))) {
10280 return this.types.dynamicType; 10279 return this.types.dynamicType;
10281 } 10280 }
10282 var targetType = target.computeType$2(this.compiler, this.types); 10281 var targetType = target.computeType$2(this.compiler, this.types);
10283 if ($notnull_bool(node.get$isPropertyAccess())) { 10282 if ($notnull_bool(node.get$isPropertyAccess())) {
10284 return (targetType && targetType.is$Type()); 10283 return (targetType && targetType.is$Type());
10285 } 10284 }
10286 else if ($notnull_bool(node.get$isFunctionObjectInvocation())) { 10285 else if ($notnull_bool(node.get$isFunctionObjectInvocation())) {
10287 this.fail(node); 10286 this.fail(node);
10288 } 10287 }
10289 else { 10288 else {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
10346 } 10345 }
10347 TypeCheckerVisitor.prototype.visitOperator = function(node) { 10346 TypeCheckerVisitor.prototype.visitOperator = function(node) {
10348 return this.types.dynamicType; 10347 return this.types.dynamicType;
10349 } 10348 }
10350 TypeCheckerVisitor.prototype.visitReturn = function(node) { 10349 TypeCheckerVisitor.prototype.visitReturn = function(node) {
10351 var expression = node.expression; 10350 var expression = node.expression;
10352 var isVoidFunction = (this.expectedReturnType === this.types.voidType); 10351 var isVoidFunction = (this.expectedReturnType === this.types.voidType);
10353 if (expression != null) { 10352 if (expression != null) {
10354 var expressionType = this.type(expression); 10353 var expressionType = this.type(expression);
10355 if (isVoidFunction && !$notnull_bool(this.types.isAssignable(expressionType, this.types.voidType))) { 10354 if (isVoidFunction && !$notnull_bool(this.types.isAssignable(expressionType, this.types.voidType))) {
10356 this.reportTypeWarning(expression, const$234/*WarningKind.RETURN_VALUE_IN_ VOID*/, const$13/*const []*/); 10355 this.reportTypeWarning(expression, const$236/*WarningKind.RETURN_VALUE_IN_ VOID*/, const$15/*const []*/);
10357 } 10356 }
10358 else { 10357 else {
10359 this.checkAssignable(expression, expressionType, this.expectedReturnType); 10358 this.checkAssignable(expression, expressionType, this.expectedReturnType);
10360 } 10359 }
10361 } 10360 }
10362 else if (!$notnull_bool(this.types.isAssignable(this.expectedReturnType, this. types.voidType))) { 10361 else if (!$notnull_bool(this.types.isAssignable(this.expectedReturnType, this. types.voidType))) {
10363 this.reportTypeWarning(node, const$238/*WarningKind.RETURN_NOTHING*/, [this. expectedReturnType]); 10362 this.reportTypeWarning(node, const$240/*WarningKind.RETURN_NOTHING*/, [this. expectedReturnType]);
10364 } 10363 }
10365 return null; 10364 return null;
10366 } 10365 }
10367 TypeCheckerVisitor.prototype.visitThrow = function(node) { 10366 TypeCheckerVisitor.prototype.visitThrow = function(node) {
10368 if (node.expression != null) this.type(node.expression); 10367 if (node.expression != null) this.type(node.expression);
10369 return this.types.voidType; 10368 return this.types.voidType;
10370 } 10369 }
10371 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) { 10370 TypeCheckerVisitor.prototype.visitTypeAnnotation = function(node) {
10372 if (node.typeName == null) return this.types.dynamicType; 10371 if (node.typeName == null) return this.types.dynamicType;
10373 var name = node.typeName.get$source(); 10372 var name = node.typeName.get$source();
10374 var type = this.types.lookup(name); 10373 var type = this.types.lookup(name);
10375 if (type == null) this.fail(node, ('unsupported type ' + name + '')); 10374 if (type == null) this.fail(node, ('unsupported type ' + name + ''));
10376 return type; 10375 return type;
10377 } 10376 }
10378 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) { 10377 TypeCheckerVisitor.prototype.visitVariableDefinitions = function(node) {
10379 var $0; 10378 var $0;
10380 var type = this.typeWithDefault(node.type, this.types.dynamicType); 10379 var type = this.typeWithDefault(node.type, this.types.dynamicType);
10381 if ($eq(type, this.types.voidType)) { 10380 if ($eq(type, this.types.voidType)) {
10382 this.reportTypeWarning(node.type, const$241/*WarningKind.VOID_VARIABLE*/, co nst$13/*const []*/); 10381 this.reportTypeWarning(node.type, const$243/*WarningKind.VOID_VARIABLE*/, co nst$15/*const []*/);
10383 type = this.types.dynamicType; 10382 type = this.types.dynamicType;
10384 } 10383 }
10385 for (var link = node.definitions.nodes; 10384 for (var link = node.definitions.nodes;
10386 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) { 10385 !$notnull_bool(link.isEmpty()); link = (($0 = link.get$tail()) && $0.is$Link$ Node())) {
10387 var initialization = (($0 = link.get$head()) && $0.is$Node()); 10386 var initialization = (($0 = link.get$head()) && $0.is$Node());
10388 this.compiler.ensure((initialization instanceof Identifier) || (initializati on instanceof Send)); 10387 this.compiler.ensure((initialization instanceof Identifier) || (initializati on instanceof Send));
10389 if ((initialization instanceof Send)) { 10388 if ((initialization instanceof Send)) {
10390 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node() )); 10389 var initializer = this.nonVoidType((($0 = link.get$head()) && $0.is$Node() ));
10391 this.checkAssignable(node, type, initializer); 10390 this.checkAssignable(node, type, initializer);
10392 } 10391 }
10393 } 10392 }
10394 return null; 10393 return null;
10395 } 10394 }
10396 // ********** Code for Universe ************** 10395 // ********** Code for Universe **************
10397 function Universe() { 10396 function Universe() {
10398 this.elements = $map([]); 10397 this.elements = $map([]);
10399 this.generatedCode = $map([]); 10398 this.generatedCode = $map([]);
10400 this.scope = new Element(const$2, null, null); 10399 this.scope = new Element(const$4, null, null);
10401 // Initializers done 10400 // Initializers done
10402 } 10401 }
10403 Universe.prototype.find = function(name) { 10402 Universe.prototype.find = function(name) {
10404 var $0; 10403 var $0;
10405 return (($0 = this.elements.$index(name)) && $0.is$Element()); 10404 return (($0 = this.elements.$index(name)) && $0.is$Element());
10406 } 10405 }
10407 Universe.prototype.define = function(element) { 10406 Universe.prototype.define = function(element) {
10408 $assert(this.elements.$index(element.name) == null, "elements[element.name] == null", "universe.dart", 20, 12); 10407 $assert(this.elements.$index(element.name) == null, "elements[element.name] == null", "universe.dart", 20, 12);
10409 this.elements.$setindex(element.name, element); 10408 this.elements.$setindex(element.name, element);
10410 } 10409 }
10411 Universe.prototype.addGeneratedCode = function(element, code) { 10410 Universe.prototype.addGeneratedCode = function(element, code) {
10412 this.generatedCode.$setindex(element, code); 10411 this.generatedCode.$setindex(element, code);
10413 } 10412 }
10414 // ********** Code for top level ************** 10413 // ********** Code for top level **************
10415 function unreachable() { 10414 function unreachable() {
10416 $throw(const$267/*const Exception("Internal Error (Leg): UNREACHABLE")*/); 10415 $throw(const$269/*const Exception("Internal Error (Leg): UNREACHABLE")*/);
10417 } 10416 }
10418 function compile(world) { 10417 function compile(world) {
10419 var file = world.readFile(options.dartScript); 10418 var file = world.readFile($globals.options.dartScript);
10420 var script = new leg_Script(file); 10419 var script = new leg_Script(file);
10421 var compiler = new WorldCompiler(world, script); 10420 var compiler = new WorldCompiler(world, script);
10422 return compiler.run(); 10421 return compiler.run();
10423 } 10422 }
10424 // ********** Library lang ************** 10423 // ********** Library lang **************
10425 // ********** Code for CodeWriter ************** 10424 // ********** Code for CodeWriter **************
10426 function CodeWriter() { 10425 function CodeWriter() {
10427 this._indentation = 0 10426 this._indentation = 0
10428 this._pendingIndent = false 10427 this._pendingIndent = false
10429 this.writeComments = true 10428 this.writeComments = true
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
10586 w.writeln("Object.prototype.$typeNameOf = function() {\n if ((typeof(window ) != 'undefined' && window.constructor.name == 'DOMWindow')\n || typeof(pro cess) != 'undefined') { // fast-path for Chrome and Node\n return this.constr uctor.name;\n }\n var str = Object.prototype.toString.call(this);\n return st r.substring(8, str.length - 1);\n}"); 10585 w.writeln("Object.prototype.$typeNameOf = function() {\n if ((typeof(window ) != 'undefined' && window.constructor.name == 'DOMWindow')\n || typeof(pro cess) != 'undefined') { // fast-path for Chrome and Node\n return this.constr uctor.name;\n }\n var str = Object.prototype.toString.call(this);\n return st r.substring(8, str.length - 1);\n}");
10587 } 10586 }
10588 if ($notnull_bool(this.useIndex)) { 10587 if ($notnull_bool(this.useIndex)) {
10589 w.writeln("Object.prototype.$index = function(i) { return this[i]; }\nArray. prototype.$index = function(i) { return this[i]; }\nString.prototype.$index = fu nction(i) { return this[i]; }"); 10588 w.writeln("Object.prototype.$index = function(i) { return this[i]; }\nArray. prototype.$index = function(i) { return this[i]; }\nString.prototype.$index = fu nction(i) { return this[i]; }");
10590 } 10589 }
10591 if ($notnull_bool(this.useSetIndex)) { 10590 if ($notnull_bool(this.useSetIndex)) {
10592 w.writeln("Object.prototype.$setindex = function(i, value) { return this[i] = value; }\nArray.prototype.$setindex = function(i, value) { return this[i] = va lue; }"); 10591 w.writeln("Object.prototype.$setindex = function(i, value) { return this[i] = value; }\nArray.prototype.$setindex = function(i, value) { return this[i] = va lue; }");
10593 } 10592 }
10594 if ($notnull_bool(this.useIsolates)) { 10593 if ($notnull_bool(this.useIsolates)) {
10595 if ($notnull_bool(this.useWrap0)) { 10594 if ($notnull_bool(this.useWrap0)) {
10596 w.writeln("// Wrap a 0-arg dom-callback to bind it with the current isolat e:\nfunction $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }\nFunction.proto type.wrap$call$0 = function() {\n var isolate = $globalState.currentIsolate;\n var self = this;\n this.wrap$0 = function() {\n isolate.eval(self);\n $g lobalState.topEventLoop.run();\n };\n this.wrap$call$0 = function() { return t his.wrap$0; };\n return this.wrap$0;\n}"); 10595 w.writeln("// Wrap a 0-arg dom-callback to bind it with the current isolat e:\nfunction $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }\nFunction.proto type.wrap$call$0 = function() {\n var isolateContext = $globalState.currentCont ext;\n var self = this;\n this.wrap$0 = function() {\n isolateContext.eval( self);\n $globalState.topEventLoop.run();\n };\n this.wrap$call$0 = functio n() { return this.wrap$0; };\n return this.wrap$0;\n}");
10597 } 10596 }
10598 if ($notnull_bool(this.useWrap1)) { 10597 if ($notnull_bool(this.useWrap1)) {
10599 w.writeln("// Wrap a 1-arg dom-callback to bind it with the current isolat e:\nfunction $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }\nFunction.proto type.wrap$call$1 = function() {\n var isolate = $globalState.currentIsolate;\n var self = this;\n this.wrap$1 = function(arg) {\n isolate.eval(function() { self(arg); });\n $globalState.topEventLoop.run();\n };\n this.wrap$call$1 = function() { return this.wrap$1; };\n return this.wrap$1;\n}"); 10598 w.writeln("// Wrap a 1-arg dom-callback to bind it with the current isolat e:\nfunction $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }\nFunction.proto type.wrap$call$1 = function() {\n var isolateContext = $globalState.currentCont ext;\n var self = this;\n this.wrap$1 = function(arg) {\n isolateContext.ev al(function() { self(arg); });\n $globalState.topEventLoop.run();\n };\n th is.wrap$call$1 = function() { return this.wrap$1; };\n return this.wrap$1;\n}") ;
10600 } 10599 }
10601 w.writeln("var $globalThis = this;\nvar $globalState = null;"); 10600 w.writeln("var $globalThis = this;\nvar $globals = null;\nvar $globalState = null;");
10602 } 10601 }
10603 else { 10602 else {
10604 if ($notnull_bool(this.useWrap0)) { 10603 if ($notnull_bool(this.useWrap0)) {
10605 w.writeln("function $wrap_call$0(fn) { return fn; }"); 10604 w.writeln("function $wrap_call$0(fn) { return fn; }");
10606 } 10605 }
10607 if ($notnull_bool(this.useWrap1)) { 10606 if ($notnull_bool(this.useWrap1)) {
10608 w.writeln("function $wrap_call$1(fn) { return fn; }"); 10607 w.writeln("function $wrap_call$1(fn) { return fn; }");
10609 } 10608 }
10610 } 10609 }
10611 var $list = orderValuesByKeys(this._usedOperators); 10610 var $list = orderValuesByKeys(this._usedOperators);
10612 for (var $i = 0;$i < $list.length; $i++) { 10611 for (var $i = 0;$i < $list.length; $i++) {
10613 var opImpl = $list.$index($i); 10612 var opImpl = $list.$index($i);
10614 w.writeln($assert_String(opImpl)); 10613 w.writeln($assert_String(opImpl));
10615 } 10614 }
10616 } 10615 }
10617 CoreJs.prototype.generate$1 = function($0) { 10616 CoreJs.prototype.generate$1 = function($0) {
10618 return this.generate(($0 && $0.is$CodeWriter())); 10617 return this.generate(($0 && $0.is$CodeWriter()));
10619 }; 10618 };
10620 // ********** Code for WorldGenerator ************** 10619 // ********** Code for WorldGenerator **************
10621 function WorldGenerator(main, writer) { 10620 function WorldGenerator(main, writer) {
10621 this.hasStatics = false
10622 this._inheritsGenerated = false 10622 this._inheritsGenerated = false
10623 this.main = main; 10623 this.main = main;
10624 this.writer = writer; 10624 this.writer = writer;
10625 this.globals = $map([]); 10625 this.globals = $map([]);
10626 this.corejs = new CoreJs(); 10626 this.corejs = new CoreJs();
10627 // Initializers done 10627 // Initializers done
10628 } 10628 }
10629 WorldGenerator.prototype.run = function() { 10629 WorldGenerator.prototype.run = function() {
10630 var $0; 10630 var $0;
10631 var metaGen = new MethodGenerator(this.main, null); 10631 var metaGen = new MethodGenerator(this.main, null);
10632 var mainCall = this.main.invoke((metaGen && metaGen.is$MethodGenerator()), nul l, null, Arguments.get$EMPTY(), false); 10632 var mainCall = this.main.invoke((metaGen && metaGen.is$MethodGenerator()), nul l, null, Arguments.get$EMPTY(), false);
10633 this.main.declaringType.markUsed(); 10633 this.main.declaringType.markUsed();
10634 world.corelib.types.$index('BadNumberFormatException').markUsed$0(); 10634 $globals.world.corelib.types.$index('BadNumberFormatException').markUsed$0();
10635 world.get$coreimpl().types.$index('NumImplementation').markUsed$0(); 10635 $globals.world.get$coreimpl().types.$index('NumImplementation').markUsed$0();
10636 world.get$coreimpl().types.$index('StringImplementation').markUsed$0(); 10636 $globals.world.get$coreimpl().types.$index('StringImplementation').markUsed$0( );
10637 this.genMethod((($0 = world.get$coreimpl().types.$index('StringImplementation' ).getMember$1('contains')) && $0.is$Member())); 10637 this.genMethod((($0 = $globals.world.get$coreimpl().types.$index('StringImplem entation').getMember$1('contains')) && $0.is$Member()));
10638 if ($notnull_bool(world.corelib.types.$index('Isolate').get$isUsed()) || $notn ull_bool(world.get$coreimpl().types.$index('ReceivePortImpl').get$isUsed())) { 10638 if ($notnull_bool($globals.world.corelib.types.$index('Isolate').get$isUsed()) || $notnull_bool($globals.world.get$coreimpl().types.$index('ReceivePortImpl'). get$isUsed())) {
10639 this.corejs.useIsolates = true; 10639 this.corejs.useIsolates = true;
10640 var isolateMain = (($0 = world.get$coreimpl().topType.resolveMember('startAs Isolate').members.$index(0)) && $0.is$MethodMember()); 10640 var isolateMain = (($0 = $globals.world.get$coreimpl().topType.resolveMember ('startRootIsolate').members.$index(0)) && $0.is$MethodMember());
10641 mainCall = isolateMain.invoke((metaGen && metaGen.is$MethodGenerator()), nul l, null, new Arguments(null, [this.main._get((metaGen && metaGen.is$MethodGenera tor()), this.main.definition, null, false)]), false); 10641 mainCall = isolateMain.invoke((metaGen && metaGen.is$MethodGenerator()), nul l, null, new Arguments(null, [this.main._get((metaGen && metaGen.is$MethodGenera tor()), this.main.definition, null, false)]), false);
10642 } 10642 }
10643 this.writeTypes(world.get$coreimpl()); 10643 this.writeTypes($globals.world.get$coreimpl());
10644 this.writeTypes(world.corelib); 10644 this.writeTypes($globals.world.corelib);
10645 this.writeTypes(this.main.declaringType.get$library()); 10645 this.writeTypes(this.main.declaringType.get$library());
10646 this._writeGlobals(); 10646 this.writeGlobals();
10647 this.writer.writeln(('' + mainCall.code + ';')); 10647 this.writer.writeln(('' + mainCall.code + ';'));
10648 } 10648 }
10649 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) { 10649 WorldGenerator.prototype.globalForStaticField = function(field, fieldValue, depe ndencies) {
10650 var $0; 10650 var $0;
10651 this.hasStatics = true;
10651 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); 10652 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + "");
10652 if (!this.globals.containsKey(fullname)) { 10653 if (!this.globals.containsKey(fullname)) {
10653 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies)); 10654 this.globals.$setindex(fullname, GlobalValue.GlobalValue$fromStatic$factory( field, fieldValue, dependencies));
10654 } 10655 }
10655 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue()); 10656 return (($0 = this.globals.$index(fullname)) && $0.is$GlobalValue());
10656 } 10657 }
10657 WorldGenerator.prototype.globalForConst = function(exp, dependencies) { 10658 WorldGenerator.prototype.globalForConst = function(exp, dependencies) {
10658 var $0; 10659 var $0;
10659 var code = exp.canonicalCode; 10660 var code = exp.canonicalCode;
10660 if (!this.globals.containsKey(code)) { 10661 if (!this.globals.containsKey(code)) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
10717 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) { 10718 WorldGenerator.prototype._maybeIsTest = function(onType, checkType) {
10718 if (!$notnull_bool(checkType.isTested)) return; 10719 if (!$notnull_bool(checkType.isTested)) return;
10719 var value = 'false'; 10720 var value = 'false';
10720 if ($notnull_bool(onType.isSubtypeOf(checkType))) { 10721 if ($notnull_bool(onType.isSubtypeOf(checkType))) {
10721 value = 'function(){return this;}'; 10722 value = 'function(){return this;}';
10722 } 10723 }
10723 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType. get$jsname() + ' = ') + ('' + value + ';')); 10724 this.writer.writeln(('' + onType.get$jsname() + '.prototype.is\$' + checkType. get$jsname() + ' = ') + ('' + value + ';'));
10724 } 10725 }
10725 WorldGenerator.prototype.writeType = function(type) { 10726 WorldGenerator.prototype.writeType = function(type) {
10726 var $0; 10727 var $0;
10727 if (type.name != null && (type instanceof ConcreteType) && $eq(type.get$librar y(), world.get$coreimpl()) && type.name.startsWith('ListFactory')) { 10728 if (type.name != null && (type instanceof ConcreteType) && $eq(type.get$librar y(), $globals.world.get$coreimpl()) && type.name.startsWith('ListFactory')) {
10728 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType() .get$jsname() + ';')); 10729 this.writer.writeln(('' + type.get$jsname() + ' = ' + type.get$genericType() .get$jsname() + ';'));
10729 return; 10730 return;
10730 } 10731 }
10731 var typeName = type.get$jsname() != null ? type.get$jsname() : 'top level'; 10732 var typeName = type.get$jsname() != null ? type.get$jsname() : 'top level';
10732 this.writer.comment(('// ********** Code for ' + typeName + ' **************') ); 10733 this.writer.comment(('// ********** Code for ' + typeName + ' **************') );
10733 if ($notnull_bool(type.get$isNativeType()) && !$notnull_bool(type.get$isTop()) ) { 10734 if ($notnull_bool(type.get$isNativeType()) && !$notnull_bool(type.get$isTop()) ) {
10734 var nativeName = type.get$definition().get$nativeType(); 10735 var nativeName = type.get$definition().get$nativeType();
10735 if ($notnull_bool($eq(nativeName, ''))) { 10736 if ($notnull_bool($eq(nativeName, ''))) {
10736 this.writer.writeln(('function ' + type.get$jsname() + '() {}')); 10737 this.writer.writeln(('function ' + type.get$jsname() + '() {}'));
10737 } 10738 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
10840 stub.generate$1(this.writer); 10841 stub.generate$1(this.writer);
10841 } 10842 }
10842 } 10843 }
10843 } 10844 }
10844 WorldGenerator.prototype._writeStaticField = function(field) { 10845 WorldGenerator.prototype._writeStaticField = function(field) {
10845 if ($notnull_bool(field.isFinal)) return; 10846 if ($notnull_bool(field.isFinal)) return;
10846 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + ""); 10847 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname () + "");
10847 if (this.globals.containsKey(fullname)) { 10848 if (this.globals.containsKey(fullname)) {
10848 var value = this.globals.$index(fullname); 10849 var value = this.globals.$index(fullname);
10849 if ($notnull_bool(field.declaringType.get$isTop()) && !$notnull_bool(field.i sNative)) { 10850 if ($notnull_bool(field.declaringType.get$isTop()) && !$notnull_bool(field.i sNative)) {
10850 this.writer.writeln(('var ' + field.get$jsname() + ' = ' + value.exp.code + ';')); 10851 this.writer.writeln(('\$globals.' + field.get$jsname() + ' = ' + value.exp .code + ';'));
10851 } 10852 }
10852 else { 10853 else {
10853 this.writer.writeln(('' + field.declaringType.get$jsname() + '.' + field.g et$jsname() + ' = ' + value.exp.code + ';')); 10854 this.writer.writeln(('\$globals.' + field.declaringType.get$jsname() + '_' + field.get$jsname() + '') + (' = ' + value.exp.code + ';'));
10854 } 10855 }
10855 } 10856 }
10856 } 10857 }
10857 WorldGenerator.prototype._writeField = function(field) { 10858 WorldGenerator.prototype._writeField = function(field) {
10858 if ($notnull_bool(field.declaringType.get$isTop()) && !$notnull_bool(field.isN ative) && field.value == null) { 10859 if ($notnull_bool(field.declaringType.get$isTop()) && !$notnull_bool(field.isN ative) && field.value == null) {
10859 this.writer.writeln(('var ' + field.get$jsname() + ';')); 10860 this.writer.writeln(('var ' + field.get$jsname() + ';'));
10860 } 10861 }
10861 if ($notnull_bool(field._providePropertySyntax)) { 10862 if ($notnull_bool(field._providePropertySyntax)) {
10862 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get \$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn ame() + '; };')); 10863 this.writer.writeln(('' + field.declaringType.get$jsname() + '.prototype.get \$' + field.get$jsname() + ' = ') + ('function() { return this.' + field.get$jsn ame() + '; };'));
10863 if (!$notnull_bool(field.isFinal)) { 10864 if (!$notnull_bool(field.isFinal)) {
(...skipping 17 matching lines...) Expand all
10881 } 10882 }
10882 } 10883 }
10883 WorldGenerator.prototype._writeMethod = function(method) { 10884 WorldGenerator.prototype._writeMethod = function(method) {
10884 if (method.generator != null) { 10885 if (method.generator != null) {
10885 method.generator.writeDefinition(this.writer, null); 10886 method.generator.writeDefinition(this.writer, null);
10886 } 10887 }
10887 } 10888 }
10888 WorldGenerator.prototype.get$_writeMethod = function() { 10889 WorldGenerator.prototype.get$_writeMethod = function() {
10889 return WorldGenerator.prototype._writeMethod.bind(this); 10890 return WorldGenerator.prototype._writeMethod.bind(this);
10890 } 10891 }
10891 WorldGenerator.prototype._writeGlobals = function() { 10892 WorldGenerator.prototype.writeGlobals = function() {
10892 if (this.globals.get$length() > 0) { 10893 if (this.globals.get$length() > 0) {
10893 this.writer.comment('// ********** Globals **************'); 10894 this.writer.comment('// ********** Globals **************');
10895 var list = this.globals.getValues();
10896 list.sort$1((function (a, b) {
10897 return a.compareTo$1(b);
10898 })
10899 );
10900 this.writer.enterBlock('function \$static_init(){');
10901 for (var $i = list.iterator$0(); $i.hasNext$0(); ) {
10902 var global = $i.next$0();
10903 if (global.field != null) {
10904 this._writeStaticField(global.field);
10905 }
10906 }
10907 this.writer.exitBlock('}');
10908 for (var $i = list.iterator$0(); $i.hasNext$0(); ) {
10909 var global0 = $i.next$0();
10910 if (global0.field == null) {
10911 this.writer.writeln(('' + global0.get$name() + ' = ' + global0.exp.code + ';'));
10912 }
10913 }
10894 } 10914 }
10895 var list = this.globals.getValues(); 10915 if (!$notnull_bool(this.corejs.useIsolates)) {
10896 list.sort$1((function (a, b) { 10916 if ($notnull_bool(this.hasStatics)) {
10897 return a.compareTo$1(b); 10917 this.writer.writeln('var \$globals = {};');
10898 })
10899 );
10900 for (var $i = list.iterator$0(); $i.hasNext$0(); ) {
10901 var global = $i.next$0();
10902 if (global.field != null) {
10903 this._writeStaticField(global.field);
10904 } 10918 }
10905 else { 10919 if (this.globals.get$length() > 0) {
10906 this.writer.writeln(('var ' + global.get$name() + ' = ' + global.exp.code + ';')); 10920 this.writer.writeln('\$static_init();');
10907 } 10921 }
10908 } 10922 }
10909 } 10923 }
10910 WorldGenerator.prototype._orderValues = function(map) { 10924 WorldGenerator.prototype._orderValues = function(map) {
10911 var $0; 10925 var $0;
10912 var values = (($0 = map.getValues()) && $0.is$List()); 10926 var values = (($0 = map.getValues()) && $0.is$List());
10913 values.sort(this.get$_compareMembers()); 10927 values.sort(this.get$_compareMembers());
10914 return values; 10928 return values;
10915 } 10929 }
10916 WorldGenerator.prototype._compareMembers = function(x, y) { 10930 WorldGenerator.prototype._compareMembers = function(x, y) {
10917 if (x.get$span() != null && y.get$span() != null) { 10931 if (x.get$span() != null && y.get$span() != null) {
10918 var spans = x.get$span().compareTo(y.get$span()); 10932 var spans = x.get$span().compareTo(y.get$span());
10919 if (spans != 0) return spans; 10933 if (spans != 0) return spans;
10920 } 10934 }
10921 if (x.get$span() == null) return 1; 10935 if (x.get$span() == null) return 1;
10922 if (y.get$span() == null) return -1; 10936 if (y.get$span() == null) return -1;
10923 return $assert_num(x.get$name().compareTo$1(y.get$name())); 10937 return $assert_num(x.get$name().compareTo$1(y.get$name()));
10924 } 10938 }
10925 WorldGenerator.prototype.get$_compareMembers = function() { 10939 WorldGenerator.prototype.get$_compareMembers = function() {
10926 return WorldGenerator.prototype._compareMembers.bind(this); 10940 return WorldGenerator.prototype._compareMembers.bind(this);
10927 } 10941 }
10928 WorldGenerator.prototype.useMapFactory = function() { 10942 WorldGenerator.prototype.useMapFactory = function() {
10929 var $0; 10943 var $0;
10930 this.corejs.useMap = true; 10944 this.corejs.useMap = true;
10931 var factType = world.get$coreimpl().types.$index('HashMapImplementation'); 10945 var factType = $globals.world.get$coreimpl().types.$index('HashMapImplementati on');
10932 var m = factType.resolveMember$1('\$setindex'); 10946 var m = factType.resolveMember$1('\$setindex');
10933 this.genMethod((($0 = m.get$members().$index(0)) && $0.is$Member())); 10947 this.genMethod((($0 = m.get$members().$index(0)) && $0.is$Member()));
10934 var c = factType.getConstructor$1(''); 10948 var c = factType.getConstructor$1('');
10935 this.genMethod((c && c.is$Member())); 10949 this.genMethod((c && c.is$Member()));
10936 return (factType && factType.is$lang_Type()); 10950 return (factType && factType.is$lang_Type());
10937 } 10951 }
10938 // ********** Code for BlockScope ************** 10952 // ********** Code for BlockScope **************
10939 function BlockScope(enclosingMethod, parent, reentrant) { 10953 function BlockScope(enclosingMethod, parent, reentrant) {
10940 this.enclosingMethod = enclosingMethod; 10954 this.enclosingMethod = enclosingMethod;
10941 this.parent = parent; 10955 this.parent = parent;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
10982 for (var s = this.parent; 10996 for (var s = this.parent;
10983 $notnull_bool($ne(s, null)); s = s.get$parent()) { 10997 $notnull_bool($ne(s, null)); s = s.get$parent()) {
10984 if (s._vars.containsKey(name)) return true; 10998 if (s._vars.containsKey(name)) return true;
10985 if ($notnull_bool(s.get$isMethodScope()) && s._closedOver.contains(name)) re turn true; 10999 if ($notnull_bool(s.get$isMethodScope()) && s._closedOver.contains(name)) re turn true;
10986 } 11000 }
10987 var type = this.enclosingMethod.method.declaringType; 11001 var type = this.enclosingMethod.method.declaringType;
10988 if (type.get$library().lookup(name, null) != null) return true; 11002 if (type.get$library().lookup(name, null) != null) return true;
10989 return false; 11003 return false;
10990 } 11004 }
10991 BlockScope.prototype.create = function(name, type, span, isFinal, isParameter) { 11005 BlockScope.prototype.create = function(name, type, span, isFinal, isParameter) {
10992 var jsName = world.toJsIdentifier(name); 11006 var jsName = $globals.world.toJsIdentifier(name);
10993 if (this._vars.containsKey(name)) { 11007 if (this._vars.containsKey(name)) {
10994 world.error(('duplicate name "' + name + '"'), span); 11008 $globals.world.error(('duplicate name "' + name + '"'), span);
10995 } 11009 }
10996 if (!$notnull_bool(isParameter)) { 11010 if (!$notnull_bool(isParameter)) {
10997 var index = 0; 11011 var index = 0;
10998 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) { 11012 while ($notnull_bool(this._isDefinedInParent($assert_String(jsName)))) {
10999 jsName = ('' + name + '' + index++ + ''); 11013 jsName = ('' + name + '' + index++ + '');
11000 } 11014 }
11001 } 11015 }
11002 var ret = new Value(type, jsName, span, false); 11016 var ret = new Value(type, jsName, span, false);
11003 ret.isFinal = isFinal; 11017 ret.isFinal = isFinal;
11004 this._vars.$setindex(name, ret); 11018 this._vars.$setindex(name, ret);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
11077 } 11091 }
11078 else { 11092 else {
11079 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, tr ue); 11093 return new Value(v.type, ('(' + tmp.code + ' = ' + v.code + ')'), v.span, tr ue);
11080 } 11094 }
11081 } 11095 }
11082 MethodGenerator.prototype.freeTemp = function(value) { 11096 MethodGenerator.prototype.freeTemp = function(value) {
11083 if (this._usedTemps.remove(value.code)) { 11097 if (this._usedTemps.remove(value.code)) {
11084 this._freeTemps.add(value.code); 11098 this._freeTemps.add(value.code);
11085 } 11099 }
11086 else { 11100 else {
11087 world.internalError(('tried to free unused value or non-temp "' + value.code + '"')); 11101 $globals.world.internalError(('tried to free unused value or non-temp "' + v alue.code + '"'));
11088 } 11102 }
11089 } 11103 }
11090 MethodGenerator.prototype.run = function() { 11104 MethodGenerator.prototype.run = function() {
11091 if ($notnull_bool(this.method.isGenerated)) return; 11105 if ($notnull_bool(this.method.isGenerated)) return;
11092 this.method.isGenerated = true; 11106 this.method.isGenerated = true;
11093 this.method.generator = this; 11107 this.method.generator = this;
11094 if ((this.method.get$definition().body instanceof NativeStatement)) { 11108 if ((this.method.get$definition().body instanceof NativeStatement)) {
11095 if ($notnull_bool(this.method.get$definition().body.body == null)) { 11109 if ($notnull_bool(this.method.get$definition().body.body == null)) {
11096 this.method.generator = null; 11110 this.method.generator = null;
11097 } 11111 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
11155 else if ($notnull_bool(this.method.get$isStatic())) { 11169 else if ($notnull_bool(this.method.get$isStatic())) {
11156 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th is.method.get$jsname() + ' = function' + _params + ' {')); 11170 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.' + th is.method.get$jsname() + ' = function' + _params + ' {'));
11157 } 11171 }
11158 else { 11172 else {
11159 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {')); 11173 defWriter.enterBlock(('' + this.method.declaringType.get$jsname() + '.protot ype.') + ('' + this.method.get$jsname() + ' = function' + _params + ' {'));
11160 } 11174 }
11161 if ($notnull_bool(this.needsThis)) { 11175 if ($notnull_bool(this.needsThis)) {
11162 defWriter.writeln('var \$this = this; // closure support'); 11176 defWriter.writeln('var \$this = this; // closure support');
11163 } 11177 }
11164 if (this._usedTemps.get$length() > 0 || this._freeTemps.length > 0) { 11178 if (this._usedTemps.get$length() > 0 || this._freeTemps.length > 0) {
11165 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 706, 14); 11179 $assert(this._usedTemps.get$length() == 0, "_usedTemps.length == 0", "gen.da rt", 736, 14);
11166 this._freeTemps.addAll(this._usedTemps); 11180 this._freeTemps.addAll(this._usedTemps);
11167 this._freeTemps.sort((function (x, y) { 11181 this._freeTemps.sort((function (x, y) {
11168 return x.compareTo$1(y); 11182 return x.compareTo$1(y);
11169 }) 11183 })
11170 ); 11184 );
11171 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';')); 11185 defWriter.writeln(('var ' + Strings.join(this._freeTemps, ", ") + ';'));
11172 } 11186 }
11173 defWriter.writeln(this.writer.get$text()); 11187 defWriter.writeln(this.writer.get$text());
11174 if ($notnull_bool($ne(names, null))) { 11188 if ($notnull_bool($ne(names, null))) {
11175 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')')); 11189 defWriter.exitBlock(('}).bind(null, ' + Strings.join((names && names.is$List $String()), ", ") + ')'));
11176 } 11190 }
11177 else if ($notnull_bool(this.get$isClosure()) && this.method.name == '') { 11191 else if ($notnull_bool(this.get$isClosure()) && this.method.name == '') {
11178 defWriter.exitBlock('})'); 11192 defWriter.exitBlock('})');
11179 } 11193 }
11180 else { 11194 else {
11181 defWriter.exitBlock('}'); 11195 defWriter.exitBlock('}');
11182 } 11196 }
11183 if ($notnull_bool(this.method.get$isConstructor()) && this.method.get$construc torName() != '') { 11197 if ($notnull_bool(this.method.get$isConstructor()) && this.method.get$construc torName() != '') {
11184 defWriter.writeln(('' + this.method.declaringType.get$jsname() + '.' + this. method.get$constructorName() + '\$ctor.prototype = ') + ('' + this.method.declar ingType.get$jsname() + '.prototype;')); 11198 defWriter.writeln(('' + this.method.declaringType.get$jsname() + '.' + this. method.get$constructorName() + '\$ctor.prototype = ') + ('' + this.method.declar ingType.get$jsname() + '.prototype;'));
11185 } 11199 }
11186 this._provideOptionalParamInfo(defWriter); 11200 this._provideOptionalParamInfo(defWriter);
11187 if ((this.method instanceof MethodMember)) { 11201 if ((this.method instanceof MethodMember)) {
11188 var m = (($0 = this.method) && $0.is$MethodMember()); 11202 var m = (($0 = this.method) && $0.is$MethodMember());
11189 if ($notnull_bool(m._providePropertySyntax)) { 11203 if ($notnull_bool(m._providePropertySyntax)) {
11190 defWriter.enterBlock(('' + m.declaringType.get$jsname() + '.prototype') + ('.get\$' + m.get$jsname() + ' = function() {')); 11204 defWriter.enterBlock(('' + m.declaringType.get$jsname() + '.prototype') + ('.get\$' + m.get$jsname() + ' = function() {'));
11191 defWriter.writeln(('return ' + m.declaringType.get$jsname() + '.prototype. ') + ('' + m.get$jsname() + '.bind(this);')); 11205 defWriter.writeln(('return ' + m.declaringType.get$jsname() + '.prototype. ') + ('' + m.get$jsname() + '.bind(this);'));
11192 defWriter.exitBlock('}'); 11206 defWriter.exitBlock('}');
11193 if ($notnull_bool(m._provideFieldSyntax)) { 11207 if ($notnull_bool(m._provideFieldSyntax)) {
11194 world.internalError('bound m accessed with field syntax'); 11208 $globals.world.internalError('bound m accessed with field syntax');
11195 } 11209 }
11196 } 11210 }
11197 } 11211 }
11198 } 11212 }
11199 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { 11213 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) {
11200 var $0; 11214 var $0;
11201 if ((this.method instanceof MethodMember)) { 11215 if ((this.method instanceof MethodMember)) {
11202 var meth = (($0 = this.method) && $0.is$MethodMember()); 11216 var meth = (($0 = this.method) && $0.is$MethodMember());
11203 if ($notnull_bool(meth._provideOptionalParamInfo)) { 11217 if ($notnull_bool(meth._provideOptionalParamInfo)) {
11204 var optNames = []; 11218 var optNames = [];
(...skipping 23 matching lines...) Expand all
11228 } 11242 }
11229 } 11243 }
11230 } 11244 }
11231 } 11245 }
11232 MethodGenerator.prototype.writeBody = function() { 11246 MethodGenerator.prototype.writeBody = function() {
11233 var initializers = null; 11247 var initializers = null;
11234 var initializedFields = null; 11248 var initializedFields = null;
11235 if ($notnull_bool(this.method.get$isConstructor())) { 11249 if ($notnull_bool(this.method.get$isConstructor())) {
11236 initializers = []; 11250 initializers = [];
11237 initializedFields = new HashSetImplementation(); 11251 initializedFields = new HashSetImplementation();
11238 var $list = world.gen._orderValues(this.method.declaringType.getAllMembers() ); 11252 var $list = $globals.world.gen._orderValues(this.method.declaringType.getAll Members());
11239 for (var $i = 0;$i < $list.length; $i++) { 11253 for (var $i = 0;$i < $list.length; $i++) {
11240 var f = $list.$index($i); 11254 var f = $list.$index($i);
11241 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic())) { 11255 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic())) {
11242 var cv = f.computeValue$0(); 11256 var cv = f.computeValue$0();
11243 if ($notnull_bool($ne(cv, null))) { 11257 if ($notnull_bool($ne(cv, null))) {
11244 initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.code + '')); 11258 initializers.add$1(('this.' + f.get$jsname() + ' = ' + cv.code + ''));
11245 initializedFields.add$1(f.get$name()); 11259 initializedFields.add$1(f.get$name());
11246 } 11260 }
11247 } 11261 }
11248 } 11262 }
11249 } 11263 }
11250 this._paramCode = []; 11264 this._paramCode = [];
11251 var $list = this.method.get$parameters(); 11265 var $list = this.method.get$parameters();
11252 for (var $i = 0;$i < $list.length; $i++) { 11266 for (var $i = 0;$i < $list.length; $i++) {
11253 var p = $list.$index($i); 11267 var p = $list.$index($i);
11254 if ($notnull_bool($ne(initializers, null)) && $notnull_bool(p.isInitializer) ) { 11268 if ($notnull_bool($ne(initializers, null)) && $notnull_bool(p.isInitializer) ) {
11255 var field = this.method.declaringType.getMember($assert_String(p.get$name( ))); 11269 var field = this.method.declaringType.getMember($assert_String(p.get$name( )));
11256 if ($notnull_bool(field == null)) { 11270 if ($notnull_bool(field == null)) {
11257 world.error('bad this parameter - no matching field', p.get$definition() .get$span()); 11271 $globals.world.error('bad this parameter - no matching field', p.get$def inition().get$span());
11258 } 11272 }
11259 if (!$notnull_bool(field.get$isField())) { 11273 if (!$notnull_bool(field.get$isField())) {
11260 world.error(('"this.' + p.get$name() + '" does not refer to a field'), p .get$definition().get$span()); 11274 $globals.world.error(('"this.' + p.get$name() + '" does not refer to a f ield'), p.get$definition().get$span());
11261 } 11275 }
11262 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false); 11276 var paramValue = new Value(field.get$returnType(), p.get$name(), p.get$def inition().get$span(), false);
11263 this._paramCode.add(paramValue.code); 11277 this._paramCode.add(paramValue.code);
11264 initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.code + ';')); 11278 initializers.add$1(('this.' + field.get$jsname() + ' = ' + paramValue.code + ';'));
11265 initializedFields.add$1(p.get$name()); 11279 initializedFields.add$1(p.get$name());
11266 } 11280 }
11267 else { 11281 else {
11268 var paramValue = this._scope.declareParameter((p && p.is$Parameter())); 11282 var paramValue = this._scope.declareParameter((p && p.is$Parameter()));
11269 this._paramCode.add(paramValue.code); 11283 this._paramCode.add(paramValue.code);
11270 } 11284 }
11271 } 11285 }
11272 var body = this.method.get$definition().body; 11286 var body = this.method.get$definition().body;
11273 if ($notnull_bool(body == null) && !$notnull_bool(this.method.get$isConstructo r())) { 11287 if ($notnull_bool(body == null) && !$notnull_bool(this.method.get$isConstructo r())) {
11274 world.error(('unexpected empty body for ' + this.method.name + ''), this.met hod.get$definition().get$span()); 11288 $globals.world.error(('unexpected empty body for ' + this.method.name + ''), this.method.get$definition().get$span());
11275 } 11289 }
11276 var initializerCall = null; 11290 var initializerCall = null;
11277 var declaredInitializers = this.method.get$definition().initializers; 11291 var declaredInitializers = this.method.get$definition().initializers;
11278 if ($notnull_bool($ne(initializers, null))) { 11292 if ($notnull_bool($ne(initializers, null))) {
11279 for (var $i = initializers.iterator$0(); $i.hasNext$0(); ) { 11293 for (var $i = initializers.iterator$0(); $i.hasNext$0(); ) {
11280 var i = $i.next$0(); 11294 var i = $i.next$0();
11281 this.writer.writeln($assert_String(i)); 11295 this.writer.writeln($assert_String(i));
11282 } 11296 }
11283 if (declaredInitializers != null) { 11297 if (declaredInitializers != null) {
11284 for (var $i = 0;$i < declaredInitializers.length; $i++) { 11298 for (var $i = 0;$i < declaredInitializers.length; $i++) {
11285 var init = declaredInitializers.$index($i); 11299 var init = declaredInitializers.$index($i);
11286 if ((init instanceof CallExpression)) { 11300 if ((init instanceof CallExpression)) {
11287 if ($notnull_bool($ne(initializerCall, null))) { 11301 if ($notnull_bool($ne(initializerCall, null))) {
11288 world.error('only one initializer redirecting call is allowed', init .get$span()); 11302 $globals.world.error('only one initializer redirecting call is allow ed', init.get$span());
11289 } 11303 }
11290 initializerCall = init; 11304 initializerCall = init;
11291 } 11305 }
11292 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign( init.op.kind) == 0) { 11306 else if ((init instanceof BinaryExpression) && TokenKind.kindFromAssign( init.op.kind) == 0) {
11293 var left = init.x; 11307 var left = init.x;
11294 if (!((left instanceof DotExpression) && (left.self instanceof ThisExp ression) || (left instanceof VarExpression))) { 11308 if (!((left instanceof DotExpression) && (left.self instanceof ThisExp ression) || (left instanceof VarExpression))) {
11295 world.error('invalid left side of initializer', left.get$span()); 11309 $globals.world.error('invalid left side of initializer', left.get$sp an());
11296 continue; 11310 continue;
11297 } 11311 }
11298 var f = this.method.declaringType.getMember($assert_String(left.get$na me().get$name())); 11312 var f = this.method.declaringType.getMember($assert_String(left.get$na me().get$name()));
11299 if ($notnull_bool(f == null)) { 11313 if ($notnull_bool(f == null)) {
11300 world.error('bad initializer - no matching field', left.get$span()); 11314 $globals.world.error('bad initializer - no matching field', left.get $span());
11301 continue; 11315 continue;
11302 } 11316 }
11303 else if (!$notnull_bool(f.get$isField())) { 11317 else if (!$notnull_bool(f.get$isField())) {
11304 world.error(('"' + left.get$name().get$name() + '" does not refer to a field'), left.get$span()); 11318 $globals.world.error(('"' + left.get$name().get$name() + '" does not refer to a field'), left.get$span());
11305 continue; 11319 continue;
11306 } 11320 }
11307 initializedFields.add$1(f.get$name()); 11321 initializedFields.add$1(f.get$name());
11308 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu e(init.y).code + ';')); 11322 this.writer.writeln(('this.' + f.get$jsname() + ' = ' + this.visitValu e(init.y).code + ';'));
11309 } 11323 }
11310 else { 11324 else {
11311 world.error('invalid initializer', init.get$span()); 11325 $globals.world.error('invalid initializer', init.get$span());
11312 } 11326 }
11313 } 11327 }
11314 } 11328 }
11315 this.writer.comment('// Initializers done'); 11329 this.writer.comment('// Initializers done');
11316 } 11330 }
11317 if ($notnull_bool(this.method.get$isConstructor()) && $notnull_bool(initialize rCall == null)) { 11331 if ($notnull_bool(this.method.get$isConstructor()) && $notnull_bool(initialize rCall == null)) {
11318 var parentType = this.method.declaringType.get$parent(); 11332 var parentType = this.method.declaringType.get$parent();
11319 if ($notnull_bool($ne(parentType, null)) && !$notnull_bool(parentType.get$is Object())) { 11333 if ($notnull_bool($ne(parentType, null)) && !$notnull_bool(parentType.get$is Object())) {
11320 initializerCall = new CallExpression(new SuperExpression(this.method.get$s pan()), [], this.method.get$span()); 11334 initializerCall = new CallExpression(new SuperExpression(this.method.get$s pan()), [], this.method.get$span());
11321 } 11335 }
11322 } 11336 }
11323 if ($notnull_bool($ne(initializerCall, null))) { 11337 if ($notnull_bool($ne(initializerCall, null))) {
11324 var target = this._writeInitializerCall((initializerCall && initializerCall. is$CallExpression())); 11338 var target = this._writeInitializerCall((initializerCall && initializerCall. is$CallExpression()));
11325 if (!$notnull_bool(target.isSuper)) { 11339 if (!$notnull_bool(target.isSuper)) {
11326 if (initializers.length > 0) { 11340 if (initializers.length > 0) {
11327 var $list = this.method.get$parameters(); 11341 var $list = this.method.get$parameters();
11328 for (var $i = 0;$i < $list.length; $i++) { 11342 for (var $i = 0;$i < $list.length; $i++) {
11329 var p = $list.$index($i); 11343 var p = $list.$index($i);
11330 if ($notnull_bool(p.isInitializer)) { 11344 if ($notnull_bool(p.isInitializer)) {
11331 world.error('no initialization allowed on redirecting constructors', p.get$definition().get$span()); 11345 $globals.world.error('no initialization allowed on redirecting const ructors', p.get$definition().get$span());
11332 break; 11346 break;
11333 } 11347 }
11334 } 11348 }
11335 } 11349 }
11336 if (declaredInitializers != null && declaredInitializers.length > 1) { 11350 if (declaredInitializers != null && declaredInitializers.length > 1) {
11337 var init = $notnull_bool($eq(declaredInitializers.$index(0), initializer Call)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0); 11351 var init = $notnull_bool($eq(declaredInitializers.$index(0), initializer Call)) ? declaredInitializers.$index(1) : declaredInitializers.$index(0);
11338 world.error('no initialization allowed on redirecting constructors', ini t.get$span()); 11352 $globals.world.error('no initialization allowed on redirecting construct ors', init.get$span());
11339 } 11353 }
11340 initializedFields = null; 11354 initializedFields = null;
11341 } 11355 }
11342 } 11356 }
11343 if ($notnull_bool($ne(initializedFields, null))) { 11357 if ($notnull_bool($ne(initializedFields, null))) {
11344 var $list = this.method.declaringType.get$members().getKeys(); 11358 var $list = this.method.declaringType.get$members().getKeys();
11345 for (var $i = this.method.declaringType.get$members().getKeys().iterator$0() ; $i.hasNext$0(); ) { 11359 for (var $i = this.method.declaringType.get$members().getKeys().iterator$0() ; $i.hasNext$0(); ) {
11346 var name = $i.next$0(); 11360 var name = $i.next$0();
11347 var member = this.method.declaringType.get$members().$index(name); 11361 var member = this.method.declaringType.get$members().$index(name);
11348 if ((member instanceof FieldMember) && $notnull_bool(member.get$isFinal()) && !$notnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.co ntains$1(name))) { 11362 if ((member instanceof FieldMember) && $notnull_bool(member.get$isFinal()) && !$notnull_bool(member.get$isStatic()) && !$notnull_bool(initializedFields.co ntains$1(name))) {
11349 world.error(('Field "' + name + '" is final and was not initialized'), t his.method.get$definition().get$span()); 11363 $globals.world.error(('Field "' + name + '" is final and was not initial ized'), this.method.get$definition().get$span());
11350 } 11364 }
11351 } 11365 }
11352 } 11366 }
11353 this.visitStatementsInBlock((body && body.is$lang_Statement())); 11367 this.visitStatementsInBlock((body && body.is$lang_Statement()));
11354 } 11368 }
11355 MethodGenerator.prototype._writeInitializerCall = function(node) { 11369 MethodGenerator.prototype._writeInitializerCall = function(node) {
11356 var contructorName = ''; 11370 var contructorName = '';
11357 var targetExp = node.target; 11371 var targetExp = node.target;
11358 if ((targetExp instanceof DotExpression)) { 11372 if ((targetExp instanceof DotExpression)) {
11359 var dot = (targetExp && targetExp.is$DotExpression()); 11373 var dot = (targetExp && targetExp.is$DotExpression());
11360 targetExp = dot.self; 11374 targetExp = dot.self;
11361 contructorName = dot.name.name; 11375 contructorName = dot.name.name;
11362 } 11376 }
11363 var target = null; 11377 var target = null;
11364 if ((targetExp instanceof SuperExpression)) { 11378 if ((targetExp instanceof SuperExpression)) {
11365 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node())); 11379 target = this._makeSuperValue((targetExp && targetExp.is$lang_Node()));
11366 } 11380 }
11367 else if ((targetExp instanceof ThisExpression)) { 11381 else if ((targetExp instanceof ThisExpression)) {
11368 target = this._makeThisValue((targetExp && targetExp.is$lang_Node())); 11382 target = this._makeThisValue((targetExp && targetExp.is$lang_Node()));
11369 } 11383 }
11370 else { 11384 else {
11371 world.error('bad call in initializers', node.span); 11385 $globals.world.error('bad call in initializers', node.span);
11372 } 11386 }
11373 var m = target.type.getConstructor$1(contructorName); 11387 var m = target.type.getConstructor$1(contructorName);
11374 this.method.set$initDelegate(m); 11388 this.method.set$initDelegate(m);
11375 var other = m; 11389 var other = m;
11376 while ($notnull_bool($ne(other, null))) { 11390 while ($notnull_bool($ne(other, null))) {
11377 if ($notnull_bool($eq(other, this.method))) { 11391 if ($notnull_bool($eq(other, this.method))) {
11378 world.error('initialization cycle', node.span); 11392 $globals.world.error('initialization cycle', node.span);
11379 break; 11393 break;
11380 } 11394 }
11381 other = other.get$initDelegate(); 11395 other = other.get$initDelegate();
11382 } 11396 }
11383 world.gen.genMethod((m && m.is$Member())); 11397 $globals.world.gen.genMethod((m && m.is$Member()));
11384 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments)); 11398 var value = m.invoke$4(this, node, target, this._makeArgs(node.arguments));
11385 if ($notnull_bool($ne(target.type, world.objectType))) { 11399 if ($notnull_bool($ne(target.type, $globals.world.objectType))) {
11386 this.writer.writeln(('' + value.code + ';')); 11400 this.writer.writeln(('' + value.code + ';'));
11387 } 11401 }
11388 return (target && target.is$Value()); 11402 return (target && target.is$Value());
11389 } 11403 }
11390 MethodGenerator.prototype._makeArgs = function(arguments) { 11404 MethodGenerator.prototype._makeArgs = function(arguments) {
11391 var $0; 11405 var $0;
11392 var args = []; 11406 var args = [];
11393 var seenLabel = false; 11407 var seenLabel = false;
11394 for (var $i = 0;$i < arguments.length; $i++) { 11408 for (var $i = 0;$i < arguments.length; $i++) {
11395 var arg = arguments.$index($i); 11409 var arg = arguments.$index($i);
11396 if (arg.label != null) { 11410 if (arg.label != null) {
11397 seenLabel = true; 11411 seenLabel = true;
11398 } 11412 }
11399 else if ($notnull_bool(seenLabel)) { 11413 else if ($notnull_bool(seenLabel)) {
11400 world.error('bare argument can not follow named arguments', arg.get$span() ); 11414 $globals.world.error('bare argument can not follow named arguments', arg.g et$span());
11401 } 11415 }
11402 args.add$1(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression( )))); 11416 args.add$1(this.visitValue((($0 = arg.get$value()) && $0.is$lang_Expression( ))));
11403 } 11417 }
11404 return new Arguments(arguments, args); 11418 return new Arguments(arguments, args);
11405 } 11419 }
11406 MethodGenerator._escapeString = function(text) { 11420 MethodGenerator._escapeString = function(text) {
11407 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', ' \\n').replaceAll('\r', '\\r'); 11421 return text.replaceAll('\\', '\\\\').replaceAll('"', '\\"').replaceAll('\n', ' \\n').replaceAll('\r', '\\r');
11408 } 11422 }
11409 MethodGenerator.prototype.visitStatementsInBlock = function(body) { 11423 MethodGenerator.prototype.visitStatementsInBlock = function(body) {
11410 if ((body instanceof BlockStatement)) { 11424 if ((body instanceof BlockStatement)) {
(...skipping 12 matching lines...) Expand all
11423 MethodGenerator.prototype._pushBlock = function(reentrant) { 11437 MethodGenerator.prototype._pushBlock = function(reentrant) {
11424 this._scope = new BlockScope(this, this._scope, reentrant); 11438 this._scope = new BlockScope(this, this._scope, reentrant);
11425 } 11439 }
11426 MethodGenerator.prototype._popBlock = function() { 11440 MethodGenerator.prototype._popBlock = function() {
11427 this._scope = this._scope.parent; 11441 this._scope = this._scope.parent;
11428 } 11442 }
11429 MethodGenerator.prototype._makeLambdaMethod = function(name, func) { 11443 MethodGenerator.prototype._makeLambdaMethod = function(name, func) {
11430 var meth = new MethodMember(name, this.method.declaringType, func); 11444 var meth = new MethodMember(name, this.method.declaringType, func);
11431 meth.isLambda = true; 11445 meth.isLambda = true;
11432 meth.resolve$1(this.method.declaringType); 11446 meth.resolve$1(this.method.declaringType);
11433 world.gen.genMethod((meth && meth.is$Member()), this); 11447 $globals.world.gen.genMethod((meth && meth.is$Member()), this);
11434 return (meth && meth.is$MethodMember()); 11448 return (meth && meth.is$MethodMember());
11435 } 11449 }
11436 MethodGenerator.prototype.visitBool = function(node) { 11450 MethodGenerator.prototype.visitBool = function(node) {
11437 return this.visitValue(node).convertTo$3(this, world.nonNullBool, node); 11451 return this.visitValue(node).convertTo$3(this, $globals.world.nonNullBool, nod e);
11438 } 11452 }
11439 MethodGenerator.prototype.visitValue = function(node) { 11453 MethodGenerator.prototype.visitValue = function(node) {
11440 if (node == null) return null; 11454 if (node == null) return null;
11441 var value = node.visit(this); 11455 var value = node.visit(this);
11442 value.checkFirstClass$1(node.span); 11456 value.checkFirstClass$1(node.span);
11443 return value; 11457 return value;
11444 } 11458 }
11445 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) { 11459 MethodGenerator.prototype.visitTypedValue = function(node, expectedType) {
11446 return this.visitValue(node).convertTo$3(this, expectedType, node); 11460 return this.visitValue(node).convertTo$3(this, expectedType, node);
11447 } 11461 }
(...skipping 21 matching lines...) Expand all
11469 for (var i = 0; 11483 for (var i = 0;
11470 i < node.names.length; i++) { 11484 i < node.names.length; i++) {
11471 var thisType = type; 11485 var thisType = type;
11472 if (i > 0) { 11486 if (i > 0) {
11473 this.writer.write(', '); 11487 this.writer.write(', ');
11474 } 11488 }
11475 var name = node.names.$index(i).get$name(); 11489 var name = node.names.$index(i).get$name();
11476 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession())); 11490 var value = this.visitValue((($0 = node.values.$index(i)) && $0.is$lang_Expr ession()));
11477 if ($notnull_bool(isFinal)) { 11491 if ($notnull_bool(isFinal)) {
11478 if ($notnull_bool(value == null)) { 11492 if ($notnull_bool(value == null)) {
11479 world.error('no value specified for final variable', node.span); 11493 $globals.world.error('no value specified for final variable', node.span) ;
11480 } 11494 }
11481 else { 11495 else {
11482 if ($notnull_bool(thisType.get$isVar())) thisType = value.type; 11496 if ($notnull_bool(thisType.get$isVar())) thisType = value.type;
11483 } 11497 }
11484 } 11498 }
11485 var val = this._scope.create($assert_String(name), (thisType && thisType.is$ lang_Type()), node.names.$index(i).get$span(), $assert_bool(isFinal), false); 11499 var val = this._scope.create($assert_String(name), (thisType && thisType.is$ lang_Type()), node.names.$index(i).get$span(), $assert_bool(isFinal), false);
11486 if ($notnull_bool(value == null)) { 11500 if ($notnull_bool(value == null)) {
11487 if ($notnull_bool(this._scope.reentrant)) { 11501 if ($notnull_bool(this._scope.reentrant)) {
11488 this.writer.write(('' + val.code + ' = null')); 11502 this.writer.write(('' + val.code + ' = null'));
11489 } 11503 }
11490 else { 11504 else {
11491 this.writer.write(('' + val.code + '')); 11505 this.writer.write(('' + val.code + ''));
11492 } 11506 }
11493 } 11507 }
11494 else { 11508 else {
11495 value = value.convertTo$3(this, type, node.values.$index(i)); 11509 value = value.convertTo$3(this, type, node.values.$index(i));
11496 this.writer.write(('' + val.code + ' = ' + value.code + '')); 11510 this.writer.write(('' + val.code + ' = ' + value.code + ''));
11497 } 11511 }
11498 } 11512 }
11499 this.writer.writeln(';'); 11513 this.writer.writeln(';');
11500 return false; 11514 return false;
11501 } 11515 }
11502 MethodGenerator.prototype.visitFunctionDefinition = function(node) { 11516 MethodGenerator.prototype.visitFunctionDefinition = function(node) {
11503 var $0; 11517 var $0;
11504 var name = world.toJsIdentifier(node.name.name); 11518 var name = $globals.world.toJsIdentifier(node.name.name);
11505 var meth = this._makeLambdaMethod($assert_String(name), node); 11519 var meth = this._makeLambdaMethod($assert_String(name), node);
11506 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct ionType()) && $0.is$lang_Type()), this.method.get$definition().get$span(), true, false); 11520 var funcValue = this._scope.create($assert_String(name), (($0 = meth.get$funct ionType()) && $0.is$lang_Type()), this.method.get$definition().get$span(), true, false);
11507 meth.generator.writeDefinition$2(this.writer); 11521 meth.generator.writeDefinition$2(this.writer);
11508 return false; 11522 return false;
11509 } 11523 }
11510 MethodGenerator.prototype.visitReturnStatement = function(node) { 11524 MethodGenerator.prototype.visitReturnStatement = function(node) {
11511 if (node.value == null) { 11525 if (node.value == null) {
11512 this.writer.writeln('return;'); 11526 this.writer.writeln('return;');
11513 } 11527 }
11514 else { 11528 else {
11515 if ($notnull_bool(this.method.get$isConstructor())) { 11529 if ($notnull_bool(this.method.get$isConstructor())) {
11516 world.error('return of value not allowed from constructor', node.span); 11530 $globals.world.error('return of value not allowed from constructor', node. span);
11517 } 11531 }
11518 var value = this.visitTypedValue(node.value, this.method.get$returnType()); 11532 var value = this.visitTypedValue(node.value, this.method.get$returnType());
11519 this.writer.writeln(('return ' + value.code + ';')); 11533 this.writer.writeln(('return ' + value.code + ';'));
11520 } 11534 }
11521 return true; 11535 return true;
11522 } 11536 }
11523 MethodGenerator.prototype.visitThrowStatement = function(node) { 11537 MethodGenerator.prototype.visitThrowStatement = function(node) {
11524 if (node.value != null) { 11538 if (node.value != null) {
11525 var value = this.visitValue(node.value); 11539 var value = this.visitValue(node.value);
11526 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY()); 11540 value.invoke$4(this, 'toString', node, Arguments.get$EMPTY());
11527 this.writer.writeln(('\$throw(' + value.code + ');')); 11541 this.writer.writeln(('\$throw(' + value.code + ');'));
11528 world.gen.corejs.useThrow = true; 11542 $globals.world.gen.corejs.useThrow = true;
11529 } 11543 }
11530 else { 11544 else {
11531 var rethrow = this._scope.getRethrow(); 11545 var rethrow = this._scope.getRethrow();
11532 if ($notnull_bool(rethrow == null)) { 11546 if ($notnull_bool(rethrow == null)) {
11533 world.error('rethrow outside of catch', node.span); 11547 $globals.world.error('rethrow outside of catch', node.span);
11534 } 11548 }
11535 else { 11549 else {
11536 this.writer.writeln(('throw ' + rethrow.code + ';')); 11550 this.writer.writeln(('throw ' + rethrow.code + ';'));
11537 } 11551 }
11538 } 11552 }
11539 return true; 11553 return true;
11540 } 11554 }
11541 MethodGenerator.prototype.visitAssertStatement = function(node) { 11555 MethodGenerator.prototype.visitAssertStatement = function(node) {
11542 var $0; 11556 var $0;
11543 var test = this.visitValue(node.test); 11557 var test = this.visitValue(node.test);
11544 if ($notnull_bool(options.enableAsserts)) { 11558 if ($notnull_bool($globals.options.enableAsserts)) {
11545 var err = world.corelib.types.$index('AssertError'); 11559 var err = $globals.world.corelib.types.$index('AssertError');
11546 world.gen.genMethod((($0 = err.getConstructor$1('')) && $0.is$Member())); 11560 $globals.world.gen.genMethod((($0 = err.getConstructor$1('')) && $0.is$Membe r()));
11547 world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Me mber())); 11561 $globals.world.gen.genMethod((($0 = err.get$members().$index('toString')) && $0.is$Member()));
11548 var span = node.test.span; 11562 var span = node.test.span;
11549 var line = span.file.getLine(span.start); 11563 var line = span.file.getLine(span.start);
11550 var column = span.file.getColumn($assert_num(line), span.start); 11564 var column = span.file.getColumn($assert_num(line), span.start);
11551 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca peString(span.get$text()) + '",') + (' "' + basename(span.file.filename) + '", ' + (line + 1) + ', ' + (column + 1) + ');')); 11565 this.writer.writeln(('\$assert(' + test.code + ', "' + MethodGenerator._esca peString(span.get$text()) + '",') + (' "' + basename(span.file.filename) + '", ' + (line + 1) + ', ' + (column + 1) + ');'));
11552 world.gen.corejs.useAssert = true; 11566 $globals.world.gen.corejs.useAssert = true;
11553 } 11567 }
11554 return false; 11568 return false;
11555 } 11569 }
11556 MethodGenerator.prototype.visitBreakStatement = function(node) { 11570 MethodGenerator.prototype.visitBreakStatement = function(node) {
11557 if (node.label == null) { 11571 if (node.label == null) {
11558 this.writer.writeln('break;'); 11572 this.writer.writeln('break;');
11559 } 11573 }
11560 else { 11574 else {
11561 this.writer.writeln(('break ' + node.label.name + ';')); 11575 this.writer.writeln(('break ' + node.label.name + ';'));
11562 } 11576 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
11641 var list = node.list.visit(this); 11655 var list = node.list.visit(this);
11642 this._pushBlock(true); 11656 this._pushBlock(true);
11643 var isFinal = this._isFinal(node.item.type); 11657 var isFinal = this._isFinal(node.item.type);
11644 var item = this._scope.create($assert_String(itemName), (itemType && itemType. is$lang_Type()), node.item.name.span, isFinal, false); 11658 var item = this._scope.create($assert_String(itemName), (itemType && itemType. is$lang_Type()), node.item.name.span, isFinal, false);
11645 var listVar = (list && list.is$Value()); 11659 var listVar = (list && list.is$Value());
11646 if ($notnull_bool(list.needsTemp)) { 11660 if ($notnull_bool(list.needsTemp)) {
11647 listVar = this._scope.create('\$list', (($0 = list.type) && $0.is$lang_Type( )), null, false, false); 11661 listVar = this._scope.create('\$list', (($0 = list.type) && $0.is$lang_Type( )), null, false, false);
11648 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';')); 11662 this.writer.writeln(('var ' + listVar.code + ' = ' + list.code + ';'));
11649 } 11663 }
11650 if ($notnull_bool(list.type.get$isList())) { 11664 if ($notnull_bool(list.type.get$isList())) {
11651 var tmpi = this._scope.create('\$i', world.numType, null, false, false); 11665 var tmpi = this._scope.create('\$i', $globals.world.numType, null, false, fa lse);
11652 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code + ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {')); 11666 this.writer.enterBlock(('for (var ' + tmpi.code + ' = 0;') + ('' + tmpi.code + ' < ' + listVar.code + '.length; ' + tmpi.code + '++) {'));
11653 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), false); 11667 var value = listVar.invoke(this, '\$index', node.list, new Arguments(null, [ tmpi]), false);
11654 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';')); 11668 this.writer.writeln(('var ' + item.code + ' = ' + value.code + ';'));
11655 } 11669 }
11656 else { 11670 else {
11657 this._pushBlock(false); 11671 this._pushBlock(false);
11658 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y()); 11672 var iterator = list.invoke$4(this, 'iterator', node.list, Arguments.get$EMPT Y());
11659 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ e()), null, false, false); 11673 var tmpi = this._scope.create('\$i', (($0 = iterator.type) && $0.is$lang_Typ e()), null, false, false);
11660 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY( )); 11674 var hasNext = tmpi.invoke$4(this, 'hasNext', node.list, Arguments.get$EMPTY( ));
11661 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY()); 11675 var next = tmpi.invoke$4(this, 'next', node.list, Arguments.get$EMPTY());
11662 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + '; ' + hasNext.code + '; ) {')); 11676 this.writer.enterBlock(('for (var ' + tmpi.code + ' = ' + iterator.code + '; ' + hasNext.code + '; ) {'));
11663 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';')); 11677 this.writer.writeln(('var ' + item.code + ' = ' + next.code + ';'));
11664 } 11678 }
11665 this.visitStatementsInBlock(node.body); 11679 this.visitStatementsInBlock(node.body);
11666 this.writer.exitBlock('}'); 11680 this.writer.exitBlock('}');
11667 this._popBlock(); 11681 this._popBlock();
11668 return false; 11682 return false;
11669 } 11683 }
11670 MethodGenerator.prototype._genToDartException = function(ex, node) { 11684 MethodGenerator.prototype._genToDartException = function(ex, node) {
11671 var types = const$380/*const [ 11685 var types = const$382/*const [
11672 'NullPointerException', 'ObjectNotClosureException', 11686 'NullPointerException', 'ObjectNotClosureException',
11673 'NoSuchMethodException', 'StackOverflowException']*/; 11687 'NoSuchMethodException', 'StackOverflowException']*/;
11674 var target = new Value(world.varType, 'this', node.span, true); 11688 var target = new Value($globals.world.varType, 'this', node.span, true);
11675 for (var $i = types.iterator$0(); $i.hasNext$0(); ) { 11689 for (var $i = types.iterator$0(); $i.hasNext$0(); ) {
11676 var name = $i.next$0(); 11690 var name = $i.next$0();
11677 world.corelib.types.$index(name).markUsed$0(); 11691 $globals.world.corelib.types.$index(name).markUsed$0();
11678 world.corelib.types.$index(name).get$members().$index('toString').invoke$4(t his, node, target, Arguments.get$EMPTY()); 11692 $globals.world.corelib.types.$index(name).get$members().$index('toString').i nvoke$4(this, node, target, Arguments.get$EMPTY());
11679 } 11693 }
11680 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');')); 11694 this.writer.writeln(('' + ex + ' = \$toDartException(' + ex + ');'));
11681 world.gen.corejs.useToDartException = true; 11695 $globals.world.gen.corejs.useToDartException = true;
11682 } 11696 }
11683 MethodGenerator.prototype.visitTryStatement = function(node) { 11697 MethodGenerator.prototype.visitTryStatement = function(node) {
11684 var $0; 11698 var $0;
11685 this.writer.enterBlock('try {'); 11699 this.writer.enterBlock('try {');
11686 this._pushBlock(false); 11700 this._pushBlock(false);
11687 this.visitStatementsInBlock(node.body); 11701 this.visitStatementsInBlock(node.body);
11688 this._popBlock(); 11702 this._popBlock();
11689 if (node.catches.length == 1) { 11703 if (node.catches.length == 1) {
11690 var catch_ = node.catches.$index(0); 11704 var catch_ = node.catches.$index(0);
11691 this._pushBlock(false); 11705 this._pushBlock(false);
11692 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier())); 11706 var ex = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Declare dIdentifier()));
11693 this._scope.rethrow = (ex && ex.is$Value()); 11707 this._scope.rethrow = (ex && ex.is$Value());
11694 this.writer.nextBlock(('} catch (' + ex.code + ') {')); 11708 this.writer.nextBlock(('} catch (' + ex.code + ') {'));
11695 if (catch_.trace != null) { 11709 if (catch_.trace != null) {
11696 var trace = this._scope.declare(catch_.trace); 11710 var trace = this._scope.declare(catch_.trace);
11697 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); 11711 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');'));
11698 world.gen.corejs.useStackTraceOf = true; 11712 $globals.world.gen.corejs.useStackTraceOf = true;
11699 } 11713 }
11700 this._genToDartException($assert_String(ex.code), node); 11714 this._genToDartException($assert_String(ex.code), node);
11701 if (!$notnull_bool(ex.type.get$isVarOrObject())) { 11715 if (!$notnull_bool(ex.type.get$isVarOrObject())) {
11702 var test = ex.instanceOf$3$isTrue$forceCheck(this, ex.type, catch_.get$exc eption().get$span(), false, true); 11716 var test = ex.instanceOf$3$isTrue$forceCheck(this, ex.type, catch_.get$exc eption().get$span(), false, true);
11703 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';')); 11717 this.writer.writeln(('if (' + test.code + ') throw ' + ex.code + ';'));
11704 } 11718 }
11705 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan g_Statement())); 11719 this.visitStatementsInBlock((($0 = node.catches.$index(0).body) && $0.is$lan g_Statement()));
11706 this._popBlock(); 11720 this._popBlock();
11707 } 11721 }
11708 else if (node.catches.length > 0) { 11722 else if (node.catches.length > 0) {
11709 this._pushBlock(false); 11723 this._pushBlock(false);
11710 var ex = this._scope.create('\$ex', world.varType, null, false, false); 11724 var ex = this._scope.create('\$ex', $globals.world.varType, null, false, fal se);
11711 this._scope.rethrow = (ex && ex.is$Value()); 11725 this._scope.rethrow = (ex && ex.is$Value());
11712 this.writer.nextBlock(('} catch (' + ex.code + ') {')); 11726 this.writer.nextBlock(('} catch (' + ex.code + ') {'));
11713 var trace = null; 11727 var trace = null;
11714 if (node.catches.some((function (c) { 11728 if (node.catches.some((function (c) {
11715 return c.trace != null; 11729 return c.trace != null;
11716 }) 11730 })
11717 )) { 11731 )) {
11718 trace = this._scope.create('\$trace', world.varType, null, false, false); 11732 trace = this._scope.create('\$trace', $globals.world.varType, null, false, false);
11719 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');')); 11733 this.writer.writeln(('var ' + trace.code + ' = \$stackTraceOf(' + ex.code + ');'));
11720 world.gen.corejs.useStackTraceOf = true; 11734 $globals.world.gen.corejs.useStackTraceOf = true;
11721 } 11735 }
11722 this._genToDartException($assert_String(ex.code), node); 11736 this._genToDartException($assert_String(ex.code), node);
11723 var needsRethrow = true; 11737 var needsRethrow = true;
11724 for (var i = 0; 11738 for (var i = 0;
11725 i < node.catches.length; i++) { 11739 i < node.catches.length; i++) {
11726 var catch_ = node.catches.$index(i); 11740 var catch_ = node.catches.$index(i);
11727 this._pushBlock(false); 11741 this._pushBlock(false);
11728 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier())); 11742 var tmp = this._scope.declare((($0 = catch_.get$exception()) && $0.is$Decl aredIdentifier()));
11729 if (!$notnull_bool(tmp.type.get$isVarOrObject())) { 11743 if (!$notnull_bool(tmp.type.get$isVarOrObject())) {
11730 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.type, catch_.get$ exception().get$span(), true, true); 11744 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmp.type, catch_.get$ exception().get$span(), true, true);
11731 if (i == 0) { 11745 if (i == 0) {
11732 this.writer.enterBlock(('if (' + test.code + ') {')); 11746 this.writer.enterBlock(('if (' + test.code + ') {'));
11733 } 11747 }
11734 else { 11748 else {
11735 this.writer.nextBlock(('} else if (' + test.code + ') {')); 11749 this.writer.nextBlock(('} else if (' + test.code + ') {'));
11736 } 11750 }
11737 } 11751 }
11738 else if (i > 0) { 11752 else if (i > 0) {
11739 this.writer.nextBlock('} else {'); 11753 this.writer.nextBlock('} else {');
11740 } 11754 }
11741 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';')); 11755 this.writer.writeln(('var ' + tmp.code + ' = ' + ex.code + ';'));
11742 if (catch_.trace != null) { 11756 if (catch_.trace != null) {
11743 var tmptrace = this._scope.declare(catch_.trace); 11757 var tmptrace = this._scope.declare(catch_.trace);
11744 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';')) ; 11758 this.writer.writeln(('var ' + tmptrace.code + ' = ' + trace.code + ';')) ;
11745 } 11759 }
11746 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement()) ); 11760 this.visitStatementsInBlock((($0 = catch_.body) && $0.is$lang_Statement()) );
11747 this._popBlock(); 11761 this._popBlock();
11748 if ($notnull_bool(tmp.type.get$isVarOrObject())) { 11762 if ($notnull_bool(tmp.type.get$isVarOrObject())) {
11749 if (i + 1 < node.catches.length) { 11763 if (i + 1 < node.catches.length) {
11750 world.warning('Unreachable catch clause', (($0 = node.catches.$index(i + 1)) && $0.is$SourceSpan())); 11764 $globals.world.warning('Unreachable catch clause', (($0 = node.catches .$index(i + 1)) && $0.is$SourceSpan()));
11751 } 11765 }
11752 if (i > 0) { 11766 if (i > 0) {
11753 this.writer.exitBlock('}'); 11767 this.writer.exitBlock('}');
11754 } 11768 }
11755 needsRethrow = false; 11769 needsRethrow = false;
11756 break; 11770 break;
11757 } 11771 }
11758 } 11772 }
11759 if ($notnull_bool(needsRethrow)) { 11773 if ($notnull_bool(needsRethrow)) {
11760 this.writer.nextBlock('} else {'); 11774 this.writer.nextBlock('} else {');
(...skipping 11 matching lines...) Expand all
11772 this.writer.exitBlock('}'); 11786 this.writer.exitBlock('}');
11773 return false; 11787 return false;
11774 } 11788 }
11775 MethodGenerator.prototype.visitSwitchStatement = function(node) { 11789 MethodGenerator.prototype.visitSwitchStatement = function(node) {
11776 var test = this.visitValue(node.test); 11790 var test = this.visitValue(node.test);
11777 this.writer.enterBlock(('switch (' + test.code + ') {')); 11791 this.writer.enterBlock(('switch (' + test.code + ') {'));
11778 var $list = node.cases; 11792 var $list = node.cases;
11779 for (var $i = 0;$i < $list.length; $i++) { 11793 for (var $i = 0;$i < $list.length; $i++) {
11780 var case_ = $list.$index($i); 11794 var case_ = $list.$index($i);
11781 if (case_.label != null) { 11795 if (case_.label != null) {
11782 world.error('unimplemented: labeled case statement', case_.get$span()); 11796 $globals.world.error('unimplemented: labeled case statement', case_.get$sp an());
11783 } 11797 }
11784 this._pushBlock(false); 11798 this._pushBlock(false);
11785 for (var i = 0; 11799 for (var i = 0;
11786 i < case_.cases.length; i++) { 11800 i < case_.cases.length; i++) {
11787 var expr = case_.cases.$index(i); 11801 var expr = case_.cases.$index(i);
11788 if ($notnull_bool(expr == null)) { 11802 if ($notnull_bool(expr == null)) {
11789 if (i < case_.cases.length - 1) { 11803 if (i < case_.cases.length - 1) {
11790 world.error('default clause must be the last case', case_.get$span()); 11804 $globals.world.error('default clause must be the last case', case_.get $span());
11791 } 11805 }
11792 this.writer.writeln('default:'); 11806 this.writer.writeln('default:');
11793 } 11807 }
11794 else { 11808 else {
11795 var value = this.visitValue((expr && expr.is$lang_Expression())); 11809 var value = this.visitValue((expr && expr.is$lang_Expression()));
11796 this.writer.writeln(('case ' + value.code + ':')); 11810 this.writer.writeln(('case ' + value.code + ':'));
11797 } 11811 }
11798 } 11812 }
11799 this.writer.enterBlock(''); 11813 this.writer.enterBlock('');
11800 var caseExits = this._visitAllStatements(case_.statements, false); 11814 var caseExits = this._visitAllStatements(case_.statements, false);
11801 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1))) && ! $notnull_bool(caseExits)) { 11815 if ($notnull_bool($ne(case_, node.cases.$index(node.cases.length - 1))) && ! $notnull_bool(caseExits)) {
11802 var span = case_.statements.$index(case_.statements.length - 1).get$span() ; 11816 var span = case_.statements.$index(case_.statements.length - 1).get$span() ;
11803 this.writer.writeln('\$throw(new FallThroughError());'); 11817 this.writer.writeln('\$throw(new FallThroughError());');
11804 world.gen.corejs.useThrow = true; 11818 $globals.world.gen.corejs.useThrow = true;
11805 } 11819 }
11806 this.writer.exitBlock(''); 11820 this.writer.exitBlock('');
11807 this._popBlock(); 11821 this._popBlock();
11808 } 11822 }
11809 this.writer.exitBlock('}'); 11823 this.writer.exitBlock('}');
11810 return false; 11824 return false;
11811 } 11825 }
11812 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) { 11826 MethodGenerator.prototype._visitAllStatements = function(statementList, exits) {
11813 for (var i = 0; 11827 for (var i = 0;
11814 i < statementList.length; i++) { 11828 i < statementList.length; i++) {
11815 var stmt = statementList.$index(i); 11829 var stmt = statementList.$index(i);
11816 exits = stmt.visit$1(this); 11830 exits = stmt.visit$1(this);
11817 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1))) && $notnull_bool(exits)) { 11831 if ($notnull_bool($ne(stmt, statementList.$index(statementList.length - 1))) && $notnull_bool(exits)) {
11818 world.warning('unreachable code', statementList.$index(i + 1).get$span()); 11832 $globals.world.warning('unreachable code', statementList.$index(i + 1).get $span());
11819 } 11833 }
11820 } 11834 }
11821 return $assert_bool(exits); 11835 return $assert_bool(exits);
11822 } 11836 }
11823 MethodGenerator.prototype.visitBlockStatement = function(node) { 11837 MethodGenerator.prototype.visitBlockStatement = function(node) {
11824 this._pushBlock(false); 11838 this._pushBlock(false);
11825 this.writer.enterBlock('{'); 11839 this.writer.enterBlock('{');
11826 var exits = this._visitAllStatements(node.body, false); 11840 var exits = this._visitAllStatements(node.body, false);
11827 this.writer.exitBlock('}'); 11841 this.writer.exitBlock('}');
11828 this._popBlock(); 11842 this._popBlock();
11829 return $assert_bool(exits); 11843 return $assert_bool(exits);
11830 } 11844 }
11831 MethodGenerator.prototype.visitLabeledStatement = function(node) { 11845 MethodGenerator.prototype.visitLabeledStatement = function(node) {
11832 this.writer.writeln(('' + node.name.name + ':')); 11846 this.writer.writeln(('' + node.name.name + ':'));
11833 node.body.visit(this); 11847 node.body.visit(this);
11834 return false; 11848 return false;
11835 } 11849 }
11836 MethodGenerator.prototype.visitExpressionStatement = function(node) { 11850 MethodGenerator.prototype.visitExpressionStatement = function(node) {
11837 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi on)) { 11851 if ((node.body instanceof VarExpression) || (node.body instanceof ThisExpressi on)) {
11838 world.warning('variable used as statement', node.span); 11852 $globals.world.warning('variable used as statement', node.span);
11839 } 11853 }
11840 var value = this.visitVoid(node.body); 11854 var value = this.visitVoid(node.body);
11841 this.writer.writeln(('' + value.code + ';')); 11855 this.writer.writeln(('' + value.code + ';'));
11842 return false; 11856 return false;
11843 } 11857 }
11844 MethodGenerator.prototype.visitEmptyStatement = function(node) { 11858 MethodGenerator.prototype.visitEmptyStatement = function(node) {
11845 this.writer.writeln(';'); 11859 this.writer.writeln(';');
11846 return false; 11860 return false;
11847 } 11861 }
11848 MethodGenerator.prototype._checkNonStatic = function(node) { 11862 MethodGenerator.prototype._checkNonStatic = function(node) {
11849 if ($notnull_bool(this.get$isStatic())) { 11863 if ($notnull_bool(this.get$isStatic())) {
11850 world.warning('not allowed in static method', node.span); 11864 $globals.world.warning('not allowed in static method', node.span);
11851 } 11865 }
11852 } 11866 }
11853 MethodGenerator.prototype._makeSuperValue = function(node) { 11867 MethodGenerator.prototype._makeSuperValue = function(node) {
11854 var parentType = this.method.declaringType.get$parent(); 11868 var parentType = this.method.declaringType.get$parent();
11855 this._checkNonStatic(node); 11869 this._checkNonStatic(node);
11856 if ($notnull_bool(parentType == null)) { 11870 if ($notnull_bool(parentType == null)) {
11857 world.error('no super class', node.span); 11871 $globals.world.error('no super class', node.span);
11858 } 11872 }
11859 var ret = new Value(parentType, 'this', node.span, false); 11873 var ret = new Value(parentType, 'this', node.span, false);
11860 ret.isSuper = true; 11874 ret.isSuper = true;
11861 return ret; 11875 return ret;
11862 } 11876 }
11863 MethodGenerator.prototype._getOutermostMethod = function() { 11877 MethodGenerator.prototype._getOutermostMethod = function() {
11864 var result = this; 11878 var result = this;
11865 while (result.enclosingMethod != null) { 11879 while (result.enclosingMethod != null) {
11866 result = result.enclosingMethod; 11880 result = result.enclosingMethod;
11867 } 11881 }
(...skipping 16 matching lines...) Expand all
11884 return new Value(outermostMethod.method.declaringType, '\$this', node != nul l ? node.span : null, false); 11898 return new Value(outermostMethod.method.declaringType, '\$this', node != nul l ? node.span : null, false);
11885 } 11899 }
11886 else { 11900 else {
11887 this._checkNonStatic(node); 11901 this._checkNonStatic(node);
11888 return new Value(this.method.declaringType, 'this', node != null ? node.span : null, false); 11902 return new Value(this.method.declaringType, 'this', node != null ? node.span : null, false);
11889 } 11903 }
11890 } 11904 }
11891 MethodGenerator.prototype.visitLambdaExpression = function(node) { 11905 MethodGenerator.prototype.visitLambdaExpression = function(node) {
11892 var name = ''; 11906 var name = '';
11893 if (node.func.name != null) { 11907 if (node.func.name != null) {
11894 name = world.toJsIdentifier(node.func.name.name); 11908 name = $globals.world.toJsIdentifier(node.func.name.name);
11895 } 11909 }
11896 var meth = this._makeLambdaMethod($assert_String(name), node.func); 11910 var meth = this._makeLambdaMethod($assert_String(name), node.func);
11897 var w = new CodeWriter(); 11911 var w = new CodeWriter();
11898 meth.generator.writeDefinition$2(w, node); 11912 meth.generator.writeDefinition$2(w, node);
11899 return new Value(meth.get$functionType(), w.get$text(), node.span, true); 11913 return new Value(meth.get$functionType(), w.get$text(), node.span, true);
11900 } 11914 }
11901 MethodGenerator.prototype.visitCallExpression = function(node) { 11915 MethodGenerator.prototype.visitCallExpression = function(node) {
11902 var $0; 11916 var $0;
11903 var target; 11917 var target;
11904 var position = node.target; 11918 var position = node.target;
(...skipping 20 matching lines...) Expand all
11925 return target.invoke$4(this, name, position, this._makeArgs(node.arguments)); 11939 return target.invoke$4(this, name, position, this._makeArgs(node.arguments));
11926 } 11940 }
11927 MethodGenerator.prototype.visitIndexExpression = function(node) { 11941 MethodGenerator.prototype.visitIndexExpression = function(node) {
11928 var target = this.visitValue(node.target); 11942 var target = this.visitValue(node.target);
11929 var index = this.visitValue(node.index); 11943 var index = this.visitValue(node.index);
11930 return target.invoke$4(this, '\$index', node, new Arguments(null, [index])); 11944 return target.invoke$4(this, '\$index', node, new Arguments(null, [index]));
11931 } 11945 }
11932 MethodGenerator.prototype.visitBinaryExpression = function(node) { 11946 MethodGenerator.prototype.visitBinaryExpression = function(node) {
11933 var kind = node.op.kind; 11947 var kind = node.op.kind;
11934 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) { 11948 if (kind == 35/*TokenKind.AND*/ || kind == 34/*TokenKind.OR*/) {
11935 var x = this.visitTypedValue(node.x, world.nonNullBool); 11949 var x = this.visitTypedValue(node.x, $globals.world.nonNullBool);
11936 var y = this.visitTypedValue(node.y, world.nonNullBool); 11950 var y = this.visitTypedValue(node.y, $globals.world.nonNullBool);
11937 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + ''); 11951 var code = ('' + x.code + ' ' + node.op + ' ' + y.code + '');
11938 if ($notnull_bool(x.get$isConst()) && $notnull_bool(y.get$isConst())) { 11952 if ($notnull_bool(x.get$isConst()) && $notnull_bool(y.get$isConst())) {
11939 var value = (kind == 35/*TokenKind.AND*/) ? $notnull_bool(x.get$actualValu e()) && $notnull_bool(y.get$actualValue()) : $notnull_bool(x.get$actualValue()) || $notnull_bool(y.get$actualValue()); 11953 var value = (kind == 35/*TokenKind.AND*/) ? $notnull_bool(x.get$actualValu e()) && $notnull_bool(y.get$actualValue()) : $notnull_bool(x.get$actualValue()) || $notnull_bool(y.get$actualValue());
11940 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, ('' + value + ''), node.span); 11954 return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, v alue, ('' + value + ''), node.span);
11941 } 11955 }
11942 return new Value(world.nonNullBool, code, node.span, true); 11956 return new Value($globals.world.nonNullBool, code, node.span, true);
11943 } 11957 }
11944 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT* /) { 11958 else if (kind == 50/*TokenKind.EQ_STRICT*/ || kind == 51/*TokenKind.NE_STRICT* /) {
11945 var x = this.visitValue(node.x); 11959 var x = this.visitValue(node.x);
11946 var y = this.visitValue(node.y); 11960 var y = this.visitValue(node.y);
11947 if ($notnull_bool(x.get$isConst()) && $notnull_bool(y.get$isConst())) { 11961 if ($notnull_bool(x.get$isConst()) && $notnull_bool(y.get$isConst())) {
11948 var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y .get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue()); 11962 var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y .get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue());
11949 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, value, ("" + value + ""), node.span); 11963 return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, v alue, ("" + value + ""), node.span);
11950 } 11964 }
11951 if ($notnull_bool($eq(x.code, 'null')) || $notnull_bool($eq(y.code, 'null')) ) { 11965 if ($notnull_bool($eq(x.code, 'null')) || $notnull_bool($eq(y.code, 'null')) ) {
11952 var op = node.op.toString().substring(0, 2); 11966 var op = node.op.toString().substring(0, 2);
11953 return new Value(world.nonNullBool, ('' + x.code + ' ' + op + ' ' + y.code + ''), node.span, true); 11967 return new Value($globals.world.nonNullBool, ('' + x.code + ' ' + op + ' ' + y.code + ''), node.span, true);
11954 } 11968 }
11955 else { 11969 else {
11956 return new Value(world.nonNullBool, ('' + x.code + ' ' + node.op + ' ' + y .code + ''), node.span, true); 11970 return new Value($globals.world.nonNullBool, ('' + x.code + ' ' + node.op + ' ' + y.code + ''), node.span, true);
11957 } 11971 }
11958 } 11972 }
11959 var assignKind = TokenKind.kindFromAssign(node.op.kind); 11973 var assignKind = TokenKind.kindFromAssign(node.op.kind);
11960 if (assignKind == -1) { 11974 if (assignKind == -1) {
11961 var x = this.visitValue(node.x); 11975 var x = this.visitValue(node.x);
11962 var y = this.visitValue(node.y); 11976 var y = this.visitValue(node.y);
11963 var name = TokenKind.binaryMethodName(node.op.kind); 11977 var name = TokenKind.binaryMethodName(node.op.kind);
11964 if (node.op.kind == 49/*TokenKind.NE*/) { 11978 if (node.op.kind == 49/*TokenKind.NE*/) {
11965 name = '\$ne'; 11979 name = '\$ne';
11966 } 11980 }
11967 if ($notnull_bool(name == null)) { 11981 if ($notnull_bool(name == null)) {
11968 world.internalError(('unimplemented binary op ' + node.op + ''), node.span ); 11982 $globals.world.internalError(('unimplemented binary op ' + node.op + ''), node.span);
11969 return; 11983 return;
11970 } 11984 }
11971 return x.invoke$4(this, name, node, new Arguments(null, [y])); 11985 return x.invoke$4(this, name, node, new Arguments(null, [y]));
11972 } 11986 }
11973 else { 11987 else {
11974 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null)); 11988 return this._visitAssign(assignKind, node.x, node.y, node, to$call$1(null));
11975 } 11989 }
11976 } 11990 }
11977 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur eOriginal) { 11991 MethodGenerator.prototype._visitAssign = function(kind, xn, yn, position, captur eOriginal) {
11978 if (captureOriginal == null) { 11992 if (captureOriginal == null) {
11979 captureOriginal = (function (x) { 11993 captureOriginal = (function (x) {
11980 return x; 11994 return x;
11981 }) 11995 })
11982 ; 11996 ;
11983 } 11997 }
11984 if ((xn instanceof VarExpression)) { 11998 if ((xn instanceof VarExpression)) {
11985 return this._visitVarAssign(kind, (xn && xn.is$VarExpression()), yn, positio n, captureOriginal); 11999 return this._visitVarAssign(kind, (xn && xn.is$VarExpression()), yn, positio n, captureOriginal);
11986 } 12000 }
11987 else if ((xn instanceof IndexExpression)) { 12001 else if ((xn instanceof IndexExpression)) {
11988 return this._visitIndexAssign(kind, (xn && xn.is$IndexExpression()), yn, pos ition, captureOriginal); 12002 return this._visitIndexAssign(kind, (xn && xn.is$IndexExpression()), yn, pos ition, captureOriginal);
11989 } 12003 }
11990 else if ((xn instanceof DotExpression)) { 12004 else if ((xn instanceof DotExpression)) {
11991 return this._visitDotAssign(kind, (xn && xn.is$DotExpression()), yn, positio n, captureOriginal); 12005 return this._visitDotAssign(kind, (xn && xn.is$DotExpression()), yn, positio n, captureOriginal);
11992 } 12006 }
11993 else { 12007 else {
11994 world.error('illegal lhs', position.span); 12008 $globals.world.error('illegal lhs', position.span);
11995 } 12009 }
11996 } 12010 }
11997 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap tureOriginal) { 12011 MethodGenerator.prototype._visitVarAssign = function(kind, xn, yn, position, cap tureOriginal) {
11998 var name = xn.name.name; 12012 var name = xn.name.name;
11999 var x = this._scope.lookup(name); 12013 var x = this._scope.lookup(name);
12000 var y = this.visitValue(yn); 12014 var y = this.visitValue(yn);
12001 if ($notnull_bool(x == null)) { 12015 if ($notnull_bool(x == null)) {
12002 var members = this.method.declaringType.resolveMember(name); 12016 var members = this.method.declaringType.resolveMember(name);
12003 if ($notnull_bool($ne(members, null))) { 12017 if ($notnull_bool($ne(members, null))) {
12004 x = this._makeThisOrType(position.span); 12018 x = this._makeThisOrType(position.span);
12005 if (kind == 0) { 12019 if (kind == 0) {
12006 return x.set_$4(this, name, position, y); 12020 return x.set_$4(this, name, position, y);
12007 } 12021 }
12008 else if (!$notnull_bool(members.get$treatAsField()) || $notnull_bool(membe rs.get$containsMethods())) { 12022 else if (!$notnull_bool(members.get$treatAsField()) || $notnull_bool(membe rs.get$containsMethods())) {
12009 var right = x.get_$3(this, name, position); 12023 var right = x.get_$3(this, name, position);
12010 right = captureOriginal((right && right.is$Value())); 12024 right = captureOriginal((right && right.is$Value()));
12011 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y])); 12025 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, new Arguments(null, [y]));
12012 return x.set_$4(this, name, position, y); 12026 return x.set_$4(this, name, position, y);
12013 } 12027 }
12014 else { 12028 else {
12015 x = x.get_$3(this, name, position); 12029 x = x.get_$3(this, name, position);
12016 } 12030 }
12017 } 12031 }
12018 else { 12032 else {
12019 var member = this.get$library().lookup(name, xn.name.span); 12033 var member = this.get$library().lookup(name, xn.name.span);
12020 if (member == null) { 12034 if (member == null) {
12021 world.warning(('can not resolve ' + name + ''), xn.span); 12035 $globals.world.warning(('can not resolve ' + name + ''), xn.span);
12022 return this._makeMissingValue(name); 12036 return this._makeMissingValue(name);
12023 } 12037 }
12024 members = new MemberSet(member, false); 12038 members = new MemberSet(member, false);
12025 if (!$notnull_bool(members.get$treatAsField()) || $notnull_bool(members.ge t$containsMethods())) { 12039 if (!$notnull_bool(members.get$treatAsField()) || $notnull_bool(members.ge t$containsMethods())) {
12026 if (kind != 0) { 12040 if (kind != 0) {
12027 var right = members._get$3(this, position, x); 12041 var right = members._get$3(this, position, x);
12028 right = captureOriginal((right && right.is$Value())); 12042 right = captureOriginal((right && right.is$Value()));
12029 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n ew Arguments(null, [y])); 12043 y = right.invoke$4(this, TokenKind.binaryMethodName(kind), position, n ew Arguments(null, [y]));
12030 } 12044 }
12031 return members._set$4(this, position, x, y); 12045 return members._set$4(this, position, x, y);
12032 } 12046 }
12033 else { 12047 else {
12034 x = members._get$3(this, position, x); 12048 x = members._get$3(this, position, x);
12035 } 12049 }
12036 } 12050 }
12037 } 12051 }
12038 if ($notnull_bool(x.get$isFinal())) { 12052 if ($notnull_bool(x.get$isFinal())) {
12039 world.error(('final variable "' + x.code + '" is not assignable'), position. span); 12053 $globals.world.error(('final variable "' + x.code + '" is not assignable'), position.span);
12040 } 12054 }
12041 y = y.convertTo$3(this, x.type, yn); 12055 y = y.convertTo$3(this, x.type, yn);
12042 if (kind == 0) { 12056 if (kind == 0) {
12043 x = captureOriginal((x && x.is$Value())); 12057 x = captureOriginal((x && x.is$Value()));
12044 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true); 12058 return new Value(y.type, ('' + x.code + ' = ' + y.code + ''), position.span, true);
12045 } 12059 }
12046 else if ($notnull_bool(x.type.get$isNum()) && $notnull_bool(y.type.get$isNum() ) && (kind != 46/*TokenKind.TRUNCDIV*/)) { 12060 else if ($notnull_bool(x.type.get$isNum()) && $notnull_bool(y.type.get$isNum() ) && (kind != 46/*TokenKind.TRUNCDIV*/)) {
12047 x = captureOriginal((x && x.is$Value())); 12061 x = captureOriginal((x && x.is$Value()));
12048 var op = TokenKind.kindToString(kind); 12062 var op = TokenKind.kindToString(kind);
12049 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi tion.span, true); 12063 return new Value(y.type, ('' + x.code + ' ' + op + '= ' + y.code + ''), posi tion.span, true);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
12093 var value = this.visitValue(node.self); 12107 var value = this.visitValue(node.self);
12094 switch (node.op.kind) { 12108 switch (node.op.kind) {
12095 case 16/*TokenKind.INCR*/: 12109 case 16/*TokenKind.INCR*/:
12096 case 17/*TokenKind.DECR*/: 12110 case 17/*TokenKind.DECR*/:
12097 12111
12098 if ($notnull_bool(value.type.get$isNum())) { 12112 if ($notnull_bool(value.type.get$isNum())) {
12099 return new Value(value.type, ('' + node.op + '' + value.code + ''), node .span, true); 12113 return new Value(value.type, ('' + node.op + '' + value.code + ''), node .span, true);
12100 } 12114 }
12101 else { 12115 else {
12102 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/); 12116 var kind = (16/*TokenKind.INCR*/ == node.op.kind ? 42/*TokenKind.ADD*/ : 43/*TokenKind.SUB*/);
12103 var operand = new LiteralExpression(1, new TypeReference(node.span, worl d.numType), '1', node.span); 12117 var operand = new LiteralExpression(1, new TypeReference(node.span, $glo bals.world.numType), '1', node.span);
12104 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null)); 12118 return this._visitAssign($assert_num(kind), node.self, (operand && opera nd.is$lang_Expression()), node, to$call$1(null));
12105 } 12119 }
12106 12120
12107 case 19/*TokenKind.NOT*/: 12121 case 19/*TokenKind.NOT*/:
12108 12122
12109 if ($notnull_bool(value.type.get$isBool()) && $notnull_bool(value.get$isCo nst())) { 12123 if ($notnull_bool(value.type.get$isBool()) && $notnull_bool(value.get$isCo nst())) {
12110 var newVal = !$notnull_bool(value.get$actualValue()); 12124 var newVal = !$notnull_bool(value.get$actualValue());
12111 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is $lang_Type()), newVal, ('' + newVal + ''), node.span); 12125 return EvaluatedValue.EvaluatedValue$factory((($0 = value.type) && $0.is $lang_Type()), newVal, ('' + newVal + ''), node.span);
12112 } 12126 }
12113 else { 12127 else {
12114 var newVal = value.convertTo$3(this, world.nonNullBool, node); 12128 var newVal = value.convertTo$3(this, $globals.world.nonNullBool, node);
12115 return new Value(newVal.type, ('!' + newVal.code + ''), node.span, true) ; 12129 return new Value(newVal.type, ('!' + newVal.code + ''), node.span, true) ;
12116 } 12130 }
12117 12131
12118 case 42/*TokenKind.ADD*/: 12132 case 42/*TokenKind.ADD*/:
12119 12133
12120 return value.convertTo$3(this, world.numType, node); 12134 return value.convertTo$3(this, $globals.world.numType, node);
12121 12135
12122 case 43/*TokenKind.SUB*/: 12136 case 43/*TokenKind.SUB*/:
12123 case 18/*TokenKind.BIT_NOT*/: 12137 case 18/*TokenKind.BIT_NOT*/:
12124 12138
12125 if (node.op.kind == 18/*TokenKind.BIT_NOT*/) { 12139 if (node.op.kind == 18/*TokenKind.BIT_NOT*/) {
12126 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY()); 12140 return value.invoke$4(this, '\$bit_not', node, Arguments.get$EMPTY());
12127 } 12141 }
12128 else if (node.op.kind == 43/*TokenKind.SUB*/) { 12142 else if (node.op.kind == 43/*TokenKind.SUB*/) {
12129 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY()); 12143 return value.invoke$4(this, '\$negate', node, Arguments.get$EMPTY());
12130 } 12144 }
12131 else { 12145 else {
12132 world.internalError(('unimplemented: unary ' + node.op + ''), node.span) ; 12146 $globals.world.internalError(('unimplemented: unary ' + node.op + ''), n ode.span);
12133 } 12147 }
12134 $throw(new FallThroughError()); 12148 $throw(new FallThroughError());
12135 12149
12136 default: 12150 default:
12137 12151
12138 world.internalError(('unimplemented: ' + node.op + ''), node.span); 12152 $globals.world.internalError(('unimplemented: ' + node.op + ''), node.span );
12139 12153
12140 } 12154 }
12141 } 12155 }
12142 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) { 12156 MethodGenerator.prototype.visitPostfixExpression = function(node, isVoid) {
12143 var $this = this; // closure support 12157 var $this = this; // closure support
12144 var value = this.visitValue(node.body); 12158 var value = this.visitValue(node.body);
12145 if ($notnull_bool(value.type.get$isNum())) { 12159 if ($notnull_bool(value.type.get$isNum())) {
12146 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa n, true); 12160 return new Value(value.type, ('' + value.code + '' + node.op + ''), node.spa n, true);
12147 } 12161 }
12148 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/* TokenKind.SUB*/; 12162 var kind = (16/*TokenKind.INCR*/ == node.op.kind) ? 42/*TokenKind.ADD*/ : 43/* TokenKind.SUB*/;
12149 var operand = new LiteralExpression(1, new TypeReference(node.span, world.numT ype), '1', node.span); 12163 var operand = new LiteralExpression(1, new TypeReference(node.span, $globals.w orld.numType), '1', node.span);
12150 var tmpleft = null, left = null; 12164 var tmpleft = null, left = null;
12151 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) { 12165 var ret = this._visitAssign($assert_num(kind), node.body, (operand && operand. is$lang_Expression()), node, (function (l) {
12152 if ($notnull_bool(isVoid)) { 12166 if ($notnull_bool(isVoid)) {
12153 return l; 12167 return l;
12154 } 12168 }
12155 else { 12169 else {
12156 left = l; 12170 left = l;
12157 tmpleft = $this.forceTemp((l && l.is$Value())); 12171 tmpleft = $this.forceTemp((l && l.is$Value()));
12158 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value())); 12172 return $this.assignTemp((tmpleft && tmpleft.is$Value()), (left && left.is$ Value()));
12159 } 12173 }
(...skipping 24 matching lines...) Expand all
12184 if ($notnull_bool(type.get$isTop())) { 12198 if ($notnull_bool(type.get$isTop())) {
12185 type = type.get$library().findTypeByName($assert_String(constructorName)); 12199 type = type.get$library().findTypeByName($assert_String(constructorName));
12186 constructorName = ''; 12200 constructorName = '';
12187 } 12201 }
12188 var m = type.getConstructor$1(constructorName); 12202 var m = type.getConstructor$1(constructorName);
12189 if ($notnull_bool(m == null)) { 12203 if ($notnull_bool(m == null)) {
12190 var name = type.get$jsname(); 12204 var name = type.get$jsname();
12191 if ($notnull_bool(type.get$isVar())) { 12205 if ($notnull_bool(type.get$isVar())) {
12192 name = typeRef.get$name().get$name(); 12206 name = typeRef.get$name().get$name();
12193 } 12207 }
12194 world.error(('no matching constructor for ' + name + ''), node.span); 12208 $globals.world.error(('no matching constructor for ' + name + ''), node.span );
12195 return this._makeMissingValue($assert_String(name)); 12209 return this._makeMissingValue($assert_String(name));
12196 } 12210 }
12197 if ($notnull_bool(node.isConst)) { 12211 if ($notnull_bool(node.isConst)) {
12198 if (!$notnull_bool(m.get$isConst())) { 12212 if (!$notnull_bool(m.get$isConst())) {
12199 world.error('can\'t use const on a non-const constructor', node.span); 12213 $globals.world.error('can\'t use const on a non-const constructor', node.s pan);
12200 } 12214 }
12201 var $list = node.arguments; 12215 var $list = node.arguments;
12202 for (var $i = 0;$i < $list.length; $i++) { 12216 for (var $i = 0;$i < $list.length; $i++) {
12203 var arg = $list.$index($i); 12217 var arg = $list.$index($i);
12204 if (!$notnull_bool(this.visitValue((($0 = arg.get$value()) && $0.is$lang_E xpression())).get$isConst())) { 12218 if (!$notnull_bool(this.visitValue((($0 = arg.get$value()) && $0.is$lang_E xpression())).get$isConst())) {
12205 world.error('const constructor expects const arguments', arg.get$span()) ; 12219 $globals.world.error('const constructor expects const arguments', arg.ge t$span());
12206 } 12220 }
12207 } 12221 }
12208 } 12222 }
12209 return m.invoke$4(this, node, null, this._makeArgs(node.arguments)); 12223 return m.invoke$4(this, node, null, this._makeArgs(node.arguments));
12210 } 12224 }
12211 MethodGenerator.prototype.visitListExpression = function(node) { 12225 MethodGenerator.prototype.visitListExpression = function(node) {
12212 var argsCode = []; 12226 var argsCode = [];
12213 var argValues = []; 12227 var argValues = [];
12214 var $list = node.values; 12228 var $list = node.values;
12215 for (var $i = 0;$i < $list.length; $i++) { 12229 for (var $i = 0;$i < $list.length; $i++) {
12216 var item = $list.$index($i); 12230 var item = $list.$index($i);
12217 var arg = this.visitValue((item && item.is$lang_Expression())); 12231 var arg = this.visitValue((item && item.is$lang_Expression()));
12218 argValues.add$1(arg); 12232 argValues.add$1(arg);
12219 if ($notnull_bool(node.isConst)) { 12233 if ($notnull_bool(node.isConst)) {
12220 if (!$notnull_bool(arg.get$isConst())) { 12234 if (!$notnull_bool(arg.get$isConst())) {
12221 world.error('const list can only contain const values', item.get$span()) ; 12235 $globals.world.error('const list can only contain const values', item.ge t$span());
12222 argsCode.add$1(arg.code); 12236 argsCode.add$1(arg.code);
12223 } 12237 }
12224 else { 12238 else {
12225 argsCode.add$1(arg.get$canonicalCode()); 12239 argsCode.add$1(arg.get$canonicalCode());
12226 } 12240 }
12227 } 12241 }
12228 else { 12242 else {
12229 argsCode.add$1(arg.code); 12243 argsCode.add$1(arg.code);
12230 } 12244 }
12231 } 12245 }
12232 world.get$coreimpl().types.$index('ListFactory').markUsed$0(); 12246 $globals.world.get$coreimpl().types.$index('ListFactory').markUsed$0();
12233 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 12247 var code = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
12234 var value = new Value(world.listType, code, node.span, true); 12248 var value = new Value($globals.world.listType, code, node.span, true);
12235 if ($notnull_bool(node.isConst)) { 12249 if ($notnull_bool(node.isConst)) {
12236 var immutableList = world.get$coreimpl().types.$index('ImmutableList'); 12250 var immutableList = $globals.world.get$coreimpl().types.$index('ImmutableLis t');
12237 var immutableListCtor = immutableList.getConstructor$1('from'); 12251 var immutableListCtor = immutableList.getConstructor$1('from');
12238 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value])); 12252 var result = immutableListCtor.invoke$4(this, node, null, new Arguments(null , [value]));
12239 value = world.gen.globalForConst(ConstListValue.ConstListValue$factory((immu tableList && immutableList.is$lang_Type()), (argValues && argValues.is$List$Eval uatedValue()), ('const ' + code + ''), $assert_String(result.code), node.span), (argValues && argValues.is$List$Value())); 12253 value = $globals.world.gen.globalForConst(ConstListValue.ConstListValue$fact ory((immutableList && immutableList.is$lang_Type()), (argValues && argValues.is$ List$EvaluatedValue()), ('const ' + code + ''), $assert_String(result.code), nod e.span), (argValues && argValues.is$List$Value()));
12240 } 12254 }
12241 return value; 12255 return value;
12242 } 12256 }
12243 MethodGenerator.prototype.visitMapExpression = function(node) { 12257 MethodGenerator.prototype.visitMapExpression = function(node) {
12244 var $0; 12258 var $0;
12245 var mapImplType = world.gen.useMapFactory(); 12259 var mapImplType = $globals.world.gen.useMapFactory();
12246 var argValues = []; 12260 var argValues = [];
12247 var argsCode = []; 12261 var argsCode = [];
12248 for (var i = 0; 12262 for (var i = 0;
12249 i < node.items.length; i += 2) { 12263 i < node.items.length; i += 2) {
12250 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex pression()), world.stringType); 12264 var key = this.visitTypedValue((($0 = node.items.$index(i)) && $0.is$lang_Ex pression()), $globals.world.stringType);
12251 var valueItem = node.items.$index(i + 1); 12265 var valueItem = node.items.$index(i + 1);
12252 var value = this.visitValue((valueItem && valueItem.is$lang_Expression())); 12266 var value = this.visitValue((valueItem && valueItem.is$lang_Expression()));
12253 argValues.add$1(key); 12267 argValues.add$1(key);
12254 argValues.add$1(value); 12268 argValues.add$1(value);
12255 if ($notnull_bool(node.isConst)) { 12269 if ($notnull_bool(node.isConst)) {
12256 if (!$notnull_bool(key.get$isConst()) || !$notnull_bool(value.get$isConst( ))) { 12270 if (!$notnull_bool(key.get$isConst()) || !$notnull_bool(value.get$isConst( ))) {
12257 world.error('const map can only contain const values', valueItem.get$spa n()); 12271 $globals.world.error('const map can only contain const values', valueIte m.get$span());
12258 argsCode.add$1(key.code); 12272 argsCode.add$1(key.code);
12259 argsCode.add$1(value.code); 12273 argsCode.add$1(value.code);
12260 } 12274 }
12261 else { 12275 else {
12262 argsCode.add$1(key.get$canonicalCode()); 12276 argsCode.add$1(key.get$canonicalCode());
12263 argsCode.add$1(value.get$canonicalCode()); 12277 argsCode.add$1(value.get$canonicalCode());
12264 } 12278 }
12265 } 12279 }
12266 else { 12280 else {
12267 argsCode.add$1(key.code); 12281 argsCode.add$1(key.code);
12268 argsCode.add$1(value.code); 12282 argsCode.add$1(value.code);
12269 } 12283 }
12270 } 12284 }
12271 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']'); 12285 var argList = ('[' + Strings.join((argsCode && argsCode.is$List$String()), ", ") + ']');
12272 var code = ('\$map(' + argList + ')'); 12286 var code = ('\$map(' + argList + ')');
12273 if ($notnull_bool(node.isConst)) { 12287 if ($notnull_bool(node.isConst)) {
12274 var immutableMap = world.get$coreimpl().types.$index('ImmutableMap'); 12288 var immutableMap = $globals.world.get$coreimpl().types.$index('ImmutableMap' );
12275 var immutableMapCtor = immutableMap.getConstructor$1(''); 12289 var immutableMapCtor = immutableMap.getConstructor$1('');
12276 var argsValue = new Value(world.listType, argList, node.span, true); 12290 var argsValue = new Value($globals.world.listType, argList, node.span, true) ;
12277 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null, [argsValue])); 12291 var result = immutableMapCtor.invoke$4(this, node, null, new Arguments(null, [argsValue]));
12278 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, $ass ert_String(result.code), node.span); 12292 var value = ConstMapValue.ConstMapValue$factory((immutableMap && immutableMa p.is$lang_Type()), (argValues && argValues.is$List$EvaluatedValue()), code, $ass ert_String(result.code), node.span);
12279 return world.gen.globalForConst(value, (argValues && argValues.is$List$Value ())); 12293 return $globals.world.gen.globalForConst(value, (argValues && argValues.is$L ist$Value()));
12280 } 12294 }
12281 return new Value(mapImplType, code, node.span, true); 12295 return new Value(mapImplType, code, node.span, true);
12282 } 12296 }
12283 MethodGenerator.prototype.visitConditionalExpression = function(node) { 12297 MethodGenerator.prototype.visitConditionalExpression = function(node) {
12284 var $0; 12298 var $0;
12285 var test = this.visitBool(node.test); 12299 var test = this.visitBool(node.test);
12286 var trueBranch = this.visitValue(node.trueBranch); 12300 var trueBranch = this.visitValue(node.trueBranch);
12287 var falseBranch = this.visitValue(node.falseBranch); 12301 var falseBranch = this.visitValue(node.falseBranch);
12288 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod e + ''); 12302 var code = ('' + test.code + ' ? ' + trueBranch.code + ' : ' + falseBranch.cod e + '');
12289 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type()) , (($0 = falseBranch.type) && $0.is$lang_Type())), code, node.span, true); 12303 return new Value(lang_Type.union((($0 = trueBranch.type) && $0.is$lang_Type()) , (($0 = falseBranch.type) && $0.is$lang_Type())), code, node.span, true);
(...skipping 15 matching lines...) Expand all
12305 var target = node.self.visit(this); 12319 var target = node.self.visit(this);
12306 return target.get_$3(this, node.name.name, node.name); 12320 return target.get_$3(this, node.name.name, node.name);
12307 } 12321 }
12308 MethodGenerator.prototype.visitVarExpression = function(node) { 12322 MethodGenerator.prototype.visitVarExpression = function(node) {
12309 var name = node.name.name; 12323 var name = node.name.name;
12310 var ret = this._scope.lookup(name); 12324 var ret = this._scope.lookup(name);
12311 if ($notnull_bool($ne(ret, null))) return ret; 12325 if ($notnull_bool($ne(ret, null))) return ret;
12312 return this._makeThisOrType(node.span).get_$3(this, name, node); 12326 return this._makeThisOrType(node.span).get_$3(this, name, node);
12313 } 12327 }
12314 MethodGenerator.prototype._makeMissingValue = function(name) { 12328 MethodGenerator.prototype._makeMissingValue = function(name) {
12315 return new Value(world.varType, ('' + name + '()/*NotFound*/'), null, true); 12329 return new Value($globals.world.varType, ('' + name + '()/*NotFound*/'), null, true);
12316 } 12330 }
12317 MethodGenerator.prototype._makeThisOrType = function(span) { 12331 MethodGenerator.prototype._makeThisOrType = function(span) {
12318 var $0; 12332 var $0;
12319 return new BareValue(this, (($0 = this._getOutermostMethod()) && $0.is$MethodG enerator()), span); 12333 return new BareValue(this, (($0 = this._getOutermostMethod()) && $0.is$MethodG enerator()), span);
12320 } 12334 }
12321 MethodGenerator.prototype.visitThisExpression = function(node) { 12335 MethodGenerator.prototype.visitThisExpression = function(node) {
12322 return this._makeThisValue(node); 12336 return this._makeThisValue(node);
12323 } 12337 }
12324 MethodGenerator.prototype.visitSuperExpression = function(node) { 12338 MethodGenerator.prototype.visitSuperExpression = function(node) {
12325 return this._makeSuperValue(node); 12339 return this._makeSuperValue(node);
12326 } 12340 }
12327 MethodGenerator.prototype.visitNullExpression = function(node) { 12341 MethodGenerator.prototype.visitNullExpression = function(node) {
12328 return EvaluatedValue.EvaluatedValue$factory(world.varType, null, 'null', null ); 12342 return EvaluatedValue.EvaluatedValue$factory($globals.world.varType, null, 'nu ll', null);
12329 } 12343 }
12330 MethodGenerator.prototype.visitLiteralExpression = function(node) { 12344 MethodGenerator.prototype.visitLiteralExpression = function(node) {
12331 var $0; 12345 var $0;
12332 var type = node.type.type; 12346 var type = node.type.type;
12333 $assert($ne(type, null), "type != null", "gen.dart", 2119, 12); 12347 $assert($ne(type, null), "type != null", "gen.dart", 2149, 12);
12334 if (!!(($0 = node.value) && $0.is$List)) { 12348 if (!!(($0 = node.value) && $0.is$List)) {
12335 var items = []; 12349 var items = [];
12336 var $list = node.value; 12350 var $list = node.value;
12337 for (var $i = node.value.iterator$0(); $i.hasNext$0(); ) { 12351 for (var $i = node.value.iterator$0(); $i.hasNext$0(); ) {
12338 var item = $i.next$0(); 12352 var item = $i.next$0();
12339 var val = this.visitValue((item && item.is$lang_Expression())); 12353 var val = this.visitValue((item && item.is$lang_Expression()));
12340 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY()); 12354 val.invoke$4(this, 'toString', item, Arguments.get$EMPTY());
12341 var code = val.code; 12355 var code = val.code;
12342 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr ession)) { 12356 if ((item instanceof BinaryExpression) || (item instanceof ConditionalExpr ession)) {
12343 code = ('(' + code + ')'); 12357 code = ('(' + code + ')');
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
12375 function Arguments(nodes, values) { 12389 function Arguments(nodes, values) {
12376 this.nodes = nodes; 12390 this.nodes = nodes;
12377 this.values = values; 12391 this.values = values;
12378 // Initializers done 12392 // Initializers done
12379 } 12393 }
12380 Arguments.prototype.is$Arguments = function(){return this;}; 12394 Arguments.prototype.is$Arguments = function(){return this;};
12381 Arguments.Arguments$bare$factory = function(arity) { 12395 Arguments.Arguments$bare$factory = function(arity) {
12382 var values = []; 12396 var values = [];
12383 for (var i = 0; 12397 for (var i = 0;
12384 i < arity; i++) { 12398 i < arity; i++) {
12385 values.add$1(new Value(world.varType, ('\$' + i + ''), null, false)); 12399 values.add$1(new Value($globals.world.varType, ('\$' + i + ''), null, false) );
12386 } 12400 }
12387 return new Arguments(null, values); 12401 return new Arguments(null, values);
12388 } 12402 }
12389 Arguments.get$EMPTY = function() { 12403 Arguments.get$EMPTY = function() {
12390 if (Arguments._empty == null) { 12404 if ($globals.Arguments__empty == null) {
12391 Arguments._empty = new Arguments(null, []); 12405 $globals.Arguments__empty = new Arguments(null, []);
12392 } 12406 }
12393 return Arguments._empty; 12407 return $globals.Arguments__empty;
12394 } 12408 }
12395 Arguments.prototype.get$nameCount = function() { 12409 Arguments.prototype.get$nameCount = function() {
12396 return this.get$length() - this.get$bareCount(); 12410 return this.get$length() - this.get$bareCount();
12397 } 12411 }
12398 Arguments.prototype.get$hasNames = function() { 12412 Arguments.prototype.get$hasNames = function() {
12399 return this.get$bareCount() < this.get$length(); 12413 return this.get$bareCount() < this.get$length();
12400 } 12414 }
12401 Arguments.prototype.get$length = function() { 12415 Arguments.prototype.get$length = function() {
12402 return this.values.length; 12416 return this.values.length;
12403 } 12417 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
12455 for (var i = this.get$bareCount(); 12469 for (var i = this.get$bareCount();
12456 i < this.get$length(); i++) { 12470 i < this.get$length(); i++) {
12457 names.add$1(this.getName(i)); 12471 names.add$1(this.getName(i));
12458 } 12472 }
12459 return (names && names.is$List$String()); 12473 return (names && names.is$List$String());
12460 } 12474 }
12461 Arguments.prototype.toCallStubArgs = function() { 12475 Arguments.prototype.toCallStubArgs = function() {
12462 var result = []; 12476 var result = [];
12463 for (var i = 0; 12477 for (var i = 0;
12464 i < this.get$bareCount(); i++) { 12478 i < this.get$bareCount(); i++) {
12465 result.add$1(new Value(world.varType, ('\$' + i + ''), null, false)); 12479 result.add$1(new Value($globals.world.varType, ('\$' + i + ''), null, false) );
12466 } 12480 }
12467 for (var i = this.get$bareCount(); 12481 for (var i = this.get$bareCount();
12468 i < this.get$length(); i++) { 12482 i < this.get$length(); i++) {
12469 var name = this.getName(i); 12483 var name = this.getName(i);
12470 if ($notnull_bool(name == null)) name = ('\$' + i + ''); 12484 if ($notnull_bool(name == null)) name = ('\$' + i + '');
12471 result.add$1(new Value(world.varType, name, null, false)); 12485 result.add$1(new Value($globals.world.varType, name, null, false));
12472 } 12486 }
12473 return new Arguments(this.nodes, result); 12487 return new Arguments(this.nodes, result);
12474 } 12488 }
12475 // ********** Code for LibraryImport ************** 12489 // ********** Code for LibraryImport **************
12476 function LibraryImport(library, prefix) { 12490 function LibraryImport(library, prefix) {
12477 this.library = library; 12491 this.library = library;
12478 this.prefix = prefix; 12492 this.prefix = prefix;
12479 // Initializers done 12493 // Initializers done
12480 } 12494 }
12481 LibraryImport.prototype.get$library = function() { return this.library; }; 12495 LibraryImport.prototype.get$library = function() { return this.library; };
12482 LibraryImport.prototype.set$library = function(value) { return this.library = va lue; }; 12496 LibraryImport.prototype.set$library = function(value) { return this.library = va lue; };
12483 // ********** Code for Library ************** 12497 // ********** Code for Library **************
12484 function Library(baseSource) { 12498 function Library(baseSource) {
12485 this.isWritten = false 12499 this.isWritten = false
12486 this.baseSource = baseSource; 12500 this.baseSource = baseSource;
12487 // Initializers done 12501 // Initializers done
12488 this.sourceDir = dirname(this.baseSource.filename); 12502 this.sourceDir = dirname(this.baseSource.filename);
12489 this.topType = new DefinedType(null, this, null, true); 12503 this.topType = new DefinedType(null, this, null, true);
12490 this.types = $map(['', this.topType]); 12504 this.types = $map(['', this.topType]);
12491 this.imports = []; 12505 this.imports = [];
12492 this.natives = []; 12506 this.natives = [];
12493 this.sources = []; 12507 this.sources = [];
12494 this._privateMembers = $map([]); 12508 this._privateMembers = $map([]);
12495 } 12509 }
12496 Library.prototype.is$Library = function(){return this;}; 12510 Library.prototype.is$Library = function(){return this;};
12497 Library.prototype.get$name = function() { return this.name; }; 12511 Library.prototype.get$name = function() { return this.name; };
12498 Library.prototype.set$name = function(value) { return this.name = value; }; 12512 Library.prototype.set$name = function(value) { return this.name = value; };
12499 Library.prototype.get$isCore = function() { 12513 Library.prototype.get$isCore = function() {
12500 return $eq(this, world.corelib); 12514 return $eq(this, $globals.world.corelib);
12501 } 12515 }
12502 Library.prototype.get$isCoreImpl = function() { 12516 Library.prototype.get$isCoreImpl = function() {
12503 return $eq(this, world.get$coreimpl()); 12517 return $eq(this, $globals.world.get$coreimpl());
12504 } 12518 }
12505 Library.prototype.get$jsname = function() { 12519 Library.prototype.get$jsname = function() {
12506 if (this._jsname == null) { 12520 if (this._jsname == null) {
12507 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl l(' ', '_'); 12521 this._jsname = this.name.replaceAll('.', '_').replaceAll(':', '_').replaceAl l(' ', '_');
12508 } 12522 }
12509 return this._jsname; 12523 return this._jsname;
12510 } 12524 }
12511 Library.prototype.get$span = function() { 12525 Library.prototype.get$span = function() {
12512 return new SourceSpan(this.baseSource, 0, 0); 12526 return new SourceSpan(this.baseSource, 0, 0);
12513 } 12527 }
12514 Library.prototype.makeFullPath = function(filename) { 12528 Library.prototype.makeFullPath = function(filename) {
12515 if (filename.startsWith('dart:')) return filename; 12529 if (filename.startsWith('dart:')) return filename;
12516 if (filename.startsWith('/')) return filename; 12530 if (filename.startsWith('/')) return filename;
12517 if (filename.startsWith('file:///')) return filename; 12531 if (filename.startsWith('file:///')) return filename;
12518 if (filename.startsWith('http://')) return filename; 12532 if (filename.startsWith('http://')) return filename;
12519 return joinPaths(this.sourceDir, filename); 12533 return joinPaths(this.sourceDir, filename);
12520 } 12534 }
12521 Library.prototype.addImport = function(fullname, prefix) { 12535 Library.prototype.addImport = function(fullname, prefix) {
12522 var newLib = world.getOrAddLibrary(fullname); 12536 var newLib = $globals.world.getOrAddLibrary(fullname);
12523 this.imports.add(new LibraryImport(newLib, prefix)); 12537 this.imports.add(new LibraryImport(newLib, prefix));
12524 return newLib; 12538 return newLib;
12525 } 12539 }
12526 Library.prototype.addNative = function(fullname) { 12540 Library.prototype.addNative = function(fullname) {
12527 this.natives.add(world.reader.readFile(fullname)); 12541 this.natives.add($globals.world.reader.readFile(fullname));
12528 } 12542 }
12529 Library.prototype._findMembers = function(name) { 12543 Library.prototype._findMembers = function(name) {
12530 var $0; 12544 var $0;
12531 if (name.startsWith('_')) { 12545 if (name.startsWith('_')) {
12532 return (($0 = this._privateMembers.$index(name)) && $0.is$MemberSet()); 12546 return (($0 = this._privateMembers.$index(name)) && $0.is$MemberSet());
12533 } 12547 }
12534 else { 12548 else {
12535 return (($0 = world._members.$index(name)) && $0.is$MemberSet()); 12549 return (($0 = $globals.world._members.$index(name)) && $0.is$MemberSet());
12536 } 12550 }
12537 } 12551 }
12538 Library.prototype._addMember = function(member) { 12552 Library.prototype._addMember = function(member) {
12539 if ($notnull_bool(member.get$isPrivate())) { 12553 if ($notnull_bool(member.get$isPrivate())) {
12540 if ($notnull_bool(member.get$isStatic())) { 12554 if ($notnull_bool(member.get$isStatic())) {
12541 if ($notnull_bool(member.declaringType.get$isTop())) { 12555 if ($notnull_bool(member.declaringType.get$isTop())) {
12542 world._addTopName(member); 12556 $globals.world._addTopName(member);
12543 } 12557 }
12544 return; 12558 return;
12545 } 12559 }
12546 var mset = this._privateMembers.$index(member.name); 12560 var mset = this._privateMembers.$index(member.name);
12547 if ($notnull_bool(mset == null)) { 12561 if ($notnull_bool(mset == null)) {
12548 var $list = world.libraries.getValues(); 12562 var $list = $globals.world.libraries.getValues();
12549 for (var $i = world.libraries.getValues().iterator$0(); $i.hasNext$0(); ) { 12563 for (var $i = $globals.world.libraries.getValues().iterator$0(); $i.hasNex t$0(); ) {
12550 var lib = $i.next$0(); 12564 var lib = $i.next$0();
12551 if (lib._privateMembers.containsKey(member.name)) { 12565 if (lib._privateMembers.containsKey(member.name)) {
12552 member.set$jsname(('_' + this.get$jsname() + '' + member.name + '')); 12566 member.set$jsname(('_' + this.get$jsname() + '' + member.name + ''));
12553 break; 12567 break;
12554 } 12568 }
12555 } 12569 }
12556 mset = new MemberSet(member, false); 12570 mset = new MemberSet(member, false);
12557 this._privateMembers.$setindex(member.name, mset); 12571 this._privateMembers.$setindex(member.name, mset);
12558 } 12572 }
12559 else { 12573 else {
12560 mset.get$members().add$1(member); 12574 mset.get$members().add$1(member);
12561 } 12575 }
12562 } 12576 }
12563 else { 12577 else {
12564 world._addMember(member); 12578 $globals.world._addMember(member);
12565 } 12579 }
12566 } 12580 }
12567 Library.prototype.getOrAddFunctionType = function(name, func, inType) { 12581 Library.prototype.getOrAddFunctionType = function(name, func, inType) {
12568 var def = new FunctionTypeDefinition(func, null, func.span); 12582 var def = new FunctionTypeDefinition(func, null, func.span);
12569 var type = new DefinedType(name, this, def, false); 12583 var type = new DefinedType(name, this, def, false);
12570 type.addMethod('\$call', func); 12584 type.addMethod('\$call', func);
12571 type.members.$index('\$call').resolve$1(inType); 12585 type.members.$index('\$call').resolve$1(inType);
12572 type.interfaces = [world.functionType]; 12586 type.interfaces = [$globals.world.functionType];
12573 return type; 12587 return type;
12574 } 12588 }
12575 Library.prototype.addType = function(name, definition, isClass) { 12589 Library.prototype.addType = function(name, definition, isClass) {
12576 var $0; 12590 var $0;
12577 if (this.types.containsKey(name)) { 12591 if (this.types.containsKey(name)) {
12578 var existingType = this.types.$index(name); 12592 var existingType = this.types.$index(name);
12579 if ($notnull_bool(this.get$isCore()) && $notnull_bool(existingType.get$defin ition() == null)) { 12593 if ($notnull_bool(this.get$isCore()) && $notnull_bool(existingType.get$defin ition() == null)) {
12580 existingType.setDefinition$1(definition); 12594 existingType.setDefinition$1(definition);
12581 } 12595 }
12582 else { 12596 else {
12583 world.warning(('duplicate definition of ' + name + ''), definition.span); 12597 $globals.world.warning(('duplicate definition of ' + name + ''), definitio n.span);
12584 } 12598 }
12585 } 12599 }
12586 else { 12600 else {
12587 this.types.$setindex(name, new DefinedType(name, this, (definition && defini tion.is$Definition()), isClass)); 12601 this.types.$setindex(name, new DefinedType(name, this, (definition && defini tion.is$Definition()), isClass));
12588 } 12602 }
12589 return (($0 = this.types.$index(name)) && $0.is$DefinedType()); 12603 return (($0 = this.types.$index(name)) && $0.is$DefinedType());
12590 } 12604 }
12591 Library.prototype.findType = function(type) { 12605 Library.prototype.findType = function(type) {
12592 var result = this.findTypeByName(type.name.name); 12606 var result = this.findTypeByName(type.name.name);
12593 if (result == null) return null; 12607 if (result == null) return null;
(...skipping 15 matching lines...) Expand all
12609 var imported = $list.$index($i); 12623 var imported = $list.$index($i);
12610 var newRet = null; 12624 var newRet = null;
12611 if (imported.prefix == null) { 12625 if (imported.prefix == null) {
12612 newRet = imported.get$library().types.$index(name); 12626 newRet = imported.get$library().types.$index(name);
12613 } 12627 }
12614 else if (imported.prefix == name) { 12628 else if (imported.prefix == name) {
12615 newRet = imported.get$library().topType; 12629 newRet = imported.get$library().topType;
12616 } 12630 }
12617 if ($notnull_bool($ne(newRet, null))) { 12631 if ($notnull_bool($ne(newRet, null))) {
12618 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) { 12632 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) {
12619 world.error(('conflicting types for "' + name + '"'), ret.get$span(), ne wRet.get$span()); 12633 $globals.world.error(('conflicting types for "' + name + '"'), ret.get$s pan(), newRet.get$span());
12620 } 12634 }
12621 else { 12635 else {
12622 ret = newRet; 12636 ret = newRet;
12623 } 12637 }
12624 } 12638 }
12625 } 12639 }
12626 return (ret && ret.is$lang_Type()); 12640 return (ret && ret.is$lang_Type());
12627 } 12641 }
12628 Library.prototype.lookup = function(name, span) { 12642 Library.prototype.lookup = function(name, span) {
12629 var retType = this.findTypeByName(name); 12643 var retType = this.findTypeByName(name);
12630 var ret = null; 12644 var ret = null;
12631 if ($notnull_bool($ne(retType, null))) { 12645 if ($notnull_bool($ne(retType, null))) {
12632 ret = retType.get$typeMember(); 12646 ret = retType.get$typeMember();
12633 } 12647 }
12634 var newRet = this.topType.getMember(name); 12648 var newRet = this.topType.getMember(name);
12635 if ($notnull_bool($ne(newRet, null))) { 12649 if ($notnull_bool($ne(newRet, null))) {
12636 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) { 12650 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) {
12637 world.error(('conflicting members for "' + name + '"'), span, ret.get$span (), newRet.get$span()); 12651 $globals.world.error(('conflicting members for "' + name + '"'), span, ret .get$span(), newRet.get$span());
12638 } 12652 }
12639 else { 12653 else {
12640 ret = newRet; 12654 ret = newRet;
12641 } 12655 }
12642 } 12656 }
12643 var $list = this.imports; 12657 var $list = this.imports;
12644 for (var $i = 0;$i < $list.length; $i++) { 12658 for (var $i = 0;$i < $list.length; $i++) {
12645 var imported = $list.$index($i); 12659 var imported = $list.$index($i);
12646 if (imported.prefix == null) { 12660 if (imported.prefix == null) {
12647 newRet = imported.get$library().topType.getMember(name); 12661 newRet = imported.get$library().topType.getMember(name);
12648 if ($notnull_bool($ne(newRet, null))) { 12662 if ($notnull_bool($ne(newRet, null))) {
12649 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) { 12663 if ($notnull_bool($ne(ret, null)) && $notnull_bool($ne(ret, newRet))) {
12650 world.error(('conflicting members for "' + name + '"'), span, ret.get$ span(), newRet.get$span()); 12664 $globals.world.error(('conflicting members for "' + name + '"'), span, ret.get$span(), newRet.get$span());
12651 } 12665 }
12652 else { 12666 else {
12653 ret = newRet; 12667 ret = newRet;
12654 } 12668 }
12655 } 12669 }
12656 } 12670 }
12657 } 12671 }
12658 return (ret && ret.is$Member()); 12672 return (ret && ret.is$Member());
12659 } 12673 }
12660 Library.prototype.resolve = function() { 12674 Library.prototype.resolve = function() {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
12702 this.currentType = this.library.topType; 12716 this.currentType = this.library.topType;
12703 this.sources = []; 12717 this.sources = [];
12704 } 12718 }
12705 _LibraryVisitor.prototype.is$TreeVisitor = function(){return this;}; 12719 _LibraryVisitor.prototype.is$TreeVisitor = function(){return this;};
12706 _LibraryVisitor.prototype.get$library = function() { return this.library; }; 12720 _LibraryVisitor.prototype.get$library = function() { return this.library; };
12707 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; }; 12721 _LibraryVisitor.prototype.get$isTop = function() { return this.isTop; };
12708 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu e; }; 12722 _LibraryVisitor.prototype.set$isTop = function(value) { return this.isTop = valu e; };
12709 _LibraryVisitor.prototype.addSourceFromName = function(name, span) { 12723 _LibraryVisitor.prototype.addSourceFromName = function(name, span) {
12710 var filename = this.library.makeFullPath(name); 12724 var filename = this.library.makeFullPath(name);
12711 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) { 12725 if ($notnull_bool($eq(filename, this.library.baseSource.filename))) {
12712 world.error('library can not source itself', span); 12726 $globals.world.error('library can not source itself', span);
12713 return; 12727 return;
12714 } 12728 }
12715 else if (this.sources.some((function (s) { 12729 else if (this.sources.some((function (s) {
12716 return $eq(s.filename, filename); 12730 return $eq(s.filename, filename);
12717 }) 12731 })
12718 )) { 12732 )) {
12719 world.error(('file "' + filename + '" has already been sourced'), span); 12733 $globals.world.error(('file "' + filename + '" has already been sourced'), s pan);
12720 return; 12734 return;
12721 } 12735 }
12722 var source = world.readFile(this.library.makeFullPath(name)); 12736 var source = $globals.world.readFile(this.library.makeFullPath(name));
12723 this.sources.add(source); 12737 this.sources.add(source);
12724 } 12738 }
12725 _LibraryVisitor.prototype.addSource = function(source) { 12739 _LibraryVisitor.prototype.addSource = function(source) {
12726 var $this = this; // closure support 12740 var $this = this; // closure support
12727 if (this.library.sources.some((function (s) { 12741 if (this.library.sources.some((function (s) {
12728 return s.filename == source.filename; 12742 return s.filename == source.filename;
12729 }) 12743 })
12730 )) { 12744 )) {
12731 world.error(('duplicate source file "' + source.filename + '"')); 12745 $globals.world.error(('duplicate source file "' + source.filename + '"'));
12732 return; 12746 return;
12733 } 12747 }
12734 this.library.sources.add(source); 12748 this.library.sources.add(source);
12735 var parser = new lang_Parser(source, options.dietParse, false, false, 0); 12749 var parser = new lang_Parser(source, $globals.options.dietParse, false, false, 0);
12736 var unit = parser.compilationUnit(); 12750 var unit = parser.compilationUnit();
12737 unit.forEach((function (def) { 12751 unit.forEach((function (def) {
12738 return def.visit$1($this); 12752 return def.visit$1($this);
12739 }) 12753 })
12740 ); 12754 );
12741 $assert(this.sources.length == 0 || $notnull_bool(this.isTop), "sources.length == 0 || isTop", "library.dart", 293, 12); 12755 $assert(this.sources.length == 0 || $notnull_bool(this.isTop), "sources.length == 0 || isTop", "library.dart", 293, 12);
12742 this.isTop = false; 12756 this.isTop = false;
12743 var newSources = this.sources; 12757 var newSources = this.sources;
12744 this.sources = []; 12758 this.sources = [];
12745 for (var $i = newSources.iterator$0(); $i.hasNext$0(); ) { 12759 for (var $i = newSources.iterator$0(); $i.hasNext$0(); ) {
12746 var source0 = $i.next$0(); 12760 var source0 = $i.next$0();
12747 this.addSource((source0 && source0.is$SourceFile())); 12761 this.addSource((source0 && source0.is$SourceFile()));
12748 } 12762 }
12749 } 12763 }
12750 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) { 12764 _LibraryVisitor.prototype.visitDirectiveDefinition = function(node) {
12751 if (!$notnull_bool(this.isTop)) { 12765 if (!$notnull_bool(this.isTop)) {
12752 world.error('directives not allowed in sourced file', node.span); 12766 $globals.world.error('directives not allowed in sourced file', node.span);
12753 return; 12767 return;
12754 } 12768 }
12755 var name; 12769 var name;
12756 switch (node.name.name) { 12770 switch (node.name.name) {
12757 case "library": 12771 case "library":
12758 12772
12759 name = this.getSingleStringArg(node); 12773 name = this.getSingleStringArg(node);
12760 if (this.library.name == null) { 12774 if (this.library.name == null) {
12761 this.library.name = $assert_String(name); 12775 this.library.name = $assert_String(name);
12762 if ($notnull_bool($eq(name, 'node')) || $notnull_bool($eq(name, 'dom'))) { 12776 if ($notnull_bool($eq(name, 'node')) || $notnull_bool($eq(name, 'dom'))) {
12763 this.library.topType.isNativeType = true; 12777 this.library.topType.isNativeType = true;
12764 } 12778 }
12765 if ($notnull_bool(this.seenImport) || $notnull_bool(this.seenSource) || $notnull_bool(this.seenResource)) { 12779 if ($notnull_bool(this.seenImport) || $notnull_bool(this.seenSource) || $notnull_bool(this.seenResource)) {
12766 world.error('#library must be first directive in file', node.span); 12780 $globals.world.error('#library must be first directive in file', node. span);
12767 } 12781 }
12768 } 12782 }
12769 else { 12783 else {
12770 world.error('already specified library name', node.span); 12784 $globals.world.error('already specified library name', node.span);
12771 } 12785 }
12772 break; 12786 break;
12773 12787
12774 case "import": 12788 case "import":
12775 12789
12776 this.seenImport = true; 12790 this.seenImport = true;
12777 name = this.getFirstStringArg(node); 12791 name = this.getFirstStringArg(node);
12778 var prefix = this.tryGetNamedStringArg(node, 'prefix'); 12792 var prefix = this.tryGetNamedStringArg(node, 'prefix');
12779 if (node.arguments.length > 2 || node.arguments.length == 2 && $notnull_bo ol(prefix == null)) { 12793 if (node.arguments.length > 2 || node.arguments.length == 2 && $notnull_bo ol(prefix == null)) {
12780 world.error('expected at most one "name" argument and one optional "pref ix"' + (' but found ' + node.arguments.length + ''), node.span); 12794 $globals.world.error('expected at most one "name" argument and one optio nal "prefix"' + (' but found ' + node.arguments.length + ''), node.span);
12781 } 12795 }
12782 else if ($notnull_bool($ne(prefix, null)) && prefix.indexOf$2('.', 0) >= 0 ) { 12796 else if ($notnull_bool($ne(prefix, null)) && prefix.indexOf$2('.', 0) >= 0 ) {
12783 world.error('library prefix canot contain "."', node.span); 12797 $globals.world.error('library prefix canot contain "."', node.span);
12784 } 12798 }
12785 else if ($notnull_bool(this.seenSource) || $notnull_bool(this.seenResource )) { 12799 else if ($notnull_bool(this.seenSource) || $notnull_bool(this.seenResource )) {
12786 world.error('#imports must come before any #source or #resource', node.s pan); 12800 $globals.world.error('#imports must come before any #source or #resource ', node.span);
12787 } 12801 }
12788 if ($notnull_bool($eq(prefix, ''))) prefix = null; 12802 if ($notnull_bool($eq(prefix, ''))) prefix = null;
12789 var filename = this.library.makeFullPath($assert_String(name)); 12803 var filename = this.library.makeFullPath($assert_String(name));
12790 if (this.library.imports.some((function (li) { 12804 if (this.library.imports.some((function (li) {
12791 return $eq(li.get$library().baseSource, filename); 12805 return $eq(li.get$library().baseSource, filename);
12792 }) 12806 })
12793 )) { 12807 )) {
12794 world.error(('duplicate import of "' + name + '"'), node.span); 12808 $globals.world.error(('duplicate import of "' + name + '"'), node.span);
12795 return; 12809 return;
12796 } 12810 }
12797 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix)); 12811 var newLib = this.library.addImport($assert_String(filename), $assert_Stri ng(prefix));
12798 break; 12812 break;
12799 12813
12800 case "source": 12814 case "source":
12801 12815
12802 this.seenSource = true; 12816 this.seenSource = true;
12803 name = this.getSingleStringArg(node); 12817 name = this.getSingleStringArg(node);
12804 this.addSourceFromName($assert_String(name), node.span); 12818 this.addSourceFromName($assert_String(name), node.span);
12805 if ($notnull_bool(this.seenResource)) { 12819 if ($notnull_bool(this.seenResource)) {
12806 world.error('#sources must come before any #resource', node.span); 12820 $globals.world.error('#sources must come before any #resource', node.spa n);
12807 } 12821 }
12808 break; 12822 break;
12809 12823
12810 case "native": 12824 case "native":
12811 12825
12812 name = this.getSingleStringArg(node); 12826 name = this.getSingleStringArg(node);
12813 this.library.addNative(this.library.makeFullPath($assert_String(name))); 12827 this.library.addNative(this.library.makeFullPath($assert_String(name)));
12814 break; 12828 break;
12815 12829
12816 case "resource": 12830 case "resource":
12817 12831
12818 this.seenResource = true; 12832 this.seenResource = true;
12819 this.getFirstStringArg(node); 12833 this.getFirstStringArg(node);
12820 break; 12834 break;
12821 12835
12822 default: 12836 default:
12823 12837
12824 world.error(('unknown directive: ' + node.name.name + ''), node.span); 12838 $globals.world.error(('unknown directive: ' + node.name.name + ''), node.s pan);
12825 12839
12826 } 12840 }
12827 } 12841 }
12828 _LibraryVisitor.prototype.getSingleStringArg = function(node) { 12842 _LibraryVisitor.prototype.getSingleStringArg = function(node) {
12829 if (node.arguments.length != 1) { 12843 if (node.arguments.length != 1) {
12830 world.error(('expected exactly one argument but found ' + node.arguments.len gth + ''), node.span); 12844 $globals.world.error(('expected exactly one argument but found ' + node.argu ments.length + ''), node.span);
12831 } 12845 }
12832 return this.getFirstStringArg(node); 12846 return this.getFirstStringArg(node);
12833 } 12847 }
12834 _LibraryVisitor.prototype.getFirstStringArg = function(node) { 12848 _LibraryVisitor.prototype.getFirstStringArg = function(node) {
12835 if (node.arguments.length < 1) { 12849 if (node.arguments.length < 1) {
12836 world.error(('expected at least one argument but found ' + node.arguments.le ngth + ''), node.span); 12850 $globals.world.error(('expected at least one argument but found ' + node.arg uments.length + ''), node.span);
12837 } 12851 }
12838 var arg = node.arguments.$index(0); 12852 var arg = node.arguments.$index(0);
12839 if (arg.label != null) { 12853 if (arg.label != null) {
12840 world.error('label not allowed for directive', node.span); 12854 $globals.world.error('label not allowed for directive', node.span);
12841 } 12855 }
12842 return this._parseStringArgument((arg && arg.is$ArgumentNode())); 12856 return this._parseStringArgument((arg && arg.is$ArgumentNode()));
12843 } 12857 }
12844 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { 12858 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) {
12845 var args = node.arguments.filter((function (a) { 12859 var args = node.arguments.filter((function (a) {
12846 return a.label != null && a.label.name == argName; 12860 return a.label != null && a.label.name == argName;
12847 }) 12861 })
12848 ); 12862 );
12849 if (args.length == 0) { 12863 if (args.length == 0) {
12850 return null; 12864 return null;
12851 } 12865 }
12852 if (args.length > 1) { 12866 if (args.length > 1) {
12853 world.error(('expected at most one "' + argName + '" argument but found ') + node.arguments.length, node.span); 12867 $globals.world.error(('expected at most one "' + argName + '" argument but f ound ') + node.arguments.length, node.span);
12854 } 12868 }
12855 for (var $i = args.iterator$0(); $i.hasNext$0(); ) { 12869 for (var $i = args.iterator$0(); $i.hasNext$0(); ) {
12856 var arg = $i.next$0(); 12870 var arg = $i.next$0();
12857 return this._parseStringArgument((arg && arg.is$ArgumentNode())); 12871 return this._parseStringArgument((arg && arg.is$ArgumentNode()));
12858 } 12872 }
12859 } 12873 }
12860 _LibraryVisitor.prototype._parseStringArgument = function(arg) { 12874 _LibraryVisitor.prototype._parseStringArgument = function(arg) {
12861 var expr = arg.value; 12875 var expr = arg.value;
12862 if (!(expr instanceof LiteralExpression) || !$notnull_bool(expr.type.type.get$ isString())) { 12876 if (!(expr instanceof LiteralExpression) || !$notnull_bool(expr.type.type.get$ isString())) {
12863 world.error('expected string', expr.get$span()); 12877 $globals.world.error('expected string', expr.get$span());
12864 } 12878 }
12865 return parseStringLiteral($assert_String(expr.get$value())); 12879 return parseStringLiteral($assert_String(expr.get$value()));
12866 } 12880 }
12867 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { 12881 _LibraryVisitor.prototype.visitTypeDefinition = function(node) {
12868 var oldType = this.currentType; 12882 var oldType = this.currentType;
12869 this.currentType = this.library.addType(node.name.name, node, node.isClass); 12883 this.currentType = this.library.addType(node.name.name, node, node.isClass);
12870 var $list = node.body; 12884 var $list = node.body;
12871 for (var $i = 0;$i < $list.length; $i++) { 12885 for (var $i = 0;$i < $list.length; $i++) {
12872 var member = $list.$index($i); 12886 var member = $list.$index($i);
12873 member.visit$1(this); 12887 member.visit$1(this);
(...skipping 29 matching lines...) Expand all
12903 Parameter.prototype.get$value = function() { return this.value; }; 12917 Parameter.prototype.get$value = function() { return this.value; };
12904 Parameter.prototype.set$value = function(value) { return this.value = value; }; 12918 Parameter.prototype.set$value = function(value) { return this.value = value; };
12905 Parameter.prototype.resolve = function(method, inType) { 12919 Parameter.prototype.resolve = function(method, inType) {
12906 this.name = this.definition.name.name; 12920 this.name = this.definition.name.name;
12907 if (this.name.startsWith('this.')) { 12921 if (this.name.startsWith('this.')) {
12908 this.name = this.name.substring(5); 12922 this.name = this.name.substring(5);
12909 this.isInitializer = true; 12923 this.isInitializer = true;
12910 } 12924 }
12911 this.type = inType.resolveType(this.definition.type, false); 12925 this.type = inType.resolveType(this.definition.type, false);
12912 if ($notnull_bool(method.get$isStatic()) && $notnull_bool(this.type.get$hasTyp eParams())) { 12926 if ($notnull_bool(method.get$isStatic()) && $notnull_bool(this.type.get$hasTyp eParams())) {
12913 world.error('using type parameter in static context', this.definition.span); 12927 $globals.world.error('using type parameter in static context', this.definiti on.span);
12914 } 12928 }
12915 if (this.definition.value != null) { 12929 if (this.definition.value != null) {
12916 if ((this.definition.value instanceof NullExpression) && this.definition.val ue.span.start == this.definition.span.start) { 12930 if ((this.definition.value instanceof NullExpression) && this.definition.val ue.span.start == this.definition.span.start) {
12917 return; 12931 return;
12918 } 12932 }
12919 if ($notnull_bool(method.get$isAbstract())) { 12933 if ($notnull_bool(method.get$isAbstract())) {
12920 world.error('default value not allowed on abstract methods', this.definiti on.span); 12934 $globals.world.error('default value not allowed on abstract methods', this .definition.span);
12921 } 12935 }
12922 else if (method.name == '\$call' && $notnull_bool(method.get$definition().bo dy == null)) { 12936 else if (method.name == '\$call' && $notnull_bool(method.get$definition().bo dy == null)) {
12923 world.error('default value not allowed on function type', this.definition. span); 12937 $globals.world.error('default value not allowed on function type', this.de finition.span);
12924 } 12938 }
12925 } 12939 }
12926 else if ($notnull_bool(this.isInitializer) && !$notnull_bool(method.get$isCons tructor())) { 12940 else if ($notnull_bool(this.isInitializer) && !$notnull_bool(method.get$isCons tructor())) {
12927 world.error('initializer parameters only allowed on constructors', this.defi nition.span); 12941 $globals.world.error('initializer parameters only allowed on constructors', this.definition.span);
12928 } 12942 }
12929 } 12943 }
12930 Parameter.prototype.genValue = function(method, context) { 12944 Parameter.prototype.genValue = function(method, context) {
12931 var $0; 12945 var $0;
12932 if (this.definition.value == null || this.value != null) return; 12946 if (this.definition.value == null || this.value != null) return;
12933 if (context == null) { 12947 if (context == null) {
12934 context = new MethodGenerator(method, null); 12948 context = new MethodGenerator(method, null);
12935 } 12949 }
12936 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value()); 12950 this.value = (($0 = this.definition.value.visit(context)) && $0.is$Value());
12937 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse); 12951 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
13008 Member.prototype.get$prefersPropertySyntax = function() { 13022 Member.prototype.get$prefersPropertySyntax = function() {
13009 return true; 13023 return true;
13010 } 13024 }
13011 Member.prototype.get$requiresFieldSyntax = function() { 13025 Member.prototype.get$requiresFieldSyntax = function() {
13012 return false; 13026 return false;
13013 } 13027 }
13014 Member.prototype.get$isNative = function() { 13028 Member.prototype.get$isNative = function() {
13015 return false; 13029 return false;
13016 } 13030 }
13017 Member.prototype.get$constructorName = function() { 13031 Member.prototype.get$constructorName = function() {
13018 world.internalError('can not be a constructor', this.get$span()); 13032 $globals.world.internalError('can not be a constructor', this.get$span());
13019 } 13033 }
13020 Member.prototype.provideFieldSyntax = function() { 13034 Member.prototype.provideFieldSyntax = function() {
13021 13035
13022 } 13036 }
13023 Member.prototype.providePropertySyntax = function() { 13037 Member.prototype.providePropertySyntax = function() {
13024 13038
13025 } 13039 }
13026 Member.prototype.get$initDelegate = function() { 13040 Member.prototype.get$initDelegate = function() {
13027 world.internalError('cannot have initializers', this.get$span()); 13041 $globals.world.internalError('cannot have initializers', this.get$span());
13028 } 13042 }
13029 Member.prototype.set$initDelegate = function(ctor) { 13043 Member.prototype.set$initDelegate = function(ctor) {
13030 world.internalError('cannot have initializers', this.get$span()); 13044 $globals.world.internalError('cannot have initializers', this.get$span());
13031 } 13045 }
13032 Member.prototype.get$inferredResult = function() { 13046 Member.prototype.get$inferredResult = function() {
13033 var t = this.get$returnType(); 13047 var t = this.get$returnType();
13034 if ($notnull_bool(t.get$isBool()) && ($notnull_bool(this.get$library().get$isC ore()) || $notnull_bool(this.get$library().get$isCoreImpl()))) { 13048 if ($notnull_bool(t.get$isBool()) && ($notnull_bool(this.get$library().get$isC ore()) || $notnull_bool(this.get$library().get$isCoreImpl()))) {
13035 return world.nonNullBool; 13049 return $globals.world.nonNullBool;
13036 } 13050 }
13037 return (t && t.is$lang_Type()); 13051 return (t && t.is$lang_Type());
13038 } 13052 }
13039 Member.prototype.get$definition = function() { 13053 Member.prototype.get$definition = function() {
13040 return null; 13054 return null;
13041 } 13055 }
13042 Member.prototype.get$parameters = function() { 13056 Member.prototype.get$parameters = function() {
13043 return []; 13057 return [];
13044 } 13058 }
13045 Member.prototype.canInvoke = function(context, args) { 13059 Member.prototype.canInvoke = function(context, args) {
13046 return $notnull_bool(this.get$canGet()) && $notnull_bool(new Value(this.get$re turnType(), null, null, true).canInvoke(context, '\$call', args)); 13060 return $notnull_bool(this.get$canGet()) && $notnull_bool(new Value(this.get$re turnType(), null, null, true).canInvoke(context, '\$call', args));
13047 } 13061 }
13048 Member.prototype.invoke = function(context, node, target, args, isDynamic) { 13062 Member.prototype.invoke = function(context, node, target, args, isDynamic) {
13049 var $0; 13063 var $0;
13050 var newTarget = this._get(context, node, target, isDynamic); 13064 var newTarget = this._get(context, node, target, isDynamic);
13051 return (($0 = newTarget.invoke$5(context, '\$call', node, args, isDynamic)) && $0.is$Value()); 13065 return (($0 = newTarget.invoke$5(context, '\$call', node, args, isDynamic)) && $0.is$Value());
13052 } 13066 }
13053 Member.prototype.override = function(other) { 13067 Member.prototype.override = function(other) {
13054 if ($notnull_bool(this.get$isStatic())) { 13068 if ($notnull_bool(this.get$isStatic())) {
13055 world.error('static members can not hide parent members', this.get$span(), o ther.get$span()); 13069 $globals.world.error('static members can not hide parent members', this.get$ span(), other.get$span());
13056 return false; 13070 return false;
13057 } 13071 }
13058 else if ($notnull_bool(other.get$isStatic())) { 13072 else if ($notnull_bool(other.get$isStatic())) {
13059 world.error('can not override static member', this.get$span(), other.get$spa n()); 13073 $globals.world.error('can not override static member', this.get$span(), othe r.get$span());
13060 return false; 13074 return false;
13061 } 13075 }
13062 return true; 13076 return true;
13063 } 13077 }
13064 Member.prototype.get$generatedFactoryName = function() { 13078 Member.prototype.get$generatedFactoryName = function() {
13065 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 195, 12); 13079 $assert(this.get$isFactory(), "this.isFactory", "member.dart", 195, 12);
13066 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$'); 13080 var prefix = ('' + this.declaringType.get$jsname() + '.' + this.get$constructo rName() + '\$');
13067 if (this.name == '') { 13081 if (this.name == '') {
13068 return ('' + prefix + 'factory'); 13082 return ('' + prefix + 'factory');
13069 } 13083 }
13070 else { 13084 else {
13071 return ('' + prefix + '' + this.name + '\$factory'); 13085 return ('' + prefix + '' + this.name + '\$factory');
13072 } 13086 }
13073 } 13087 }
13074 Member.prototype.resolveType = function(node, isRequired) { 13088 Member.prototype.resolveType = function(node, isRequired) {
13075 var type = this.declaringType.resolveType(node, isRequired); 13089 var type = this.declaringType.resolveType(node, isRequired);
13076 if ($notnull_bool(this.get$isStatic()) && $notnull_bool(type.get$hasTypeParams ())) { 13090 if ($notnull_bool(this.get$isStatic()) && $notnull_bool(type.get$hasTypeParams ())) {
13077 world.error('using type parameter in static context', node.span); 13091 $globals.world.error('using type parameter in static context', node.span);
13078 } 13092 }
13079 return (type && type.is$lang_Type()); 13093 return (type && type.is$lang_Type());
13080 } 13094 }
13081 Member.prototype._get$3 = function($0, $1, $2) { 13095 Member.prototype._get$3 = function($0, $1, $2) {
13082 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value())); 13096 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()));
13083 }; 13097 };
13084 Member.prototype._set$4 = function($0, $1, $2, $3) { 13098 Member.prototype._set$4 = function($0, $1, $2, $3) {
13085 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value())); 13099 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()));
13086 }; 13100 };
13087 Member.prototype.canInvoke$2 = function($0, $1) { 13101 Member.prototype.canInvoke$2 = function($0, $1) {
(...skipping 26 matching lines...) Expand all
13114 $inherits(TypeMember, Member); 13128 $inherits(TypeMember, Member);
13115 TypeMember.prototype.is$TypeMember = function(){return this;}; 13129 TypeMember.prototype.is$TypeMember = function(){return this;};
13116 TypeMember.prototype.get$type = function() { return this.type; }; 13130 TypeMember.prototype.get$type = function() { return this.type; };
13117 TypeMember.prototype.get$span = function() { 13131 TypeMember.prototype.get$span = function() {
13118 return this.type.definition.span; 13132 return this.type.definition.span;
13119 } 13133 }
13120 TypeMember.prototype.get$isStatic = function() { 13134 TypeMember.prototype.get$isStatic = function() {
13121 return true; 13135 return true;
13122 } 13136 }
13123 TypeMember.prototype.get$returnType = function() { 13137 TypeMember.prototype.get$returnType = function() {
13124 return world.varType; 13138 return $globals.world.varType;
13125 } 13139 }
13126 TypeMember.prototype.canInvoke = function(context, args) { 13140 TypeMember.prototype.canInvoke = function(context, args) {
13127 return false; 13141 return false;
13128 } 13142 }
13129 TypeMember.prototype.get$canGet = function() { 13143 TypeMember.prototype.get$canGet = function() {
13130 return true; 13144 return true;
13131 } 13145 }
13132 TypeMember.prototype.get$canSet = function() { 13146 TypeMember.prototype.get$canSet = function() {
13133 return false; 13147 return false;
13134 } 13148 }
13135 TypeMember.prototype.resolve = function(inType) { 13149 TypeMember.prototype.resolve = function(inType) {
13136 13150
13137 } 13151 }
13138 TypeMember.prototype._get = function(context, node, target, isDynamic) { 13152 TypeMember.prototype._get = function(context, node, target, isDynamic) {
13139 var ret = new Value(this.type, this.type.get$jsname(), node.span, false); 13153 var ret = new Value(this.type, this.type.get$jsname(), node.span, false);
13140 ret.isType = true; 13154 ret.isType = true;
13141 return (ret && ret.is$Value()); 13155 return (ret && ret.is$Value());
13142 } 13156 }
13143 TypeMember.prototype._set = function(context, node, target, value, isDynamic) { 13157 TypeMember.prototype._set = function(context, node, target, value, isDynamic) {
13144 world.error('can not set type', node.span); 13158 $globals.world.error('can not set type', node.span);
13145 } 13159 }
13146 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) { 13160 TypeMember.prototype.invoke = function(context, node, target, args, isDynamic) {
13147 world.error('can not invoke type', node.span); 13161 $globals.world.error('can not invoke type', node.span);
13148 } 13162 }
13149 TypeMember.prototype._get$3 = function($0, $1, $2) { 13163 TypeMember.prototype._get$3 = function($0, $1, $2) {
13150 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 13164 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
13151 }; 13165 };
13152 TypeMember.prototype._set$4 = function($0, $1, $2, $3) { 13166 TypeMember.prototype._set$4 = function($0, $1, $2, $3) {
13153 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); 13167 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
13154 }; 13168 };
13155 TypeMember.prototype.canInvoke$2 = function($0, $1) { 13169 TypeMember.prototype.canInvoke$2 = function($0, $1) {
13156 return this.canInvoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$Arguments( ))); 13170 return this.canInvoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$Arguments( )));
13157 }; 13171 };
(...skipping 30 matching lines...) Expand all
13188 FieldMember.prototype.get$isFinal = function() { return this.isFinal; }; 13202 FieldMember.prototype.get$isFinal = function() { return this.isFinal; };
13189 FieldMember.prototype.set$isFinal = function(value) { return this.isFinal = valu e; }; 13203 FieldMember.prototype.set$isFinal = function(value) { return this.isFinal = valu e; };
13190 FieldMember.prototype.get$isNative = function() { return this.isNative; }; 13204 FieldMember.prototype.get$isNative = function() { return this.isNative; };
13191 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va lue; }; 13205 FieldMember.prototype.set$isNative = function(value) { return this.isNative = va lue; };
13192 FieldMember.prototype.override = function(other) { 13206 FieldMember.prototype.override = function(other) {
13193 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; 13207 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false;
13194 if ($notnull_bool(other.get$isProperty())) { 13208 if ($notnull_bool(other.get$isProperty())) {
13195 return true; 13209 return true;
13196 } 13210 }
13197 else { 13211 else {
13198 world.error('field can not override anything but property', this.get$span(), other.get$span()); 13212 $globals.world.error('field can not override anything but property', this.ge t$span(), other.get$span());
13199 return false; 13213 return false;
13200 } 13214 }
13201 } 13215 }
13202 FieldMember.prototype.get$prefersPropertySyntax = function() { 13216 FieldMember.prototype.get$prefersPropertySyntax = function() {
13203 return false; 13217 return false;
13204 } 13218 }
13205 FieldMember.prototype.get$requiresFieldSyntax = function() { 13219 FieldMember.prototype.get$requiresFieldSyntax = function() {
13206 return this.isNative; 13220 return this.isNative;
13207 } 13221 }
13208 FieldMember.prototype.provideFieldSyntax = function() { 13222 FieldMember.prototype.provideFieldSyntax = function() {
(...skipping 20 matching lines...) Expand all
13229 } 13243 }
13230 FieldMember.prototype.resolve = function(inType) { 13244 FieldMember.prototype.resolve = function(inType) {
13231 this.isStatic = this.declaringType.get$isTop(); 13245 this.isStatic = this.declaringType.get$isTop();
13232 this.isFinal = false; 13246 this.isFinal = false;
13233 if (this.definition.modifiers != null) { 13247 if (this.definition.modifiers != null) {
13234 var $list = this.definition.modifiers; 13248 var $list = this.definition.modifiers;
13235 for (var $i = 0;$i < $list.length; $i++) { 13249 for (var $i = 0;$i < $list.length; $i++) {
13236 var mod = $list.$index($i); 13250 var mod = $list.$index($i);
13237 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { 13251 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) {
13238 if ($notnull_bool(this.isStatic)) { 13252 if ($notnull_bool(this.isStatic)) {
13239 world.error('duplicate static modifier', mod.get$span()); 13253 $globals.world.error('duplicate static modifier', mod.get$span());
13240 } 13254 }
13241 this.isStatic = true; 13255 this.isStatic = true;
13242 } 13256 }
13243 else if ($notnull_bool($eq(mod.kind, 97/*TokenKind.FINAL*/))) { 13257 else if ($notnull_bool($eq(mod.kind, 97/*TokenKind.FINAL*/))) {
13244 if ($notnull_bool(this.isFinal)) { 13258 if ($notnull_bool(this.isFinal)) {
13245 world.error('duplicate final modifier', mod.get$span()); 13259 $globals.world.error('duplicate final modifier', mod.get$span());
13246 } 13260 }
13247 this.isFinal = true; 13261 this.isFinal = true;
13248 } 13262 }
13249 else { 13263 else {
13250 world.error(('' + mod + ' modifier not allowed on field'), mod.get$span( )); 13264 $globals.world.error(('' + mod + ' modifier not allowed on field'), mod. get$span());
13251 } 13265 }
13252 } 13266 }
13253 } 13267 }
13254 this.type = inType.resolveType(this.definition.type, false); 13268 this.type = inType.resolveType(this.definition.type, false);
13255 if ($notnull_bool(this.isStatic) && $notnull_bool(this.type.get$hasTypeParams( ))) { 13269 if ($notnull_bool(this.isStatic) && $notnull_bool(this.type.get$hasTypeParams( ))) {
13256 world.error('using type parameter in static context', this.definition.type.s pan); 13270 $globals.world.error('using type parameter in static context', this.definiti on.type.span);
13257 } 13271 }
13258 if ($notnull_bool(this.isStatic) && $notnull_bool(this.isFinal) && this.value == null) { 13272 if ($notnull_bool(this.isStatic) && $notnull_bool(this.isFinal) && this.value == null) {
13259 world.error('static final field is missing initializer', this.get$span()); 13273 $globals.world.error('static final field is missing initializer', this.get$s pan());
13260 } 13274 }
13261 this.get$library()._addMember(this); 13275 this.get$library()._addMember(this);
13262 } 13276 }
13263 FieldMember.prototype.computeValue = function() { 13277 FieldMember.prototype.computeValue = function() {
13264 var $0; 13278 var $0;
13265 if (this.value == null) return null; 13279 if (this.value == null) return null;
13266 if (this._computedValue == null) { 13280 if (this._computedValue == null) {
13267 if ($notnull_bool(this._computing)) { 13281 if ($notnull_bool(this._computing)) {
13268 world.error('circular reference', this.value.span); 13282 $globals.world.error('circular reference', this.value.span);
13269 return null; 13283 return null;
13270 } 13284 }
13271 this._computing = true; 13285 this._computing = true;
13272 var finalMethod = new MethodMember('final_context', this.declaringType, null ); 13286 var finalMethod = new MethodMember('final_context', this.declaringType, null );
13273 finalMethod.isStatic = true; 13287 finalMethod.isStatic = true;
13274 var finalGen = new MethodGenerator(finalMethod, null); 13288 var finalGen = new MethodGenerator(finalMethod, null);
13275 this._computedValue = (($0 = this.value.visit((finalGen && finalGen.is$TreeV isitor()))) && $0.is$Value()); 13289 this._computedValue = (($0 = this.value.visit((finalGen && finalGen.is$TreeV isitor()))) && $0.is$Value());
13276 if (!$notnull_bool(this._computedValue.get$isConst())) { 13290 if (!$notnull_bool(this._computedValue.get$isConst())) {
13277 if ($notnull_bool(this.isStatic)) { 13291 if ($notnull_bool(this.isStatic)) {
13278 world.error('non constant static field must be initialized in functions' , this.value.span); 13292 $globals.world.error('non constant static field must be initialized in f unctions', this.value.span);
13279 } 13293 }
13280 else { 13294 else {
13281 world.error('non constant field must be initialized in constructor', thi s.value.span); 13295 $globals.world.error('non constant field must be initialized in construc tor', this.value.span);
13282 } 13296 }
13283 } 13297 }
13284 if ($notnull_bool(this.isStatic)) { 13298 if ($notnull_bool(this.isStatic)) {
13285 this._computedValue = world.gen.globalForStaticField(this, this._computedV alue, [this._computedValue]); 13299 this._computedValue = $globals.world.gen.globalForStaticField(this, this._ computedValue, [this._computedValue]);
13286 } 13300 }
13287 this._computing = false; 13301 this._computing = false;
13288 } 13302 }
13289 return this._computedValue; 13303 return this._computedValue;
13290 } 13304 }
13291 FieldMember.prototype._get = function(context, node, target, isDynamic) { 13305 FieldMember.prototype._get = function(context, node, target, isDynamic) {
13292 var $0; 13306 var $0;
13293 if (!$notnull_bool(isDynamic)) { 13307 if (!$notnull_bool(isDynamic)) {
13294 this.declaringType.markUsed(); 13308 this.declaringType.markUsed();
13295 } 13309 }
13296 if ($notnull_bool(this.isStatic)) { 13310 if ($notnull_bool(this.isStatic)) {
13297 var cv = this.computeValue(); 13311 var cv = this.computeValue();
13298 if ($notnull_bool(this.isFinal)) { 13312 if ($notnull_bool(this.isFinal)) {
13299 return (cv && cv.is$Value()); 13313 return (cv && cv.is$Value());
13300 } 13314 }
13315 $globals.world.gen.hasStatics = true;
13301 if ($notnull_bool(this.declaringType.get$isTop())) { 13316 if ($notnull_bool(this.declaringType.get$isTop())) {
13302 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, true ); 13317 if ($eq(this.declaringType.get$library(), $globals.world.get$dom())) {
13318 return new Value(this.type, ('' + this.get$jsname() + ''), node.span, tr ue);
13319 }
13320 else {
13321 return new Value(this.type, ('\$globals.' + this.get$jsname() + ''), nod e.span, true);
13322 }
13323 }
13324 else if ($notnull_bool(this.declaringType.get$isNative())) {
13325 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true);
13303 } 13326 }
13304 else { 13327 else {
13305 return new Value(this.type, ('' + this.declaringType.get$jsname() + '.' + this.get$jsname() + ''), node.span, true); 13328 return new Value(this.type, ('\$globals.' + this.declaringType.get$jsname( ) + '_' + this.get$jsname() + ''), node.span, true);
13306 } 13329 }
13307 } 13330 }
13308 else if ($notnull_bool(target.get$isConst()) && $notnull_bool(this.isFinal)) { 13331 else if ($notnull_bool(target.get$isConst()) && $notnull_bool(this.isFinal)) {
13309 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().exp : target; 13332 var constTarget = (target instanceof GlobalValue) ? target.get$dynamic().exp : target;
13310 if ((constTarget instanceof ConstObjectValue)) { 13333 if ((constTarget instanceof ConstObjectValue)) {
13311 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value()); 13334 return (($0 = constTarget.fields.$index(this.name)) && $0.is$Value());
13312 } 13335 }
13313 else if ($notnull_bool($eq(constTarget.type, world.stringType)) && this.name == 'length') { 13336 else if ($notnull_bool($eq(constTarget.type, $globals.world.stringType)) && this.name == 'length') {
13314 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, true); 13337 return new Value(this.type, ('' + constTarget.get$actualValue().length + ' '), node.span, true);
13315 } 13338 }
13316 } 13339 }
13317 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true); 13340 return new Value(this.type, ('' + target.code + '.' + this.get$jsname() + ''), node.span, true);
13318 } 13341 }
13319 FieldMember.prototype._set = function(context, node, target, value, isDynamic) { 13342 FieldMember.prototype._set = function(context, node, target, value, isDynamic) {
13320 var lhs = this._get(context, node, target, isDynamic); 13343 var lhs = this._get(context, node, target, isDynamic);
13321 value = value.convertTo(context, this.type, node, isDynamic); 13344 value = value.convertTo(context, this.type, node, isDynamic);
13322 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp an, true); 13345 return new Value(this.type, ('' + lhs.code + ' = ' + value.code + ''), node.sp an, true);
13323 } 13346 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
13379 return this.getter == null ? this.setter.returnType : this.getter.returnType; 13402 return this.getter == null ? this.setter.returnType : this.getter.returnType;
13380 } 13403 }
13381 PropertyMember.prototype.override = function(other) { 13404 PropertyMember.prototype.override = function(other) {
13382 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; 13405 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false;
13383 if ($notnull_bool(other.get$isProperty()) || $notnull_bool(other.get$isField() )) { 13406 if ($notnull_bool(other.get$isProperty()) || $notnull_bool(other.get$isField() )) {
13384 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other); 13407 if ($notnull_bool(other.get$isProperty())) this.addFromParent(other);
13385 else this._overriddenField = other; 13408 else this._overriddenField = other;
13386 return true; 13409 return true;
13387 } 13410 }
13388 else { 13411 else {
13389 world.error('property can only override field or property', this.get$span(), other.get$span()); 13412 $globals.world.error('property can only override field or property', this.ge t$span(), other.get$span());
13390 return false; 13413 return false;
13391 } 13414 }
13392 } 13415 }
13393 PropertyMember.prototype._get = function(context, node, target, isDynamic) { 13416 PropertyMember.prototype._get = function(context, node, target, isDynamic) {
13394 if (this.getter == null) { 13417 if (this.getter == null) {
13395 if (this._overriddenField != null) { 13418 if (this._overriddenField != null) {
13396 return this._overriddenField._get(context, node, target, isDynamic); 13419 return this._overriddenField._get(context, node, target, isDynamic);
13397 } 13420 }
13398 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node); 13421 return target.invokeNoSuchMethod(context, ('get:' + this.name + ''), node);
13399 } 13422 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
13478 ConcreteMember.prototype.get$isConst = function() { 13501 ConcreteMember.prototype.get$isConst = function() {
13479 return this.baseMember.get$isConst(); 13502 return this.baseMember.get$isConst();
13480 } 13503 }
13481 ConcreteMember.prototype.get$isFactory = function() { 13504 ConcreteMember.prototype.get$isFactory = function() {
13482 return this.baseMember.get$isFactory(); 13505 return this.baseMember.get$isFactory();
13483 } 13506 }
13484 ConcreteMember.prototype.get$jsname = function() { 13507 ConcreteMember.prototype.get$jsname = function() {
13485 return this.baseMember.get$jsname(); 13508 return this.baseMember.get$jsname();
13486 } 13509 }
13487 ConcreteMember.prototype.set$jsname = function(name) { 13510 ConcreteMember.prototype.set$jsname = function(name) {
13488 return world.internalError('bad set of jsname on ConcreteMember'); 13511 return $globals.world.internalError('bad set of jsname on ConcreteMember');
13489 } 13512 }
13490 ConcreteMember.prototype.get$canGet = function() { 13513 ConcreteMember.prototype.get$canGet = function() {
13491 return this.baseMember.get$canGet(); 13514 return this.baseMember.get$canGet();
13492 } 13515 }
13493 ConcreteMember.prototype.get$canSet = function() { 13516 ConcreteMember.prototype.get$canSet = function() {
13494 return this.baseMember.get$canSet(); 13517 return this.baseMember.get$canSet();
13495 } 13518 }
13496 ConcreteMember.prototype.canInvoke = function(context, args) { 13519 ConcreteMember.prototype.canInvoke = function(context, args) {
13497 return this.baseMember.canInvoke(context, args); 13520 return this.baseMember.canInvoke(context, args);
13498 } 13521 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
13638 MethodMember.prototype.get$constructorName = function() { 13661 MethodMember.prototype.get$constructorName = function() {
13639 var $0; 13662 var $0;
13640 var returnType = (($0 = this.definition.returnType) && $0.is$NameTypeReference ()); 13663 var returnType = (($0 = this.definition.returnType) && $0.is$NameTypeReference ());
13641 if (returnType == null) return ''; 13664 if (returnType == null) return '';
13642 if (returnType.names != null) { 13665 if (returnType.names != null) {
13643 return $assert_String(returnType.names.$index(0).get$name()); 13666 return $assert_String(returnType.names.$index(0).get$name());
13644 } 13667 }
13645 else if (returnType.name != null) { 13668 else if (returnType.name != null) {
13646 return returnType.name.name; 13669 return returnType.name.name;
13647 } 13670 }
13648 world.internalError('no valid constructor name', this.definition.span); 13671 $globals.world.internalError('no valid constructor name', this.definition.span );
13649 } 13672 }
13650 MethodMember.prototype.get$functionType = function() { 13673 MethodMember.prototype.get$functionType = function() {
13651 if (this._functionType == null) { 13674 if (this._functionType == null) {
13652 this._functionType = this.get$library().getOrAddFunctionType(this.name, this .definition, this.declaringType); 13675 this._functionType = this.get$library().getOrAddFunctionType(this.name, this .definition, this.declaringType);
13653 if (this.parameters == null) { 13676 if (this.parameters == null) {
13654 this.resolve(this.declaringType); 13677 this.resolve(this.declaringType);
13655 } 13678 }
13656 } 13679 }
13657 return this._functionType; 13680 return this._functionType;
13658 } 13681 }
13659 MethodMember.prototype.override = function(other) { 13682 MethodMember.prototype.override = function(other) {
13660 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false; 13683 if (!$notnull_bool(Member.prototype.override.call(this, other))) return false;
13661 if ($notnull_bool(other.get$isMethod())) { 13684 if ($notnull_bool(other.get$isMethod())) {
13662 return true; 13685 return true;
13663 } 13686 }
13664 else { 13687 else {
13665 world.error('method can only override methods', this.get$span(), other.get$s pan()); 13688 $globals.world.error('method can only override methods', this.get$span(), ot her.get$span());
13666 return false; 13689 return false;
13667 } 13690 }
13668 } 13691 }
13669 MethodMember.prototype.canInvoke = function(context, args) { 13692 MethodMember.prototype.canInvoke = function(context, args) {
13670 var bareCount = args.get$bareCount(); 13693 var bareCount = args.get$bareCount();
13671 if (bareCount > this.parameters.length) return false; 13694 if (bareCount > this.parameters.length) return false;
13672 if (bareCount == this.parameters.length) { 13695 if (bareCount == this.parameters.length) {
13673 if (bareCount != args.get$length()) return false; 13696 if (bareCount != args.get$length()) return false;
13674 } 13697 }
13675 else { 13698 else {
(...skipping 23 matching lines...) Expand all
13699 MethodMember.prototype.get$requiresFieldSyntax = function() { 13722 MethodMember.prototype.get$requiresFieldSyntax = function() {
13700 return false; 13723 return false;
13701 } 13724 }
13702 MethodMember.prototype.provideFieldSyntax = function() { 13725 MethodMember.prototype.provideFieldSyntax = function() {
13703 this._provideFieldSyntax = true; 13726 this._provideFieldSyntax = true;
13704 } 13727 }
13705 MethodMember.prototype.providePropertySyntax = function() { 13728 MethodMember.prototype.providePropertySyntax = function() {
13706 this._providePropertySyntax = true; 13729 this._providePropertySyntax = true;
13707 } 13730 }
13708 MethodMember.prototype._set = function(context, Node, target, value, isDynamic) { 13731 MethodMember.prototype._set = function(context, Node, target, value, isDynamic) {
13709 world.error('can not set method', this.definition.span); 13732 $globals.world.error('can not set method', this.definition.span);
13710 } 13733 }
13711 MethodMember.prototype._get = function(context, node, target, isDynamic) { 13734 MethodMember.prototype._get = function(context, node, target, isDynamic) {
13712 this.declaringType.genMethod(this); 13735 this.declaringType.genMethod(this);
13713 this._provideOptionalParamInfo = true; 13736 this._provideOptionalParamInfo = true;
13714 if ($notnull_bool(this.isStatic)) { 13737 if ($notnull_bool(this.isStatic)) {
13738 this.declaringType.markUsed();
13715 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d eclaringType.get$jsname() + '.'); 13739 var type = $notnull_bool(this.declaringType.get$isTop()) ? '' : ('' + this.d eclaringType.get$jsname() + '.');
13716 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), node.span, true); 13740 return new Value(this.get$functionType(), ('' + type + '' + this.get$jsname( ) + ''), node.span, true);
13717 } 13741 }
13718 this._providePropertySyntax = true; 13742 this._providePropertySyntax = true;
13719 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true); 13743 return new Value(this.get$functionType(), ('' + target.code + '.get\$' + this. get$jsname() + '()'), node.span, true);
13720 } 13744 }
13721 MethodMember.prototype.namesInOrder = function(args) { 13745 MethodMember.prototype.namesInOrder = function(args) {
13722 if (!$notnull_bool(args.get$hasNames())) return true; 13746 if (!$notnull_bool(args.get$hasNames())) return true;
13723 var lastParameter = null; 13747 var lastParameter = null;
13724 for (var i = args.get$bareCount(); 13748 for (var i = args.get$bareCount();
(...skipping 27 matching lines...) Expand all
13752 } 13776 }
13753 } 13777 }
13754 } 13778 }
13755 return true; 13779 return true;
13756 } 13780 }
13757 MethodMember._argCountMsg = function(actual, expected, atLeast) { 13781 MethodMember._argCountMsg = function(actual, expected, atLeast) {
13758 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast) ? "at least " : "") + '' + expected + ' but found ' + actual + ''); 13782 return 'wrong number of arguments, expected ' + ('' + ($notnull_bool(atLeast) ? "at least " : "") + '' + expected + ' but found ' + actual + '');
13759 } 13783 }
13760 MethodMember.prototype._argError = function(context, node, target, args, msg) { 13784 MethodMember.prototype._argError = function(context, node, target, args, msg) {
13761 if ($notnull_bool(this.isStatic) || $notnull_bool(this.get$isConstructor())) { 13785 if ($notnull_bool(this.isStatic) || $notnull_bool(this.get$isConstructor())) {
13762 world.error(msg, node.span); 13786 $globals.world.error(msg, node.span);
13763 } 13787 }
13764 else { 13788 else {
13765 world.warning(msg, node.span); 13789 $globals.world.warning(msg, node.span);
13766 } 13790 }
13767 return target.invokeNoSuchMethod(context, this.name, node, args); 13791 return target.invokeNoSuchMethod(context, this.name, node, args);
13768 } 13792 }
13769 MethodMember.prototype.genParameterValues = function() { 13793 MethodMember.prototype.genParameterValues = function() {
13770 var $list = this.parameters; 13794 var $list = this.parameters;
13771 for (var $i = 0;$i < $list.length; $i++) { 13795 for (var $i = 0;$i < $list.length; $i++) {
13772 var p = $list.$index($i); 13796 var p = $list.$index($i);
13773 p.genValue$2(this, this.generator); 13797 p.genValue$2(this, this.generator);
13774 } 13798 }
13775 } 13799 }
13776 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) { 13800 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) {
13777 if (this.parameters == null) { 13801 if (this.parameters == null) {
13778 world.info(('surprised to need to resolve: ' + this.declaringType.name + '.' + this.name + '')); 13802 $globals.world.info(('surprised to need to resolve: ' + this.declaringType.n ame + '.' + this.name + ''));
13779 this.resolve(this.declaringType); 13803 this.resolve(this.declaringType);
13780 } 13804 }
13781 this.declaringType.genMethod(this); 13805 this.declaringType.genMethod(this);
13782 if ($notnull_bool(this.isStatic) || $notnull_bool(this.isFactory)) { 13806 if ($notnull_bool(this.isStatic) || $notnull_bool(this.isFactory)) {
13783 this.declaringType.markUsed(); 13807 this.declaringType.markUsed();
13784 } 13808 }
13785 if ($notnull_bool(this.get$isNative()) && this.returnType != null) this.return Type.markUsed(); 13809 if ($notnull_bool(this.get$isNative()) && this.returnType != null) this.return Type.markUsed();
13786 if (!$notnull_bool(this.namesInOrder(args))) { 13810 if (!$notnull_bool(this.namesInOrder(args))) {
13787 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s); 13811 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s);
13788 } 13812 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
13837 } 13861 }
13838 seen.add$1(name); 13862 seen.add$1(name);
13839 var p = this.indexOfParameter($assert_String(name)); 13863 var p = this.indexOfParameter($assert_String(name));
13840 if (p < 0) { 13864 if (p < 0) {
13841 return this._argError(context, node, target, args, ('method does not h ave optional parameter "' + name + '"')); 13865 return this._argError(context, node, target, args, ('method does not h ave optional parameter "' + name + '"'));
13842 } 13866 }
13843 else if (p < bareCount) { 13867 else if (p < bareCount) {
13844 return this._argError(context, node, target, args, ('argument "' + nam e + '" passed as positional and named')); 13868 return this._argError(context, node, target, args, ('argument "' + nam e + '" passed as positional and named'));
13845 } 13869 }
13846 } 13870 }
13847 world.internalError(('wrong named arguments calling ' + this.name + ''), n ode.span); 13871 $globals.world.internalError(('wrong named arguments calling ' + this.name + ''), node.span);
13848 } 13872 }
13849 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value())); 13873 Arguments.removeTrailingNulls((argsCode && argsCode.is$List$Value()));
13850 } 13874 }
13851 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); 13875 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', ');
13852 if ($notnull_bool(this.get$isConstructor())) { 13876 if ($notnull_bool(this.get$isConstructor())) {
13853 return this._invokeConstructor(context, node, target, args, argsString); 13877 return this._invokeConstructor(context, node, target, args, argsString);
13854 } 13878 }
13855 if (target != null && $notnull_bool(target.isSuper)) { 13879 if (target != null && $notnull_bool(target.isSuper)) {
13856 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s pan, true); 13880 return new Value(this.get$inferredResult(), ('' + this.declaringType.get$jsn ame() + '.prototype.' + this.get$jsname() + '.call(' + argsString + ')'), node.s pan, true);
13857 } 13881 }
(...skipping 18 matching lines...) Expand all
13876 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) { 13900 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) {
13877 code = ('' + target.get$dynamic().values.length + ''); 13901 code = ('' + target.get$dynamic().values.length + '');
13878 } 13902 }
13879 } 13903 }
13880 else if (this.name == 'isEmpty') { 13904 else if (this.name == 'isEmpty') {
13881 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) { 13905 if ((target instanceof ConstListValue) || (target instanceof ConstMapValue )) {
13882 code = ('' + target.get$dynamic().values.isEmpty$0() + ''); 13906 code = ('' + target.get$dynamic().values.isEmpty$0() + '');
13883 } 13907 }
13884 } 13908 }
13885 } 13909 }
13886 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), worl d.get$dom())) { 13910 if (this.name == 'get\$typeName' && $eq(this.declaringType.get$library(), $glo bals.world.get$dom())) {
13887 world.gen.corejs.useTypeNameOf = true; 13911 $globals.world.gen.corejs.useTypeNameOf = true;
13888 } 13912 }
13889 return new Value(this.get$inferredResult(), code, node.span, true); 13913 return new Value(this.get$inferredResult(), code, node.span, true);
13890 } 13914 }
13891 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) { 13915 MethodMember.prototype._invokeConstructor = function(context, node, target, args , argsString) {
13892 this.declaringType.markUsed(); 13916 this.declaringType.markUsed();
13893 if (target != null) { 13917 if (target != null) {
13894 var code = (this.get$constructorName() != '') ? ('' + this.declaringType.get $jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + argsString + ')' ) : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')'); 13918 var code = (this.get$constructorName() != '') ? ('' + this.declaringType.get $jsname() + '.' + this.get$constructorName() + '\$ctor.call(' + argsString + ')' ) : ('' + this.declaringType.get$jsname() + '.call(' + argsString + ')');
13895 return new Value(this.declaringType, code, node.span, true); 13919 return new Value(this.declaringType, code, node.span, true);
13896 } 13920 }
13897 else { 13921 else {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
13971 } 13995 }
13972 this.generator._popBlock(); 13996 this.generator._popBlock();
13973 } 13997 }
13974 var $list = this.declaringType.get$members().getValues(); 13998 var $list = this.declaringType.get$members().getValues();
13975 for (var $i = this.declaringType.get$members().getValues().iterator$0(); $i.ha sNext$0(); ) { 13999 for (var $i = this.declaringType.get$members().getValues().iterator$0(); $i.ha sNext$0(); ) {
13976 var f = $i.next$0(); 14000 var f = $i.next$0();
13977 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic()) && $notnu ll_bool($ne(f.get$value(), null)) && !fields.containsKey(f.get$name())) { 14001 if ((f instanceof FieldMember) && !$notnull_bool(f.get$isStatic()) && $notnu ll_bool($ne(f.get$value(), null)) && !fields.containsKey(f.get$name())) {
13978 fields.$setindex(f.get$name(), f.computeValue$0()); 14002 fields.$setindex(f.get$name(), f.computeValue$0());
13979 } 14003 }
13980 } 14004 }
13981 return world.gen.globalForConst(ConstObjectValue.ConstObjectValue$factory(this .declaringType, fields, code, node.span), args.values); 14005 return $globals.world.gen.globalForConst(ConstObjectValue.ConstObjectValue$fac tory(this.declaringType, fields, code, node.span), args.values);
13982 } 14006 }
13983 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar gsCode, isDynamic) { 14007 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar gsCode, isDynamic) {
13984 var allConst = $notnull_bool(target.get$isConst()) && args.values.every((funct ion (arg) { 14008 var allConst = $notnull_bool(target.get$isConst()) && args.values.every((funct ion (arg) {
13985 return arg.get$isConst(); 14009 return arg.get$isConst();
13986 }) 14010 })
13987 ); 14011 );
13988 if ($notnull_bool(this.declaringType.get$isNum())) { 14012 if ($notnull_bool(this.declaringType.get$isNum())) {
13989 if (!$notnull_bool(allConst)) { 14013 if (!$notnull_bool(allConst)) {
13990 var code; 14014 var code;
13991 if (this.name == '\$negate') { 14015 if (this.name == '\$negate') {
13992 code = ('-' + target.code + ''); 14016 code = ('-' + target.code + '');
13993 } 14017 }
13994 else if (this.name == '\$bit_not') { 14018 else if (this.name == '\$bit_not') {
13995 code = ('~' + target.code + ''); 14019 code = ('~' + target.code + '');
13996 } 14020 }
13997 else if (this.name == '\$truncdiv' || this.name == '\$mod') { 14021 else if (this.name == '\$truncdiv' || this.name == '\$mod') {
13998 world.gen.corejs.useOperator(this.name); 14022 $globals.world.gen.corejs.useOperator(this.name);
13999 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')'); 14023 code = ('' + this.name + '(' + target.code + ', ' + argsCode.$index(0) + ')');
14000 } 14024 }
14001 else { 14025 else {
14002 var op = TokenKind.rawOperatorFromMethod(this.name); 14026 var op = TokenKind.rawOperatorFromMethod(this.name);
14003 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''); 14027 code = ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + '');
14004 } 14028 }
14005 return new Value(this.get$inferredResult(), code, node.span, true); 14029 return new Value(this.get$inferredResult(), code, node.span, true);
14006 } 14030 }
14007 else { 14031 else {
14008 var value; 14032 var value;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
14125 else if (this.name == '\$add') { 14149 else if (this.name == '\$add') {
14126 if ($notnull_bool(allConst)) { 14150 if ($notnull_bool(allConst)) {
14127 var val0 = target.get$dynamic().get$actualValue(); 14151 var val0 = target.get$dynamic().get$actualValue();
14128 val0 = val0.substring$2(1, val0.length - 1); 14152 val0 = val0.substring$2(1, val0.length - 1);
14129 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); 14153 var val1 = args.values.$index(0).get$dynamic().get$actualValue();
14130 if ($notnull_bool(args.values.$index(0).type.get$isString())) { 14154 if ($notnull_bool(args.values.$index(0).type.get$isString())) {
14131 val1 = val1.substring$2(1, val1.length - 1); 14155 val1 = val1.substring$2(1, val1.length - 1);
14132 } 14156 }
14133 var value = ('' + val0 + '' + val1 + ''); 14157 var value = ('' + val0 + '' + val1 + '');
14134 value = '"' + value.replaceAll$2('"', '\\"') + '"'; 14158 value = '"' + value.replaceAll$2('"', '\\"') + '"';
14135 return EvaluatedValue.EvaluatedValue$factory(world.stringType, value, $a ssert_String(value), node.span); 14159 return EvaluatedValue.EvaluatedValue$factory($globals.world.stringType, value, $assert_String(value), node.span);
14136 } 14160 }
14137 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY()); 14161 args.values.$index(0).invoke$4(context, 'toString', node, Arguments.get$EM PTY());
14138 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, true); 14162 return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode. $index(0) + ''), node.span, true);
14139 } 14163 }
14140 } 14164 }
14141 else if ($notnull_bool(this.declaringType.get$isNativeType())) { 14165 else if ($notnull_bool(this.declaringType.get$isNativeType())) {
14142 if (this.name == '\$index') { 14166 if (this.name == '\$index') {
14143 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + ']'), node.span, true); 14167 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + ']'), node.span, true);
14144 } 14168 }
14145 else if (this.name == '\$setindex') { 14169 else if (this.name == '\$setindex') {
14146 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + '] = ' + argsCode.$index(1) + ''), node.span, true); 14170 return new Value(this.returnType, ('' + target.code + '[' + argsCode.$inde x(0) + '] = ' + argsCode.$index(1) + ''), node.span, true);
14147 } 14171 }
14148 } 14172 }
14149 if (this.name == '\$eq' || this.name == '\$ne') { 14173 if (this.name == '\$eq' || this.name == '\$ne') {
14150 var op = this.name == '\$eq' ? '==' : '!='; 14174 var op = this.name == '\$eq' ? '==' : '!=';
14151 if (this.name == '\$ne') { 14175 if (this.name == '\$ne') {
14152 target.invoke(context, '\$eq', node, args, isDynamic); 14176 target.invoke(context, '\$eq', node, args, isDynamic);
14153 } 14177 }
14154 if ($notnull_bool(allConst)) { 14178 if ($notnull_bool(allConst)) {
14155 var val0 = target.get$dynamic().get$actualValue(); 14179 var val0 = target.get$dynamic().get$actualValue();
14156 var val1 = args.values.$index(0).get$dynamic().get$actualValue(); 14180 var val1 = args.values.$index(0).get$dynamic().get$actualValue();
14157 var newVal = this.name == '\$eq' ? $eq(val0, val1) : $ne(val0, val1); 14181 var newVal = this.name == '\$eq' ? $eq(val0, val1) : $ne(val0, val1);
14158 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, newVal, (" " + newVal + ""), node.span); 14182 return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, n ewVal, ("" + newVal + ""), node.span);
14159 } 14183 }
14160 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) { 14184 if ($notnull_bool($eq(argsCode.$index(0), 'null'))) {
14161 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op + ' null'), node.span, true); 14185 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op + ' null'), node.span, true);
14162 } 14186 }
14163 else if ($notnull_bool(target.type.get$isNum()) || $notnull_bool(target.type .get$isString())) { 14187 else if ($notnull_bool(target.type.get$isNum()) || $notnull_bool(target.type .get$isString())) {
14164 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''), node.span, true); 14188 return new Value(this.get$inferredResult(), ('' + target.code + ' ' + op + ' ' + argsCode.$index(0) + ''), node.span, true);
14165 } 14189 }
14166 world.gen.corejs.useOperator(this.name); 14190 $globals.world.gen.corejs.useOperator(this.name);
14167 return new Value(this.get$inferredResult(), ('' + this.name + '(' + target.c ode + ', ' + argsCode.$index(0) + ')'), node.span, true); 14191 return new Value(this.get$inferredResult(), ('' + this.name + '(' + target.c ode + ', ' + argsCode.$index(0) + ')'), node.span, true);
14168 } 14192 }
14169 if ($notnull_bool(this.get$isCallMethod())) { 14193 if ($notnull_bool(this.get$isCallMethod())) {
14170 this.declaringType.markUsed(); 14194 this.declaringType.markUsed();
14171 return new Value(this.get$inferredResult(), ('' + target.code + '(' + String s.join((argsCode && argsCode.is$List$String()), ", ") + ')'), node.span, true); 14195 return new Value(this.get$inferredResult(), ('' + target.code + '(' + String s.join((argsCode && argsCode.is$List$String()), ", ") + ')'), node.span, true);
14172 } 14196 }
14173 if (this.name == '\$index') { 14197 if (this.name == '\$index') {
14174 world.gen.corejs.useIndex = true; 14198 $globals.world.gen.corejs.useIndex = true;
14175 } 14199 }
14176 else if (this.name == '\$setindex') { 14200 else if (this.name == '\$setindex') {
14177 world.gen.corejs.useSetIndex = true; 14201 $globals.world.gen.corejs.useSetIndex = true;
14178 } 14202 }
14179 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', '); 14203 var argsString = Strings.join((argsCode && argsCode.is$List$String()), ', ');
14180 return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get $jsname() + '(' + argsString + ')'), node.span, true); 14204 return new Value(this.get$inferredResult(), ('' + target.code + '.' + this.get $jsname() + '(' + argsString + ')'), node.span, true);
14181 } 14205 }
14182 MethodMember.prototype.resolve = function(inType) { 14206 MethodMember.prototype.resolve = function(inType) {
14183 this.isStatic = inType.get$isTop(); 14207 this.isStatic = inType.get$isTop();
14184 this.isConst = false; 14208 this.isConst = false;
14185 this.isFactory = false; 14209 this.isFactory = false;
14186 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass()); 14210 this.isAbstract = !$notnull_bool(this.declaringType.get$isClass());
14187 if (this.definition.modifiers != null) { 14211 if (this.definition.modifiers != null) {
14188 var $list = this.definition.modifiers; 14212 var $list = this.definition.modifiers;
14189 for (var $i = 0;$i < $list.length; $i++) { 14213 for (var $i = 0;$i < $list.length; $i++) {
14190 var mod = $list.$index($i); 14214 var mod = $list.$index($i);
14191 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) { 14215 if ($notnull_bool($eq(mod.kind, 86/*TokenKind.STATIC*/))) {
14192 if ($notnull_bool(this.isStatic)) { 14216 if ($notnull_bool(this.isStatic)) {
14193 world.error('duplicate static modifier', mod.get$span()); 14217 $globals.world.error('duplicate static modifier', mod.get$span());
14194 } 14218 }
14195 this.isStatic = true; 14219 this.isStatic = true;
14196 } 14220 }
14197 else if ($notnull_bool(this.get$isConstructor()) && $notnull_bool($eq(mod. kind, 91/*TokenKind.CONST*/))) { 14221 else if ($notnull_bool(this.get$isConstructor()) && $notnull_bool($eq(mod. kind, 91/*TokenKind.CONST*/))) {
14198 if ($notnull_bool(this.isConst)) { 14222 if ($notnull_bool(this.isConst)) {
14199 world.error('duplicate const modifier', mod.get$span()); 14223 $globals.world.error('duplicate const modifier', mod.get$span());
14200 } 14224 }
14201 this.isConst = true; 14225 this.isConst = true;
14202 } 14226 }
14203 else if ($notnull_bool($eq(mod.kind, 75/*TokenKind.FACTORY*/))) { 14227 else if ($notnull_bool($eq(mod.kind, 75/*TokenKind.FACTORY*/))) {
14204 if ($notnull_bool(this.isFactory)) { 14228 if ($notnull_bool(this.isFactory)) {
14205 world.error('duplicate factory modifier', mod.get$span()); 14229 $globals.world.error('duplicate factory modifier', mod.get$span());
14206 } 14230 }
14207 this.isFactory = true; 14231 this.isFactory = true;
14208 } 14232 }
14209 else if ($notnull_bool($eq(mod.kind, 71/*TokenKind.ABSTRACT*/))) { 14233 else if ($notnull_bool($eq(mod.kind, 71/*TokenKind.ABSTRACT*/))) {
14210 if ($notnull_bool(this.isAbstract)) { 14234 if ($notnull_bool(this.isAbstract)) {
14211 if ($notnull_bool(this.declaringType.get$isClass())) { 14235 if ($notnull_bool(this.declaringType.get$isClass())) {
14212 world.error('duplicate abstract modifier', mod.get$span()); 14236 $globals.world.error('duplicate abstract modifier', mod.get$span());
14213 } 14237 }
14214 else { 14238 else {
14215 world.error('abstract modifier not allowed on interface members', mo d.get$span()); 14239 $globals.world.error('abstract modifier not allowed on interface mem bers', mod.get$span());
14216 } 14240 }
14217 } 14241 }
14218 this.isAbstract = true; 14242 this.isAbstract = true;
14219 } 14243 }
14220 else { 14244 else {
14221 world.error(('' + mod + ' modifier not allowed on method'), mod.get$span ()); 14245 $globals.world.error(('' + mod + ' modifier not allowed on method'), mod .get$span());
14222 } 14246 }
14223 } 14247 }
14224 } 14248 }
14225 if ($notnull_bool(this.isFactory)) { 14249 if ($notnull_bool(this.isFactory)) {
14226 this.isStatic = true; 14250 this.isStatic = true;
14227 } 14251 }
14228 if ($notnull_bool(this.get$isOperator()) && $notnull_bool(this.isStatic) && !$ notnull_bool(this.get$isCallMethod())) { 14252 if ($notnull_bool(this.get$isOperator()) && $notnull_bool(this.isStatic) && !$ notnull_bool(this.get$isCallMethod())) {
14229 world.error(('operator method may not be static "' + this.name + '"'), this. get$span()); 14253 $globals.world.error(('operator method may not be static "' + this.name + '" '), this.get$span());
14230 } 14254 }
14231 if ($notnull_bool(this.isAbstract)) { 14255 if ($notnull_bool(this.isAbstract)) {
14232 if (this.definition.body != null && !(this.declaringType.get$definition() in stanceof FunctionTypeDefinition)) { 14256 if (this.definition.body != null && !(this.declaringType.get$definition() in stanceof FunctionTypeDefinition)) {
14233 world.error('abstract method can not have a body', this.get$span()); 14257 $globals.world.error('abstract method can not have a body', this.get$span( ));
14234 } 14258 }
14235 if ($notnull_bool(this.isStatic) && !(this.declaringType.get$definition() in stanceof FunctionTypeDefinition)) { 14259 if ($notnull_bool(this.isStatic) && !(this.declaringType.get$definition() in stanceof FunctionTypeDefinition)) {
14236 world.error('static method can not be abstract', this.get$span()); 14260 $globals.world.error('static method can not be abstract', this.get$span()) ;
14237 } 14261 }
14238 } 14262 }
14239 else { 14263 else {
14240 if (this.definition.body == null && !$notnull_bool(this.get$isConstructor()) ) { 14264 if (this.definition.body == null && !$notnull_bool(this.get$isConstructor()) ) {
14241 world.error('method needs a body', this.get$span()); 14265 $globals.world.error('method needs a body', this.get$span());
14242 } 14266 }
14243 } 14267 }
14244 if ($notnull_bool(this.get$isConstructor())) { 14268 if ($notnull_bool(this.get$isConstructor())) {
14245 this.returnType = this.declaringType; 14269 this.returnType = this.declaringType;
14246 } 14270 }
14247 else { 14271 else {
14248 this.returnType = inType.resolveType(this.definition.returnType, false); 14272 this.returnType = inType.resolveType(this.definition.returnType, false);
14249 if ($notnull_bool(this.isStatic) && $notnull_bool(this.returnType.get$hasTyp eParams())) { 14273 if ($notnull_bool(this.isStatic) && $notnull_bool(this.returnType.get$hasTyp eParams())) {
14250 world.error('using type parameter in static context', this.definition.retu rnType.span); 14274 $globals.world.error('using type parameter in static context', this.defini tion.returnType.span);
14251 } 14275 }
14252 } 14276 }
14253 this.parameters = []; 14277 this.parameters = [];
14254 var $list = this.definition.formals; 14278 var $list = this.definition.formals;
14255 for (var $i = 0;$i < $list.length; $i++) { 14279 for (var $i = 0;$i < $list.length; $i++) {
14256 var formal = $list.$index($i); 14280 var formal = $list.$index($i);
14257 var param = new Parameter(formal); 14281 var param = new Parameter(formal);
14258 param.resolve$2(this, inType); 14282 param.resolve$2(this, inType);
14259 this.parameters.add(param); 14283 this.parameters.add(param);
14260 } 14284 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
14324 return this.members.$index(0).get$isOperator(); 14348 return this.members.$index(0).get$isOperator();
14325 } 14349 }
14326 MemberSet.prototype.canInvoke = function(context, args) { 14350 MemberSet.prototype.canInvoke = function(context, args) {
14327 return this.members.some((function (m) { 14351 return this.members.some((function (m) {
14328 return m.canInvoke$2(context, args); 14352 return m.canInvoke$2(context, args);
14329 }) 14353 })
14330 ); 14354 );
14331 } 14355 }
14332 MemberSet.prototype._makeError = function(node, target, action) { 14356 MemberSet.prototype._makeError = function(node, target, action) {
14333 if (!$notnull_bool(target.type.get$isVar())) { 14357 if (!$notnull_bool(target.type.get$isVar())) {
14334 world.warning(('could not find applicable ' + action + ' for "' + this.name + '"'), node.span); 14358 $globals.world.warning(('could not find applicable ' + action + ' for "' + t his.name + '"'), node.span);
14335 } 14359 }
14336 return new Value(world.varType, ('' + target.code + '.' + this.jsname + '() /* no applicable ' + action + '*/'), node.span, true); 14360 return new Value($globals.world.varType, ('' + target.code + '.' + this.jsname + '() /*no applicable ' + action + '*/'), node.span, true);
14337 } 14361 }
14338 MemberSet.prototype.get$treatAsField = function() { 14362 MemberSet.prototype.get$treatAsField = function() {
14339 if (this._treatAsField == null) { 14363 if (this._treatAsField == null) {
14340 this._treatAsField = true; 14364 this._treatAsField = true;
14341 var $list = this.members; 14365 var $list = this.members;
14342 for (var $i = 0;$i < $list.length; $i++) { 14366 for (var $i = 0;$i < $list.length; $i++) {
14343 var member = $list.$index($i); 14367 var member = $list.$index($i);
14344 if ($notnull_bool(member.get$requiresFieldSyntax())) { 14368 if ($notnull_bool(member.get$requiresFieldSyntax())) {
14345 this._treatAsField = true; 14369 this._treatAsField = true;
14346 break; 14370 break;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
14464 return member.invoke$4(context, node, target, args); 14488 return member.invoke$4(context, node, target, args);
14465 } 14489 }
14466 MemberSet.prototype._tryUnion = function(x, y, node) { 14490 MemberSet.prototype._tryUnion = function(x, y, node) {
14467 if (x == null) return y; 14491 if (x == null) return y;
14468 var type = lang_Type.union(x.type, y.type); 14492 var type = lang_Type.union(x.type, y.type);
14469 if (x.code == y.code) { 14493 if (x.code == y.code) {
14470 if ($notnull_bool($eq(type, x.type))) { 14494 if ($notnull_bool($eq(type, x.type))) {
14471 return x; 14495 return x;
14472 } 14496 }
14473 else if ($notnull_bool(x.get$isConst()) || $notnull_bool(y.get$isConst())) { 14497 else if ($notnull_bool(x.get$isConst()) || $notnull_bool(y.get$isConst())) {
14474 world.internalError("unexpected: union of const values "); 14498 $globals.world.internalError("unexpected: union of const values ");
14475 } 14499 }
14476 else { 14500 else {
14477 var ret = new Value(type, x.code, node.span, true); 14501 var ret = new Value(type, x.code, node.span, true);
14478 ret.isSuper = $notnull_bool(x.isSuper) && $notnull_bool(y.isSuper); 14502 ret.isSuper = $notnull_bool(x.isSuper) && $notnull_bool(y.isSuper);
14479 ret.needsTemp = $notnull_bool(x.needsTemp) || $notnull_bool(y.needsTemp); 14503 ret.needsTemp = $notnull_bool(x.needsTemp) || $notnull_bool(y.needsTemp);
14480 ret.isType = $notnull_bool(x.isType) && $notnull_bool(y.isType); 14504 ret.isType = $notnull_bool(x.isType) && $notnull_bool(y.isType);
14481 return (ret && ret.is$Value()); 14505 return (ret && ret.is$Value());
14482 } 14506 }
14483 } 14507 }
14484 else { 14508 else {
14485 return new Value(type, null, node.span, true); 14509 return new Value(type, null, node.span, true);
14486 } 14510 }
14487 } 14511 }
14488 MemberSet.prototype.getVarMember = function(context, node, args) { 14512 MemberSet.prototype.getVarMember = function(context, node, args) {
14489 if (world.objectType.varStubs == null) { 14513 if ($globals.world.objectType.varStubs == null) {
14490 world.objectType.varStubs = $map([]); 14514 $globals.world.objectType.varStubs = $map([]);
14491 } 14515 }
14492 var stubName = _getCallStubName(this.name, args); 14516 var stubName = _getCallStubName(this.name, args);
14493 var stub = world.objectType.varStubs.$index(stubName); 14517 var stub = $globals.world.objectType.varStubs.$index(stubName);
14494 if ($notnull_bool(stub == null)) { 14518 if ($notnull_bool(stub == null)) {
14495 var mset = context.findMembers(this.name).members; 14519 var mset = context.findMembers(this.name).members;
14496 var targets = mset.filter((function (m) { 14520 var targets = mset.filter((function (m) {
14497 return m.canInvoke$2(context, args); 14521 return m.canInvoke$2(context, args);
14498 }) 14522 })
14499 ); 14523 );
14500 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t ) { 14524 var returnType = reduce(map((targets && targets.is$Iterable()), (function (t ) {
14501 return t.get$returnType(); 14525 return t.get$returnType();
14502 }) 14526 })
14503 ), lang_Type.union); 14527 ), lang_Type.union);
14504 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType) ; 14528 stub = new VarMethodSet($assert_String(stubName), targets, args, returnType) ;
14505 world.objectType.varStubs.$setindex(stubName, stub); 14529 $globals.world.objectType.varStubs.$setindex(stubName, stub);
14506 } 14530 }
14507 return (stub && stub.is$VarMember()); 14531 return (stub && stub.is$VarMember());
14508 } 14532 }
14509 MemberSet.prototype._get$3 = function($0, $1, $2) { 14533 MemberSet.prototype._get$3 = function($0, $1, $2) {
14510 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false); 14534 return this._get(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), false);
14511 }; 14535 };
14512 MemberSet.prototype._set$4 = function($0, $1, $2, $3) { 14536 MemberSet.prototype._set$4 = function($0, $1, $2, $3) {
14513 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false); 14537 return this._set(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ( $2 && $2.is$Value()), ($3 && $3.is$Value()), false);
14514 }; 14538 };
14515 MemberSet.prototype.add$1 = function($0) { 14539 MemberSet.prototype.add$1 = function($0) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
14617 this._lineStarts = (starts && starts.is$List$int()); 14641 this._lineStarts = (starts && starts.is$List$int());
14618 } 14642 }
14619 return this._lineStarts; 14643 return this._lineStarts;
14620 } 14644 }
14621 SourceFile.prototype.getLine = function(position) { 14645 SourceFile.prototype.getLine = function(position) {
14622 var starts = this.get$lineStarts(); 14646 var starts = this.get$lineStarts();
14623 for (var i = 0; 14647 for (var i = 0;
14624 i < starts.length; i++) { 14648 i < starts.length; i++) {
14625 if (starts.$index(i) > position) return i - 1; 14649 if (starts.$index(i) > position) return i - 1;
14626 } 14650 }
14627 world.internalError('bad position'); 14651 $globals.world.internalError('bad position');
14628 } 14652 }
14629 SourceFile.prototype.getColumn = function(line, position) { 14653 SourceFile.prototype.getColumn = function(line, position) {
14630 return position - $assert_num(this.get$lineStarts().$index(line)); 14654 return position - $assert_num(this.get$lineStarts().$index(line));
14631 } 14655 }
14632 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) { 14656 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) {
14633 var line = this.getLine(start); 14657 var line = this.getLine(start);
14634 var column = this.getColumn($assert_num(line), start); 14658 var column = this.getColumn($assert_num(line), start);
14635 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message + '')); 14659 var buf = new StringBufferImpl(('' + this.filename + ':' + (line + 1) + ':' + (column + 1) + ': ' + message + ''));
14636 if ($notnull_bool(includeText)) { 14660 if ($notnull_bool(includeText)) {
14637 buf.add$1('\n'); 14661 buf.add$1('\n');
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after
16464 lang_Parser.prototype._errorExpected = function(expected) { 16488 lang_Parser.prototype._errorExpected = function(expected) {
16465 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile(); 16489 if ($notnull_bool(this.throwOnIncomplete)) this.isPrematureEndOfFile();
16466 var tok = this._lang_next(); 16490 var tok = this._lang_next();
16467 var message = ('expected ' + expected + ', but found ' + tok + ''); 16491 var message = ('expected ' + expected + ', but found ' + tok + '');
16468 this._lang_error($assert_String(message), tok.get$span()); 16492 this._lang_error($assert_String(message), tok.get$span());
16469 } 16493 }
16470 lang_Parser.prototype._lang_error = function(message, location) { 16494 lang_Parser.prototype._lang_error = function(message, location) {
16471 if (location == null) { 16495 if (location == null) {
16472 location = this._peekToken.get$span(); 16496 location = this._peekToken.get$span();
16473 } 16497 }
16474 world.fatal(message, location); 16498 $globals.world.fatal(message, location);
16475 } 16499 }
16476 lang_Parser.prototype._skipBlock = function() { 16500 lang_Parser.prototype._skipBlock = function() {
16477 var depth = 1; 16501 var depth = 1;
16478 this._eat(6/*TokenKind.LBRACE*/); 16502 this._eat(6/*TokenKind.LBRACE*/);
16479 while (true) { 16503 while (true) {
16480 var tok = this._lang_next(); 16504 var tok = this._lang_next();
16481 if ($notnull_bool($eq(tok.kind, 6/*TokenKind.LBRACE*/))) { 16505 if ($notnull_bool($eq(tok.kind, 6/*TokenKind.LBRACE*/))) {
16482 depth += 1; 16506 depth += 1;
16483 } 16507 }
16484 else if ($notnull_bool($eq(tok.kind, 7/*TokenKind.RBRACE*/))) { 16508 else if ($notnull_bool($eq(tok.kind, 7/*TokenKind.RBRACE*/))) {
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
17244 else { 17268 else {
17245 return expr; 17269 return expr;
17246 } 17270 }
17247 17271
17248 } 17272 }
17249 } 17273 }
17250 lang_Parser.prototype._isBin = function(expr, kind) { 17274 lang_Parser.prototype._isBin = function(expr, kind) {
17251 return (expr instanceof BinaryExpression) && expr.op.kind == kind; 17275 return (expr instanceof BinaryExpression) && expr.op.kind == kind;
17252 } 17276 }
17253 lang_Parser.prototype._boolTypeRef = function(span) { 17277 lang_Parser.prototype._boolTypeRef = function(span) {
17254 return new TypeReference(span, world.nonNullBool); 17278 return new TypeReference(span, $globals.world.nonNullBool);
17255 } 17279 }
17256 lang_Parser.prototype._intTypeRef = function(span) { 17280 lang_Parser.prototype._intTypeRef = function(span) {
17257 return new TypeReference(span, world.intType); 17281 return new TypeReference(span, $globals.world.intType);
17258 } 17282 }
17259 lang_Parser.prototype._doubleTypeRef = function(span) { 17283 lang_Parser.prototype._doubleTypeRef = function(span) {
17260 return new TypeReference(span, world.doubleType); 17284 return new TypeReference(span, $globals.world.doubleType);
17261 } 17285 }
17262 lang_Parser.prototype._stringTypeRef = function(span) { 17286 lang_Parser.prototype._stringTypeRef = function(span) {
17263 return new TypeReference(span, world.stringType); 17287 return new TypeReference(span, $globals.world.stringType);
17264 } 17288 }
17265 lang_Parser.prototype.primary = function() { 17289 lang_Parser.prototype.primary = function() {
17266 var start = this._peekToken.start; 17290 var start = this._peekToken.start;
17267 switch (this._peek()) { 17291 switch (this._peek()) {
17268 case 108/*TokenKind.THIS*/: 17292 case 108/*TokenKind.THIS*/:
17269 17293
17270 this._eat(108/*TokenKind.THIS*/); 17294 this._eat(108/*TokenKind.THIS*/);
17271 return new ThisExpression(this._makeSpan(start)); 17295 return new ThisExpression(this._makeSpan(start));
17272 17296
17273 case 106/*TokenKind.SUPER*/: 17297 case 106/*TokenKind.SUPER*/:
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
17721 } 17745 }
17722 lang_Parser.prototype.type = function(depth) { 17746 lang_Parser.prototype.type = function(depth) {
17723 var start = this._peekToken.start; 17747 var start = this._peekToken.start;
17724 var name; 17748 var name;
17725 var names = null; 17749 var names = null;
17726 var typeArgs = null; 17750 var typeArgs = null;
17727 var isFinal = false; 17751 var isFinal = false;
17728 switch (this._peek()) { 17752 switch (this._peek()) {
17729 case 113/*TokenKind.VOID*/: 17753 case 113/*TokenKind.VOID*/:
17730 17754
17731 return new TypeReference(this._lang_next().get$span(), world.voidType); 17755 return new TypeReference(this._lang_next().get$span(), $globals.world.void Type);
17732 17756
17733 case 112/*TokenKind.VAR*/: 17757 case 112/*TokenKind.VAR*/:
17734 17758
17735 return new TypeReference(this._lang_next().get$span(), world.varType); 17759 return new TypeReference(this._lang_next().get$span(), $globals.world.varT ype);
17736 17760
17737 case 97/*TokenKind.FINAL*/: 17761 case 97/*TokenKind.FINAL*/:
17738 17762
17739 this._eat(97/*TokenKind.FINAL*/); 17763 this._eat(97/*TokenKind.FINAL*/);
17740 isFinal = true; 17764 isFinal = true;
17741 name = this.identifier(); 17765 name = this.identifier();
17742 break; 17766 break;
17743 17767
17744 default: 17768 default:
17745 17769
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
18953 lang_Type.prototype.getAllMembers = function() { 18977 lang_Type.prototype.getAllMembers = function() {
18954 return $map([]); 18978 return $map([]);
18955 } 18979 }
18956 lang_Type.prototype.hashCode = function() { 18980 lang_Type.prototype.hashCode = function() {
18957 return this.name.hashCode(); 18981 return this.name.hashCode();
18958 } 18982 }
18959 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) { 18983 lang_Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) {
18960 if (!$notnull_bool(this.isSubtypeOf(other))) { 18984 if (!$notnull_bool(this.isSubtypeOf(other))) {
18961 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + ''); 18985 var msg = ('type ' + this.name + ' is not a subtype of ' + other.name + '');
18962 if ($notnull_bool(typeErrors)) { 18986 if ($notnull_bool(typeErrors)) {
18963 world.error($assert_String(msg), span); 18987 $globals.world.error($assert_String(msg), span);
18964 } 18988 }
18965 else { 18989 else {
18966 world.warning($assert_String(msg), span); 18990 $globals.world.warning($assert_String(msg), span);
18967 } 18991 }
18968 } 18992 }
18969 } 18993 }
18970 lang_Type.prototype.needsVarCall = function(args) { 18994 lang_Type.prototype.needsVarCall = function(args) {
18971 if ($notnull_bool(this.get$isVarOrFunction())) { 18995 if ($notnull_bool(this.get$isVarOrFunction())) {
18972 return true; 18996 return true;
18973 } 18997 }
18974 var call = this.getCallMethod(); 18998 var call = this.getCallMethod();
18975 if ($notnull_bool($ne(call, null))) { 18999 if ($notnull_bool($ne(call, null))) {
18976 if (args.get$length() != call.get$parameters().length || !$notnull_bool(call .namesInOrder$1(args))) { 19000 if (args.get$length() != call.get$parameters().length || !$notnull_bool(call .namesInOrder$1(args))) {
18977 return true; 19001 return true;
18978 } 19002 }
18979 } 19003 }
18980 return false; 19004 return false;
18981 } 19005 }
18982 lang_Type.union = function(x, y) { 19006 lang_Type.union = function(x, y) {
18983 if ($eq(x, y)) return x; 19007 if ($eq(x, y)) return x;
18984 if ($notnull_bool(x.get$isNum()) && $notnull_bool(y.get$isNum())) return world .numType; 19008 if ($notnull_bool(x.get$isNum()) && $notnull_bool(y.get$isNum())) return $glob als.world.numType;
18985 if ($notnull_bool(x.get$isString()) && $notnull_bool(y.get$isString())) return world.stringType; 19009 if ($notnull_bool(x.get$isString()) && $notnull_bool(y.get$isString())) return $globals.world.stringType;
18986 return world.varType; 19010 return $globals.world.varType;
18987 } 19011 }
18988 lang_Type.prototype.isAssignable = function(other) { 19012 lang_Type.prototype.isAssignable = function(other) {
18989 return $notnull_bool(this.isSubtypeOf(other)) || $notnull_bool(other.isSubtype Of(this)); 19013 return $notnull_bool(this.isSubtypeOf(other)) || $notnull_bool(other.isSubtype Of(this));
18990 } 19014 }
18991 lang_Type.prototype._isDirectSupertypeOf = function(other) { 19015 lang_Type.prototype._isDirectSupertypeOf = function(other) {
18992 var $this = this; // closure support 19016 var $this = this; // closure support
18993 if ($notnull_bool(other.get$isClass())) { 19017 if ($notnull_bool(other.get$isClass())) {
18994 return $eq(other.get$parent(), this) || $notnull_bool(this.get$isObject()) & & other.get$parent() == null; 19018 return $eq(other.get$parent(), this) || $notnull_bool(this.get$isObject()) & & other.get$parent() == null;
18995 } 19019 }
18996 else { 19020 else {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
19100 ParameterType.prototype.get$isClass = function() { 19124 ParameterType.prototype.get$isClass = function() {
19101 return false; 19125 return false;
19102 } 19126 }
19103 ParameterType.prototype.get$library = function() { 19127 ParameterType.prototype.get$library = function() {
19104 return null; 19128 return null;
19105 } 19129 }
19106 ParameterType.prototype.get$span = function() { 19130 ParameterType.prototype.get$span = function() {
19107 return this.typeParameter.span; 19131 return this.typeParameter.span;
19108 } 19132 }
19109 ParameterType.prototype.get$constructors = function() { 19133 ParameterType.prototype.get$constructors = function() {
19110 world.internalError('no constructors on type parameters yet'); 19134 $globals.world.internalError('no constructors on type parameters yet');
19111 } 19135 }
19112 ParameterType.prototype.getCallMethod = function() { 19136 ParameterType.prototype.getCallMethod = function() {
19113 return this.extendsType.getCallMethod(); 19137 return this.extendsType.getCallMethod();
19114 } 19138 }
19115 ParameterType.prototype.genMethod = function(method) { 19139 ParameterType.prototype.genMethod = function(method) {
19116 this.extendsType.genMethod(method); 19140 this.extendsType.genMethod(method);
19117 } 19141 }
19118 ParameterType.prototype.isSubtypeOf = function(other) { 19142 ParameterType.prototype.isSubtypeOf = function(other) {
19119 return true; 19143 return true;
19120 } 19144 }
19121 ParameterType.prototype.resolveMember = function(memberName) { 19145 ParameterType.prototype.resolveMember = function(memberName) {
19122 return this.extendsType.resolveMember(memberName); 19146 return this.extendsType.resolveMember(memberName);
19123 } 19147 }
19124 ParameterType.prototype.getConstructor = function(constructorName) { 19148 ParameterType.prototype.getConstructor = function(constructorName) {
19125 world.internalError('no constructors on type parameters yet'); 19149 $globals.world.internalError('no constructors on type parameters yet');
19126 } 19150 }
19127 ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) { 19151 ParameterType.prototype.getOrMakeConcreteType = function(typeArgs) {
19128 world.internalError('no concrete types of type parameters yet', this.get$span( )); 19152 $globals.world.internalError('no concrete types of type parameters yet', this. get$span());
19129 } 19153 }
19130 ParameterType.prototype.resolveTypeParams = function(inType) { 19154 ParameterType.prototype.resolveTypeParams = function(inType) {
19131 var $0; 19155 var $0;
19132 return (($0 = inType.typeArguments.$index(this.name)) && $0.is$lang_Type()); 19156 return (($0 = inType.typeArguments.$index(this.name)) && $0.is$lang_Type());
19133 } 19157 }
19134 ParameterType.prototype.addDirectSubtype = function(type) { 19158 ParameterType.prototype.addDirectSubtype = function(type) {
19135 world.internalError('no subtypes of type parameters yet', this.get$span()); 19159 $globals.world.internalError('no subtypes of type parameters yet', this.get$sp an());
19136 } 19160 }
19137 ParameterType.prototype.resolve = function(inType) { 19161 ParameterType.prototype.resolve = function(inType) {
19138 if (this.typeParameter.extendsType != null) { 19162 if (this.typeParameter.extendsType != null) {
19139 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true); 19163 this.extendsType = inType.resolveType(this.typeParameter.extendsType, true);
19140 } 19164 }
19141 else { 19165 else {
19142 this.extendsType = world.objectType; 19166 this.extendsType = $globals.world.objectType;
19143 } 19167 }
19144 } 19168 }
19145 ParameterType.prototype.addDirectSubtype$1 = function($0) { 19169 ParameterType.prototype.addDirectSubtype$1 = function($0) {
19146 return this.addDirectSubtype(($0 && $0.is$lang_Type())); 19170 return this.addDirectSubtype(($0 && $0.is$lang_Type()));
19147 }; 19171 };
19148 ParameterType.prototype.getConstructor$1 = function($0) { 19172 ParameterType.prototype.getConstructor$1 = function($0) {
19149 return this.getConstructor($assert_String($0)); 19173 return this.getConstructor($assert_String($0));
19150 }; 19174 };
19151 ParameterType.prototype.getOrMakeConcreteType$1 = function($0) { 19175 ParameterType.prototype.getOrMakeConcreteType$1 = function($0) {
19152 return this.getOrMakeConcreteType(($0 && $0.is$List$Type())); 19176 return this.getOrMakeConcreteType(($0 && $0.is$List$Type()));
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
19525 for (var $i = 0;$i < $list.length; $i++) { 19549 for (var $i = 0;$i < $list.length; $i++) {
19526 var tp = $list.$index($i); 19550 var tp = $list.$index($i);
19527 var paramName = tp.get$name().get$name(); 19551 var paramName = tp.get$name().get$name();
19528 this.typeParameters.add(new ParameterType($assert_String(paramName), tp)); 19552 this.typeParameters.add(new ParameterType($assert_String(paramName), tp));
19529 } 19553 }
19530 } 19554 }
19531 } 19555 }
19532 DefinedType.prototype.get$typeArgsInOrder = function() { 19556 DefinedType.prototype.get$typeArgsInOrder = function() {
19533 if (this.typeParameters == null) return null; 19557 if (this.typeParameters == null) return null;
19534 if (this._typeArgsInOrder == null) { 19558 if (this._typeArgsInOrder == null) {
19535 this._typeArgsInOrder = new FixedCollection$Type(world.varType, this.typePar ameters.length); 19559 this._typeArgsInOrder = new FixedCollection$Type($globals.world.varType, thi s.typeParameters.length);
19536 } 19560 }
19537 return this._typeArgsInOrder; 19561 return this._typeArgsInOrder;
19538 } 19562 }
19539 DefinedType.prototype.get$isVar = function() { 19563 DefinedType.prototype.get$isVar = function() {
19540 return $eq(this, world.varType); 19564 return $eq(this, $globals.world.varType);
19541 } 19565 }
19542 DefinedType.prototype.get$isVoid = function() { 19566 DefinedType.prototype.get$isVoid = function() {
19543 return $eq(this, world.voidType); 19567 return $eq(this, $globals.world.voidType);
19544 } 19568 }
19545 DefinedType.prototype.get$isTop = function() { 19569 DefinedType.prototype.get$isTop = function() {
19546 return this.name == null; 19570 return this.name == null;
19547 } 19571 }
19548 DefinedType.prototype.get$isObject = function() { 19572 DefinedType.prototype.get$isObject = function() {
19549 return $notnull_bool(this.library.get$isCore()) && this.name == 'Object'; 19573 return $notnull_bool(this.library.get$isCore()) && this.name == 'Object';
19550 } 19574 }
19551 DefinedType.prototype.get$isString = function() { 19575 DefinedType.prototype.get$isString = function() {
19552 return $notnull_bool(this.library.get$isCore()) && this.name == 'String' || $n otnull_bool(this.library.get$isCoreImpl()) && this.name == 'StringImplementation '; 19576 return $notnull_bool(this.library.get$isCore()) && this.name == 'String' || $n otnull_bool(this.library.get$isCoreImpl()) && this.name == 'StringImplementation ';
19553 } 19577 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
19585 DefinedType.prototype.getAllMembers = function() { 19609 DefinedType.prototype.getAllMembers = function() {
19586 return HashMapImplementation.HashMapImplementation$from$factory(this.members); 19610 return HashMapImplementation.HashMapImplementation$from$factory(this.members);
19587 } 19611 }
19588 DefinedType.prototype.markUsed = function() { 19612 DefinedType.prototype.markUsed = function() {
19589 if ($notnull_bool(this.isUsed)) return; 19613 if ($notnull_bool(this.isUsed)) return;
19590 this.isUsed = true; 19614 this.isUsed = true;
19591 if (this._lazyGenMethods != null) { 19615 if (this._lazyGenMethods != null) {
19592 var $list = orderValuesByKeys(this._lazyGenMethods); 19616 var $list = orderValuesByKeys(this._lazyGenMethods);
19593 for (var $i = 0;$i < $list.length; $i++) { 19617 for (var $i = 0;$i < $list.length; $i++) {
19594 var method = $list.$index($i); 19618 var method = $list.$index($i);
19595 world.gen.genMethod((method && method.is$Member())); 19619 $globals.world.gen.genMethod((method && method.is$Member()));
19596 } 19620 }
19597 this._lazyGenMethods = null; 19621 this._lazyGenMethods = null;
19598 } 19622 }
19599 if (this.get$parent() != null) this.get$parent().markUsed(); 19623 if (this.get$parent() != null) this.get$parent().markUsed();
19600 } 19624 }
19601 DefinedType.prototype.genMethod = function(method) { 19625 DefinedType.prototype.genMethod = function(method) {
19602 if ($notnull_bool(this.isUsed)) { 19626 if ($notnull_bool(this.isUsed)) {
19603 world.gen.genMethod(method); 19627 $globals.world.gen.genMethod(method);
19604 } 19628 }
19605 else if ($notnull_bool(this.isClass)) { 19629 else if ($notnull_bool(this.isClass)) {
19606 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]); 19630 if (this._lazyGenMethods == null) this._lazyGenMethods = $map([]);
19607 this._lazyGenMethods.$setindex(method.name, method); 19631 this._lazyGenMethods.$setindex(method.name, method);
19608 } 19632 }
19609 } 19633 }
19610 DefinedType.prototype._resolveInterfaces = function(types) { 19634 DefinedType.prototype._resolveInterfaces = function(types) {
19611 if (types == null) return []; 19635 if (types == null) return [];
19612 var interfaces = []; 19636 var interfaces = [];
19613 for (var $i = 0;$i < types.length; $i++) { 19637 for (var $i = 0;$i < types.length; $i++) {
19614 var type = types.$index($i); 19638 var type = types.$index($i);
19615 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true); 19639 var resolvedInterface = this.resolveType((type && type.is$TypeReference()), true);
19616 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this. library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) { 19640 if ($notnull_bool(resolvedInterface.get$isClosed()) && !($notnull_bool(this. library.get$isCore()) || $notnull_bool(this.library.get$isCoreImpl()))) {
19617 world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span()); 19641 $globals.world.error(('can not implement "' + resolvedInterface.get$name() + '": ') + 'only native implementation allowed', type.get$span());
19618 } 19642 }
19619 resolvedInterface.addDirectSubtype$1(this); 19643 resolvedInterface.addDirectSubtype$1(this);
19620 interfaces.add$1(resolvedInterface); 19644 interfaces.add$1(resolvedInterface);
19621 } 19645 }
19622 return (interfaces && interfaces.is$List$Type()); 19646 return (interfaces && interfaces.is$List$Type());
19623 } 19647 }
19624 DefinedType.prototype.addDirectSubtype = function(type) { 19648 DefinedType.prototype.addDirectSubtype = function(type) {
19625 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 748, 12); 19649 $assert(this._subtypes == null, "_subtypes == null", "type.dart", 748, 12);
19626 this.directSubtypes.add(type); 19650 this.directSubtypes.add(type);
19627 } 19651 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
19680 return -1; 19704 return -1;
19681 } 19705 }
19682 DefinedType.prototype.resolve = function() { 19706 DefinedType.prototype.resolve = function() {
19683 var $this = this; // closure support 19707 var $this = this; // closure support
19684 var $0; 19708 var $0;
19685 if ((this.definition instanceof TypeDefinition)) { 19709 if ((this.definition instanceof TypeDefinition)) {
19686 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition()); 19710 var typeDef = (($0 = this.definition) && $0.is$TypeDefinition());
19687 if ($notnull_bool(this.isClass)) { 19711 if ($notnull_bool(this.isClass)) {
19688 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) { 19712 if (typeDef.extendsTypes != null && typeDef.extendsTypes.length > 0) {
19689 if (typeDef.extendsTypes.length > 1) { 19713 if (typeDef.extendsTypes.length > 1) {
19690 world.error('more than one base class', typeDef.extendsTypes.$index(1) .get$span()); 19714 $globals.world.error('more than one base class', typeDef.extendsTypes. $index(1).get$span());
19691 } 19715 }
19692 var extendsTypeRef = typeDef.extendsTypes.$index(0); 19716 var extendsTypeRef = typeDef.extendsTypes.$index(0);
19693 if ((extendsTypeRef instanceof GenericTypeReference)) { 19717 if ((extendsTypeRef instanceof GenericTypeReference)) {
19694 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference()); 19718 var g = (extendsTypeRef && extendsTypeRef.is$GenericTypeReference());
19695 this.set$parent(this.resolveType(g.baseType, true)); 19719 this.set$parent(this.resolveType(g.baseType, true));
19696 } 19720 }
19697 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty peReference()), true)); 19721 this.set$parent(this.resolveType((extendsTypeRef && extendsTypeRef.is$Ty peReference()), true));
19698 if (!$notnull_bool(this.get$parent().get$isClass())) { 19722 if (!$notnull_bool(this.get$parent().get$isClass())) {
19699 world.error('class may not extend an interface - use implements', type Def.extendsTypes.$index(0).get$span()); 19723 $globals.world.error('class may not extend an interface - use implemen ts', typeDef.extendsTypes.$index(0).get$span());
19700 } 19724 }
19701 this.get$parent().addDirectSubtype(this); 19725 this.get$parent().addDirectSubtype(this);
19702 if ($notnull_bool(this._cycleInClassExtends())) { 19726 if ($notnull_bool(this._cycleInClassExtends())) {
19703 world.error(('class "' + this.name + '" has a cycle in its inheritance chain'), extendsTypeRef.get$span()); 19727 $globals.world.error(('class "' + this.name + '" has a cycle in its in heritance chain'), extendsTypeRef.get$span());
19704 } 19728 }
19705 } 19729 }
19706 else { 19730 else {
19707 if (!$notnull_bool(this.get$isObject())) { 19731 if (!$notnull_bool(this.get$isObject())) {
19708 this.set$parent(world.objectType); 19732 this.set$parent($globals.world.objectType);
19709 this.get$parent().addDirectSubtype(this); 19733 this.get$parent().addDirectSubtype(this);
19710 } 19734 }
19711 } 19735 }
19712 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); 19736 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes);
19713 if (typeDef.factoryType != null) { 19737 if (typeDef.factoryType != null) {
19714 world.error('factory not allowed on classes', typeDef.factoryType.span); 19738 $globals.world.error('factory not allowed on classes', typeDef.factoryTy pe.span);
19715 } 19739 }
19716 } 19740 }
19717 else { 19741 else {
19718 if (typeDef.implementsTypes != null && typeDef.implementsTypes.length > 0) { 19742 if (typeDef.implementsTypes != null && typeDef.implementsTypes.length > 0) {
19719 world.error('implements not allowed on interfaces (use extends)', typeDe f.implementsTypes.$index(0).get$span()); 19743 $globals.world.error('implements not allowed on interfaces (use extends) ', typeDef.implementsTypes.$index(0).get$span());
19720 } 19744 }
19721 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); 19745 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes);
19722 var res = this._cycleInInterfaceExtends(); 19746 var res = this._cycleInInterfaceExtends();
19723 if (res >= 0) { 19747 if (res >= 0) {
19724 world.error(('interface "' + this.name + '" has a cycle in its inheritan ce chain'), typeDef.extendsTypes.$index(res).get$span()); 19748 $globals.world.error(('interface "' + this.name + '" has a cycle in its inheritance chain'), typeDef.extendsTypes.$index(res).get$span());
19725 } 19749 }
19726 if (typeDef.factoryType != null) { 19750 if (typeDef.factoryType != null) {
19727 this.factory_ = this.resolveType(typeDef.factoryType, true); 19751 this.factory_ = this.resolveType(typeDef.factoryType, true);
19728 if (this.factory_ == null) { 19752 if (this.factory_ == null) {
19729 world.warning('unresolved factory', typeDef.factoryType.span); 19753 $globals.world.warning('unresolved factory', typeDef.factoryType.span) ;
19730 } 19754 }
19731 } 19755 }
19732 } 19756 }
19733 } 19757 }
19734 else if ((this.definition instanceof FunctionTypeDefinition)) { 19758 else if ((this.definition instanceof FunctionTypeDefinition)) {
19735 this.interfaces = [world.functionType]; 19759 this.interfaces = [$globals.world.functionType];
19736 } 19760 }
19737 if (this.typeParameters != null) { 19761 if (this.typeParameters != null) {
19738 var $list = this.typeParameters; 19762 var $list = this.typeParameters;
19739 for (var $i = 0;$i < $list.length; $i++) { 19763 for (var $i = 0;$i < $list.length; $i++) {
19740 var tp = $list.$index($i); 19764 var tp = $list.$index($i);
19741 tp.resolve$1(this); 19765 tp.resolve$1(this);
19742 } 19766 }
19743 } 19767 }
19744 world._addType(this); 19768 $globals.world._addType(this);
19745 var $list = this.constructors.getValues(); 19769 var $list = this.constructors.getValues();
19746 for (var $i = this.constructors.getValues().iterator$0(); $i.hasNext$0(); ) { 19770 for (var $i = this.constructors.getValues().iterator$0(); $i.hasNext$0(); ) {
19747 var c = $i.next$0(); 19771 var c = $i.next$0();
19748 c.resolve$1(this); 19772 c.resolve$1(this);
19749 } 19773 }
19750 var $list0 = this.members.getValues(); 19774 var $list0 = this.members.getValues();
19751 for (var $i = this.members.getValues().iterator$0(); $i.hasNext$0(); ) { 19775 for (var $i = this.members.getValues().iterator$0(); $i.hasNext$0(); ) {
19752 var m = $i.next$0(); 19776 var m = $i.next$0();
19753 m.resolve$1(this); 19777 m.resolve$1(this);
19754 } 19778 }
19755 this.factories.forEach((function (f) { 19779 this.factories.forEach((function (f) {
19756 return f.resolve$1($this); 19780 return f.resolve$1($this);
19757 }) 19781 })
19758 ); 19782 );
19759 } 19783 }
19760 DefinedType.prototype.addMethod = function(methodName, definition) { 19784 DefinedType.prototype.addMethod = function(methodName, definition) {
19761 if (methodName == null) methodName = definition.name.name; 19785 if (methodName == null) methodName = definition.name.name;
19762 var method = new MethodMember(methodName, this, definition); 19786 var method = new MethodMember(methodName, this, definition);
19763 if ($notnull_bool(method.get$isConstructor())) { 19787 if ($notnull_bool(method.get$isConstructor())) {
19764 if (this.constructors.containsKey(method.get$constructorName())) { 19788 if (this.constructors.containsKey(method.get$constructorName())) {
19765 world.error(('duplicate constructor definition of ' + method.get$name() + ''), definition.span); 19789 $globals.world.error(('duplicate constructor definition of ' + method.get$ name() + ''), definition.span);
19766 return; 19790 return;
19767 } 19791 }
19768 this.constructors.$setindex(method.get$constructorName(), method); 19792 this.constructors.$setindex(method.get$constructorName(), method);
19769 return; 19793 return;
19770 } 19794 }
19771 if (definition.modifiers != null && definition.modifiers.length == 1 && $notnu ll_bool($eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/))) { 19795 if (definition.modifiers != null && definition.modifiers.length == 1 && $notnu ll_bool($eq(definition.modifiers.$index(0).kind, 75/*TokenKind.FACTORY*/))) {
19772 if (this.factories.getFactory(method.get$constructorName(), $assert_String(m ethod.get$name())) != null) { 19796 if (this.factories.getFactory(method.get$constructorName(), $assert_String(m ethod.get$name())) != null) {
19773 world.error(('duplicate factory definition of "' + method.get$name() + '"' ), definition.span); 19797 $globals.world.error(('duplicate factory definition of "' + method.get$nam e() + '"'), definition.span);
19774 return; 19798 return;
19775 } 19799 }
19776 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member())); 19800 this.factories.addFactory(method.get$constructorName(), $assert_String(metho d.get$name()), (method && method.is$Member()));
19777 return; 19801 return;
19778 } 19802 }
19779 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) { 19803 if (methodName.startsWith('get\$') || methodName.startsWith('set\$')) {
19780 var propName = methodName.substring(4); 19804 var propName = methodName.substring(4);
19781 var prop = this.members.$index(propName); 19805 var prop = this.members.$index(propName);
19782 if ($notnull_bool(prop == null)) { 19806 if ($notnull_bool(prop == null)) {
19783 prop = new PropertyMember($assert_String(propName), this); 19807 prop = new PropertyMember($assert_String(propName), this);
19784 this.members.$setindex(propName, prop); 19808 this.members.$setindex(propName, prop);
19785 } 19809 }
19786 if (!(prop instanceof PropertyMember)) { 19810 if (!(prop instanceof PropertyMember)) {
19787 world.error(('property conflicts with field "' + propName + '"'), definiti on.span); 19811 $globals.world.error(('property conflicts with field "' + propName + '"'), definition.span);
19788 return; 19812 return;
19789 } 19813 }
19790 if (methodName[0] == 'g') { 19814 if (methodName[0] == 'g') {
19791 if (prop.getter != null) { 19815 if (prop.getter != null) {
19792 world.error(('duplicate getter definition for "' + propName + '"'), defi nition.span); 19816 $globals.world.error(('duplicate getter definition for "' + propName + ' "'), definition.span);
19793 } 19817 }
19794 prop.getter = (method && method.is$MethodMember()); 19818 prop.getter = (method && method.is$MethodMember());
19795 } 19819 }
19796 else { 19820 else {
19797 if (prop.setter != null) { 19821 if (prop.setter != null) {
19798 world.error(('duplicate setter definition for "' + propName + '"'), defi nition.span); 19822 $globals.world.error(('duplicate setter definition for "' + propName + ' "'), definition.span);
19799 } 19823 }
19800 prop.setter = (method && method.is$MethodMember()); 19824 prop.setter = (method && method.is$MethodMember());
19801 } 19825 }
19802 return; 19826 return;
19803 } 19827 }
19804 if (this.members.containsKey(methodName)) { 19828 if (this.members.containsKey(methodName)) {
19805 world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span); 19829 $globals.world.error(('duplicate method definition of "' + method.get$name() + '"'), definition.span);
19806 return; 19830 return;
19807 } 19831 }
19808 this.members.$setindex(methodName, method); 19832 this.members.$setindex(methodName, method);
19809 } 19833 }
19810 DefinedType.prototype.addField = function(definition) { 19834 DefinedType.prototype.addField = function(definition) {
19811 for (var i = 0; 19835 for (var i = 0;
19812 i < definition.names.length; i++) { 19836 i < definition.names.length; i++) {
19813 var name = definition.names.$index(i).get$name(); 19837 var name = definition.names.$index(i).get$name();
19814 if (this.members.containsKey(name)) { 19838 if (this.members.containsKey(name)) {
19815 world.error(('duplicate field definition of "' + name + '"'), definition.s pan); 19839 $globals.world.error(('duplicate field definition of "' + name + '"'), def inition.span);
19816 return; 19840 return;
19817 } 19841 }
19818 var value = null; 19842 var value = null;
19819 if (definition.values != null) { 19843 if (definition.values != null) {
19820 value = definition.values.$index(i); 19844 value = definition.values.$index(i);
19821 } 19845 }
19822 var field = new FieldMember($assert_String(name), this, definition, value); 19846 var field = new FieldMember($assert_String(name), this, definition, value);
19823 this.members.$setindex(name, field); 19847 this.members.$setindex(name, field);
19824 if ($notnull_bool(this.isNativeType)) { 19848 if ($notnull_bool(this.isNativeType)) {
19825 field.isNative = true; 19849 field.isNative = true;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
19908 for (var $i = 0;$i < $list.length; $i++) { 19932 for (var $i = 0;$i < $list.length; $i++) {
19909 var i = $list.$index($i); 19933 var i = $list.$index($i);
19910 var ret = i.getMember$1(memberName); 19934 var ret = i.getMember$1(memberName);
19911 if ($notnull_bool($ne(ret, null))) { 19935 if ($notnull_bool($ne(ret, null))) {
19912 return (ret && ret.is$Member()); 19936 return (ret && ret.is$Member());
19913 } 19937 }
19914 } 19938 }
19915 return null; 19939 return null;
19916 } 19940 }
19917 else { 19941 else {
19918 return world.objectType.getMember(memberName); 19942 return $globals.world.objectType.getMember(memberName);
19919 } 19943 }
19920 } 19944 }
19921 } 19945 }
19922 DefinedType.prototype.resolveMember = function(memberName) { 19946 DefinedType.prototype.resolveMember = function(memberName) {
19923 var $0; 19947 var $0;
19924 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( )); 19948 var ret = (($0 = this._resolvedMembers.$index(memberName)) && $0.is$MemberSet( ));
19925 if (ret != null) return ret; 19949 if (ret != null) return ret;
19926 var member = this.getMember(memberName); 19950 var member = this.getMember(memberName);
19927 if (member == null) { 19951 if (member == null) {
19928 return null; 19952 return null;
(...skipping 16 matching lines...) Expand all
19945 } 19969 }
19946 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member())); 19970 if ($notnull_bool($ne(m, null))) ret.add((m && m.is$Member()));
19947 } 19971 }
19948 return ret; 19972 return ret;
19949 } 19973 }
19950 } 19974 }
19951 DefinedType.prototype._createNotEqualMember = function() { 19975 DefinedType.prototype._createNotEqualMember = function() {
19952 var $0; 19976 var $0;
19953 var eq = (($0 = this.members.$index('\$eq')) && $0.is$MethodMember()); 19977 var eq = (($0 = this.members.$index('\$eq')) && $0.is$MethodMember());
19954 if (eq == null) { 19978 if (eq == null) {
19955 world.internalError('INTERNAL: object does not define ==', this.definition.s pan); 19979 $globals.world.internalError('INTERNAL: object does not define ==', this.def inition.span);
19956 } 19980 }
19957 var ne = new MethodMember('\$ne', this, eq.definition); 19981 var ne = new MethodMember('\$ne', this, eq.definition);
19958 ne.isGenerated = true; 19982 ne.isGenerated = true;
19959 ne.returnType = eq.returnType; 19983 ne.returnType = eq.returnType;
19960 ne.parameters = eq.parameters; 19984 ne.parameters = eq.parameters;
19961 ne.isStatic = eq.isStatic; 19985 ne.isStatic = eq.isStatic;
19962 ne.isAbstract = eq.isAbstract; 19986 ne.isAbstract = eq.isAbstract;
19963 return ne; 19987 return ne;
19964 } 19988 }
19965 DefinedType._getDottedName = function(type) { 19989 DefinedType._getDottedName = function(type) {
19966 if (type.names != null) { 19990 if (type.names != null) {
19967 var names = map(type.names, (function (n) { 19991 var names = map(type.names, (function (n) {
19968 return n.get$name(); 19992 return n.get$name();
19969 }) 19993 })
19970 ); 19994 );
19971 return type.name.name + '.' + Strings.join((names && names.is$List$String()) , '.'); 19995 return type.name.name + '.' + Strings.join((names && names.is$List$String()) , '.');
19972 } 19996 }
19973 else { 19997 else {
19974 return type.name.name; 19998 return type.name.name;
19975 } 19999 }
19976 } 20000 }
19977 DefinedType.prototype.resolveType = function(node, typeErrors) { 20001 DefinedType.prototype.resolveType = function(node, typeErrors) {
19978 var $0; 20002 var $0;
19979 if (node == null) return world.varType; 20003 if (node == null) return $globals.world.varType;
19980 if (node.type != null) return node.type; 20004 if (node.type != null) return node.type;
19981 if ((node instanceof NameTypeReference)) { 20005 if ((node instanceof NameTypeReference)) {
19982 var typeRef = (node && node.is$NameTypeReference()); 20006 var typeRef = (node && node.is$NameTypeReference());
19983 var name; 20007 var name;
19984 if (typeRef.names != null) { 20008 if (typeRef.names != null) {
19985 name = $assert_String(typeRef.names.last().get$name()); 20009 name = $assert_String(typeRef.names.last().get$name());
19986 } 20010 }
19987 else { 20011 else {
19988 name = typeRef.name.name; 20012 name = typeRef.name.name;
19989 } 20013 }
19990 if (this.typeParameters != null) { 20014 if (this.typeParameters != null) {
19991 var $list = this.typeParameters; 20015 var $list = this.typeParameters;
19992 for (var $i = 0;$i < $list.length; $i++) { 20016 for (var $i = 0;$i < $list.length; $i++) {
19993 var tp = $list.$index($i); 20017 var tp = $list.$index($i);
19994 if ($notnull_bool($eq(tp.get$name(), name))) { 20018 if ($notnull_bool($eq(tp.get$name(), name))) {
19995 typeRef.type = (tp && tp.is$lang_Type()); 20019 typeRef.type = (tp && tp.is$lang_Type());
19996 } 20020 }
19997 } 20021 }
19998 } 20022 }
19999 if (typeRef.type == null) { 20023 if (typeRef.type == null) {
20000 typeRef.type = this.library.findType(typeRef); 20024 typeRef.type = this.library.findType(typeRef);
20001 } 20025 }
20002 if (typeRef.type == null) { 20026 if (typeRef.type == null) {
20003 var message = ('can not find type ' + DefinedType._getDottedName(typeRef) + ''); 20027 var message = ('can not find type ' + DefinedType._getDottedName(typeRef) + '');
20004 if ($notnull_bool(typeErrors)) { 20028 if ($notnull_bool(typeErrors)) {
20005 world.error($assert_String(message), typeRef.span); 20029 $globals.world.error($assert_String(message), typeRef.span);
20006 typeRef.type = world.objectType; 20030 typeRef.type = $globals.world.objectType;
20007 } 20031 }
20008 else { 20032 else {
20009 world.warning($assert_String(message), typeRef.span); 20033 $globals.world.warning($assert_String(message), typeRef.span);
20010 typeRef.type = world.varType; 20034 typeRef.type = $globals.world.varType;
20011 } 20035 }
20012 } 20036 }
20013 } 20037 }
20014 else if ((node instanceof GenericTypeReference)) { 20038 else if ((node instanceof GenericTypeReference)) {
20015 var typeRef = (node && node.is$GenericTypeReference()); 20039 var typeRef = (node && node.is$GenericTypeReference());
20016 var baseType = this.resolveType(typeRef.baseType, typeErrors); 20040 var baseType = this.resolveType(typeRef.baseType, typeErrors);
20017 if (!$notnull_bool(baseType.get$isGeneric())) { 20041 if (!$notnull_bool(baseType.get$isGeneric())) {
20018 world.error(('' + baseType.get$name() + ' is not generic'), typeRef.span); 20042 $globals.world.error(('' + baseType.get$name() + ' is not generic'), typeR ef.span);
20019 return null; 20043 return null;
20020 } 20044 }
20021 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) { 20045 if (typeRef.typeArguments.length != baseType.get$typeParameters().length) {
20022 world.error('wrong number of type arguments', typeRef.span); 20046 $globals.world.error('wrong number of type arguments', typeRef.span);
20023 return null; 20047 return null;
20024 } 20048 }
20025 var typeArgs = []; 20049 var typeArgs = [];
20026 for (var i = 0; 20050 for (var i = 0;
20027 i < typeRef.typeArguments.length; i++) { 20051 i < typeRef.typeArguments.length; i++) {
20028 var extendsType = baseType.get$typeParameters().$index(i).extendsType; 20052 var extendsType = baseType.get$typeParameters().$index(i).extendsType;
20029 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) && $0.is$TypeReference()), typeErrors); 20053 var typeArg = this.resolveType((($0 = typeRef.typeArguments.$index(i)) && $0.is$TypeReference()), typeErrors);
20030 typeArgs.add$1(typeArg); 20054 typeArgs.add$1(typeArg);
20031 if ($notnull_bool($ne(extendsType, null)) && !(typeArg instanceof Paramete rType)) { 20055 if ($notnull_bool($ne(extendsType, null)) && !(typeArg instanceof Paramete rType)) {
20032 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g et$span(), typeErrors); 20056 typeArg.ensureSubtypeOf$3(extendsType, typeRef.typeArguments.$index(i).g et$span(), typeErrors);
20033 } 20057 }
20034 } 20058 }
20035 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); 20059 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs);
20036 } 20060 }
20037 else if ((node instanceof FunctionTypeReference)) { 20061 else if ((node instanceof FunctionTypeReference)) {
20038 var typeRef = (node && node.is$FunctionTypeReference()); 20062 var typeRef = (node && node.is$FunctionTypeReference());
20039 var name = ''; 20063 var name = '';
20040 if (typeRef.func.name != null) name = typeRef.func.name.name; 20064 if (typeRef.func.name != null) name = typeRef.func.name.name;
20041 typeRef.type = this.library.getOrAddFunctionType($assert_String(name), typeR ef.func, this); 20065 typeRef.type = this.library.getOrAddFunctionType($assert_String(name), typeR ef.func, this);
20042 } 20066 }
20043 else { 20067 else {
20044 world.internalError('unknown type reference', node.span); 20068 $globals.world.internalError('unknown type reference', node.span);
20045 } 20069 }
20046 return node.type; 20070 return node.type;
20047 } 20071 }
20048 DefinedType.prototype.resolveTypeParams = function(inType) { 20072 DefinedType.prototype.resolveTypeParams = function(inType) {
20049 return this; 20073 return this;
20050 } 20074 }
20051 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { 20075 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
20052 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1231, 12); 20076 $assert(this.get$isGeneric(), "isGeneric", "type.dart", 1231, 12);
20053 var names = [this.name]; 20077 var names = [this.name];
20054 var typeMap = $map([]); 20078 var typeMap = $map([]);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
20189 // ********** Code for Value ************** 20213 // ********** Code for Value **************
20190 function Value(type, code, span, needsTemp) { 20214 function Value(type, code, span, needsTemp) {
20191 this.isSuper = false 20215 this.isSuper = false
20192 this.isType = false 20216 this.isType = false
20193 this.isFinal = false 20217 this.isFinal = false
20194 this.type = type; 20218 this.type = type;
20195 this.code = code; 20219 this.code = code;
20196 this.span = span; 20220 this.span = span;
20197 this.needsTemp = needsTemp; 20221 this.needsTemp = needsTemp;
20198 // Initializers done 20222 // Initializers done
20199 if (this.type == null) world.internalError('type passed as null', this.span); 20223 if (this.type == null) $globals.world.internalError('type passed as null', thi s.span);
20200 } 20224 }
20201 Value.prototype.is$Value = function(){return this;}; 20225 Value.prototype.is$Value = function(){return this;};
20202 Value.prototype.get$type = function() { return this.type; }; 20226 Value.prototype.get$type = function() { return this.type; };
20203 Value.prototype.set$type = function(value) { return this.type = value; }; 20227 Value.prototype.set$type = function(value) { return this.type = value; };
20204 Value.prototype.get$span = function() { return this.span; }; 20228 Value.prototype.get$span = function() { return this.span; };
20205 Value.prototype.set$span = function(value) { return this.span = value; }; 20229 Value.prototype.set$span = function(value) { return this.span = value; };
20206 Value.prototype.get$isFinal = function() { return this.isFinal; }; 20230 Value.prototype.get$isFinal = function() { return this.isFinal; };
20207 Value.prototype.set$isFinal = function(value) { return this.isFinal = value; }; 20231 Value.prototype.set$isFinal = function(value) { return this.isFinal = value; };
20208 Value.prototype.get$_typeIsVarOrParameterType = function() { 20232 Value.prototype.get$_typeIsVarOrParameterType = function() {
20209 return $notnull_bool(this.type.get$isVar()) || (this.type instanceof Parameter Type); 20233 return $notnull_bool(this.type.get$isVar()) || (this.type instanceof Parameter Type);
(...skipping 18 matching lines...) Expand all
20228 if ($notnull_bool($ne(member, null))) { 20252 if ($notnull_bool($ne(member, null))) {
20229 return member._set(context, node, this, value, isDynamic); 20253 return member._set(context, node, this, value, isDynamic);
20230 } 20254 }
20231 else { 20255 else {
20232 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value])); 20256 return this.invokeNoSuchMethod(context, ('set:' + name + ''), node, new Argu ments(null, [value]));
20233 } 20257 }
20234 } 20258 }
20235 Value.prototype.invoke = function(context, name, node, args, isDynamic) { 20259 Value.prototype.invoke = function(context, name, node, args, isDynamic) {
20236 if ($notnull_bool(this.get$_typeIsVarOrParameterType()) && name == '\$ne') { 20260 if ($notnull_bool(this.get$_typeIsVarOrParameterType()) && name == '\$ne') {
20237 if (args.values.length != 1) { 20261 if (args.values.length != 1) {
20238 world.warning('wrong number of arguments for !=', node.span); 20262 $globals.world.warning('wrong number of arguments for !=', node.span);
20239 } 20263 }
20240 var eq = this.invoke(context, '\$eq', node, args, isDynamic); 20264 var eq = this.invoke(context, '\$eq', node, args, isDynamic);
20241 world.gen.corejs.useOperator('\$ne'); 20265 $globals.world.gen.corejs.useOperator('\$ne');
20242 return new Value(eq.type, ('\$ne(' + this.code + ', ' + args.values.$index(0 ).code + ')'), node.span, true); 20266 return new Value(eq.type, ('\$ne(' + this.code + ', ' + args.values.$index(0 ).code + ')'), node.span, true);
20243 } 20267 }
20244 if (name == '\$call') { 20268 if (name == '\$call') {
20245 if ($notnull_bool(this.isType)) { 20269 if ($notnull_bool(this.isType)) {
20246 world.error('must use "new" or "const" to construct a new instance', node. span); 20270 $globals.world.error('must use "new" or "const" to construct a new instanc e', node.span);
20247 } 20271 }
20248 if ($notnull_bool(this.type.needsVarCall(args))) { 20272 if ($notnull_bool(this.type.needsVarCall(args))) {
20249 return this._varCall(context, args); 20273 return this._varCall(context, args);
20250 } 20274 }
20251 } 20275 }
20252 var member = this._resolveMember(context, name, node, isDynamic); 20276 var member = this._resolveMember(context, name, node, isDynamic);
20253 if ($notnull_bool(member == null)) { 20277 if ($notnull_bool(member == null)) {
20254 return this.invokeNoSuchMethod(context, name, node, args); 20278 return this.invokeNoSuchMethod(context, name, node, args);
20255 } 20279 }
20256 else { 20280 else {
(...skipping 26 matching lines...) Expand all
20283 else { 20307 else {
20284 return this.type.resolveMember(name); 20308 return this.type.resolveMember(name);
20285 } 20309 }
20286 } 20310 }
20287 Value.prototype._resolveMember = function(context, name, node, isDynamic) { 20311 Value.prototype._resolveMember = function(context, name, node, isDynamic) {
20288 var member; 20312 var member;
20289 if (!$notnull_bool(this.get$_typeIsVarOrParameterType())) { 20313 if (!$notnull_bool(this.get$_typeIsVarOrParameterType())) {
20290 member = this._tryResolveMember(context, name); 20314 member = this._tryResolveMember(context, name);
20291 if ($notnull_bool($ne(member, null)) && $notnull_bool(this.isType) && !$notn ull_bool(member.get$isStatic())) { 20315 if ($notnull_bool($ne(member, null)) && $notnull_bool(this.isType) && !$notn ull_bool(member.get$isStatic())) {
20292 if (!$notnull_bool(isDynamic)) { 20316 if (!$notnull_bool(isDynamic)) {
20293 world.error('can not refer to instance member as static', node.span); 20317 $globals.world.error('can not refer to instance member as static', node. span);
20294 } 20318 }
20295 return null; 20319 return null;
20296 } 20320 }
20297 if ($notnull_bool(member == null) && !$notnull_bool(isDynamic) && !$notnull_ bool(this._hasOverriddenNoSuchMethod())) { 20321 if ($notnull_bool(member == null) && !$notnull_bool(isDynamic) && !$notnull_ bool(this._hasOverriddenNoSuchMethod())) {
20298 var typeName = this.type.name == null ? this.type.get$library().name : thi s.type.name; 20322 var typeName = this.type.name == null ? this.type.get$library().name : thi s.type.name;
20299 var message = ('can not resolve "' + name + '" on "' + typeName + '"'); 20323 var message = ('can not resolve "' + name + '" on "' + typeName + '"');
20300 if ($notnull_bool(this.isType)) { 20324 if ($notnull_bool(this.isType)) {
20301 world.error($assert_String(message), node.span); 20325 $globals.world.error($assert_String(message), node.span);
20302 } 20326 }
20303 else { 20327 else {
20304 world.warning($assert_String(message), node.span); 20328 $globals.world.warning($assert_String(message), node.span);
20305 } 20329 }
20306 } 20330 }
20307 } 20331 }
20308 if ($notnull_bool(member == null) && !$notnull_bool(this.isSuper) && !$notnull _bool(this.isType)) { 20332 if ($notnull_bool(member == null) && !$notnull_bool(this.isSuper) && !$notnull _bool(this.isType)) {
20309 member = context.findMembers(name); 20333 member = context.findMembers(name);
20310 if ($notnull_bool(member == null) && !$notnull_bool(isDynamic)) { 20334 if ($notnull_bool(member == null) && !$notnull_bool(isDynamic)) {
20311 world.warning(('' + name + ' is not defined anywhere in the world.'), node .span); 20335 $globals.world.warning(('' + name + ' is not defined anywhere in the world .'), node.span);
20312 } 20336 }
20313 } 20337 }
20314 return member; 20338 return member;
20315 } 20339 }
20316 Value.prototype.checkFirstClass = function(span) { 20340 Value.prototype.checkFirstClass = function(span) {
20317 if ($notnull_bool(this.isType)) { 20341 if ($notnull_bool(this.isType)) {
20318 world.error('Types are not first class', span); 20342 $globals.world.error('Types are not first class', span);
20319 } 20343 }
20320 } 20344 }
20321 Value.prototype._varCall = function(context, args) { 20345 Value.prototype._varCall = function(context, args) {
20322 var stub = world.functionType.getCallStub(args); 20346 var stub = $globals.world.functionType.getCallStub(args);
20323 return new Value(world.varType, ('' + this.code + '.' + stub.get$name() + '(' + args.getCode() + ')'), this.span, true); 20347 return new Value($globals.world.varType, ('' + this.code + '.' + stub.get$name () + '(' + args.getCode() + ')'), this.span, true);
20324 } 20348 }
20325 Value.prototype.needsConversion = function(toType) { 20349 Value.prototype.needsConversion = function(toType) {
20326 var callMethod = toType.getCallMethod(); 20350 var callMethod = toType.getCallMethod();
20327 if ($notnull_bool($ne(callMethod, null))) { 20351 if ($notnull_bool($ne(callMethod, null))) {
20328 var arity = callMethod.get$parameters().length; 20352 var arity = callMethod.get$parameters().length;
20329 var myCall = this.type.getCallMethod(); 20353 var myCall = this.type.getCallMethod();
20330 if ($notnull_bool(myCall == null) || myCall.get$parameters().length != arity ) { 20354 if ($notnull_bool(myCall == null) || myCall.get$parameters().length != arity ) {
20331 return true; 20355 return true;
20332 } 20356 }
20333 } 20357 }
20334 if ($notnull_bool(options.enableTypeChecks)) { 20358 if ($notnull_bool($globals.options.enableTypeChecks)) {
20335 var fromType = this.type; 20359 var fromType = this.type;
20336 if ($notnull_bool(this.type.get$isVar()) && (this.code != 'null' || !$notnul l_bool(toType.get$isNullable()))) { 20360 if ($notnull_bool(this.type.get$isVar()) && (this.code != 'null' || !$notnul l_bool(toType.get$isNullable()))) {
20337 fromType = world.objectType; 20361 fromType = $globals.world.objectType;
20338 } 20362 }
20339 var bothNum = $notnull_bool(this.type.get$isNum()) && $notnull_bool(toType.g et$isNum()); 20363 var bothNum = $notnull_bool(this.type.get$isNum()) && $notnull_bool(toType.g et$isNum());
20340 return $notnull_bool(fromType.isSubtypeOf(toType)) || $notnull_bool(bothNum) ; 20364 return $notnull_bool(fromType.isSubtypeOf(toType)) || $notnull_bool(bothNum) ;
20341 } 20365 }
20342 return false; 20366 return false;
20343 } 20367 }
20344 Value.prototype.convertTo = function(context, toType, node, isDynamic) { 20368 Value.prototype.convertTo = function(context, toType, node, isDynamic) {
20345 var $0; 20369 var $0;
20346 var checked = !$notnull_bool(isDynamic); 20370 var checked = !$notnull_bool(isDynamic);
20347 var callMethod = toType.getCallMethod(); 20371 var callMethod = toType.getCallMethod();
20348 if ($notnull_bool($ne(callMethod, null))) { 20372 if ($notnull_bool($ne(callMethod, null))) {
20349 if ($notnull_bool(checked) && !$notnull_bool(toType.isAssignable(this.type)) ) { 20373 if ($notnull_bool(checked) && !$notnull_bool(toType.isAssignable(this.type)) ) {
20350 this.convertWarning(toType, node); 20374 this.convertWarning(toType, node);
20351 } 20375 }
20352 var arity = callMethod.get$parameters().length; 20376 var arity = callMethod.get$parameters().length;
20353 var myCall = this.type.getCallMethod(); 20377 var myCall = this.type.getCallMethod();
20354 if ($notnull_bool(myCall == null) || myCall.get$parameters().length != arity ) { 20378 if ($notnull_bool(myCall == null) || myCall.get$parameters().length != arity ) {
20355 var stub = world.functionType.getCallStub(Arguments.Arguments$bare$factory (arity)); 20379 var stub = $globals.world.functionType.getCallStub(Arguments.Arguments$bar e$factory(arity));
20356 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, true); 20380 var val = new Value(toType, ('to\$' + stub.name + '(' + this.code + ')'), node.span, true);
20357 return (($0 = $notnull_bool(this._isDomCallback(toType)) && !$notnull_bool (this._isDomCallback(this.type)) ? val._wrapDomCallback(toType, arity) : val) && $0.is$Value()); 20381 return (($0 = $notnull_bool(this._isDomCallback(toType)) && !$notnull_bool (this._isDomCallback(this.type)) ? val._wrapDomCallback(toType, arity) : val) && $0.is$Value());
20358 } 20382 }
20359 else if ($notnull_bool(this._isDomCallback(toType)) && !$notnull_bool(this._ isDomCallback(this.type))) { 20383 else if ($notnull_bool(this._isDomCallback(toType)) && !$notnull_bool(this._ isDomCallback(this.type))) {
20360 return this._wrapDomCallback(toType, arity); 20384 return this._wrapDomCallback(toType, arity);
20361 } 20385 }
20362 } 20386 }
20363 var fromType = this.type; 20387 var fromType = this.type;
20364 if ($notnull_bool(this.type.get$isVar()) && (this.code != 'null' || !$notnull_ bool(toType.get$isNullable()))) { 20388 if ($notnull_bool(this.type.get$isVar()) && (this.code != 'null' || !$notnull_ bool(toType.get$isNullable()))) {
20365 fromType = world.objectType; 20389 fromType = $globals.world.objectType;
20366 } 20390 }
20367 var bothNum = $notnull_bool(this.type.get$isNum()) && $notnull_bool(toType.get $isNum()); 20391 var bothNum = $notnull_bool(this.type.get$isNum()) && $notnull_bool(toType.get $isNum());
20368 if ($notnull_bool(fromType.isSubtypeOf(toType)) || $notnull_bool(bothNum)) { 20392 if ($notnull_bool(fromType.isSubtypeOf(toType)) || $notnull_bool(bothNum)) {
20369 return this; 20393 return this;
20370 } 20394 }
20371 if ($notnull_bool(checked) && !$notnull_bool(toType.isSubtypeOf(this.type))) { 20395 if ($notnull_bool(checked) && !$notnull_bool(toType.isSubtypeOf(this.type))) {
20372 this.convertWarning(toType, node); 20396 this.convertWarning(toType, node);
20373 } 20397 }
20374 if ($notnull_bool(options.enableTypeChecks)) { 20398 if ($notnull_bool($globals.options.enableTypeChecks)) {
20375 return this._typeAssert(context, toType, node); 20399 return this._typeAssert(context, toType, node);
20376 } 20400 }
20377 else { 20401 else {
20378 return this; 20402 return this;
20379 } 20403 }
20380 } 20404 }
20381 Value.prototype._isDomCallback = function(toType) { 20405 Value.prototype._isDomCallback = function(toType) {
20382 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT ype.get$library(), world.get$dom())); 20406 return ((toType.get$definition() instanceof FunctionTypeDefinition) && $eq(toT ype.get$library(), $globals.world.get$dom()));
20383 } 20407 }
20384 Value.prototype._wrapDomCallback = function(toType, arity) { 20408 Value.prototype._wrapDomCallback = function(toType, arity) {
20385 if (arity == 0) { 20409 if (arity == 0) {
20386 world.gen.corejs.useWrap0 = true; 20410 $globals.world.gen.corejs.useWrap0 = true;
20387 } 20411 }
20388 else { 20412 else {
20389 world.gen.corejs.useWrap1 = true; 20413 $globals.world.gen.corejs.useWrap1 = true;
20390 } 20414 }
20391 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true); 20415 return new Value(toType, ('\$wrap_call\$' + arity + '(' + this.code + ')'), th is.span, true);
20392 } 20416 }
20393 Value.prototype._typeAssert = function(context, toType, node) { 20417 Value.prototype._typeAssert = function(context, toType, node) {
20394 if ((toType instanceof ParameterType)) { 20418 if ((toType instanceof ParameterType)) {
20395 var p = (toType && toType.is$ParameterType()); 20419 var p = (toType && toType.is$ParameterType());
20396 toType = p.extendsType; 20420 toType = p.extendsType;
20397 } 20421 }
20398 if (toType.getCallMethod() != null) { 20422 if (toType.getCallMethod() != null) {
20399 return this; 20423 return this;
20400 } 20424 }
20401 if ($notnull_bool(toType.get$isObject()) || $notnull_bool(toType.get$isVar())) { 20425 if ($notnull_bool(toType.get$isObject()) || $notnull_bool(toType.get$isVar())) {
20402 world.internalError(('We thought ' + this.type.name + ' is not a subtype of ' + toType.name + '?')); 20426 $globals.world.internalError(('We thought ' + this.type.name + ' is not a su btype of ' + toType.name + '?'));
20403 } 20427 }
20404 if ($notnull_bool(toType.get$isNum())) toType = world.numType; 20428 if ($notnull_bool(toType.get$isNum())) toType = $globals.world.numType;
20405 var check; 20429 var check;
20406 if ($notnull_bool(toType.get$isVoid())) { 20430 if ($notnull_bool(toType.get$isVoid())) {
20407 check = ('\$assert_void(' + this.code + ')'); 20431 check = ('\$assert_void(' + this.code + ')');
20408 if (toType.typeCheckCode == null) { 20432 if (toType.typeCheckCode == null) {
20409 toType.typeCheckCode = "function $assert_void(x) {\n return x == null ? x : x.is$void(); // throws TypeError\n}"; 20433 toType.typeCheckCode = "function $assert_void(x) {\n return x == null ? x : x.is$void(); // throws TypeError\n}";
20410 } 20434 }
20411 } 20435 }
20412 else if ($eq(toType, world.nonNullBool)) { 20436 else if ($eq(toType, $globals.world.nonNullBool)) {
20413 world.gen.corejs.useNotNullBool = true; 20437 $globals.world.gen.corejs.useNotNullBool = true;
20414 check = ('\$notnull_bool(' + this.code + ')'); 20438 check = ('\$notnull_bool(' + this.code + ')');
20415 } 20439 }
20416 else if ($notnull_bool(toType.get$library().get$isCore()) && toType.get$typeof Name() != null) { 20440 else if ($notnull_bool(toType.get$library().get$isCore()) && toType.get$typeof Name() != null) {
20417 check = ('\$assert_' + toType.name + '(' + this.code + ')'); 20441 check = ('\$assert_' + toType.name + '(' + this.code + ')');
20418 if (toType.typeCheckCode == null) { 20442 if (toType.typeCheckCode == null) {
20419 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}"); 20443 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}");
20420 } 20444 }
20421 } 20445 }
20422 else { 20446 else {
20423 toType.isTested = true; 20447 toType.isTested = true;
20424 var temp = context.getTemp(this); 20448 var temp = context.getTemp(this);
20425 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 20449 check = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
20426 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())'); 20450 check = check + (' ' + temp.code + '.is\$' + toType.get$jsname() + '())');
20427 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); 20451 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value()));
20428 } 20452 }
20429 return new Value(toType, check, this.span, true); 20453 return new Value(toType, check, this.span, true);
20430 } 20454 }
20431 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { 20455 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) {
20432 if ($notnull_bool(toType.get$isVar())) { 20456 if ($notnull_bool(toType.get$isVar())) {
20433 world.error('can not resolve type', span); 20457 $globals.world.error('can not resolve type', span);
20434 } 20458 }
20435 var testCode = null; 20459 var testCode = null;
20436 if ($notnull_bool(toType.get$isVar()) || $notnull_bool(toType.get$isObject()) || (toType instanceof ParameterType)) { 20460 if ($notnull_bool(toType.get$isVar()) || $notnull_bool(toType.get$isObject()) || (toType instanceof ParameterType)) {
20437 if ($notnull_bool(this.needsTemp)) { 20461 if ($notnull_bool(this.needsTemp)) {
20438 return new Value(world.nonNullBool, ('(' + this.code + ', true)'), span, t rue); 20462 return new Value($globals.world.nonNullBool, ('(' + this.code + ', true)') , span, true);
20439 } 20463 }
20440 else { 20464 else {
20441 return EvaluatedValue.EvaluatedValue$factory(world.nonNullBool, true, 'tru e', null); 20465 return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, t rue, 'true', null);
20442 } 20466 }
20443 } 20467 }
20444 if ($notnull_bool(toType.get$library().get$isCore())) { 20468 if ($notnull_bool(toType.get$library().get$isCore())) {
20445 var typeofName = toType.get$typeofName(); 20469 var typeofName = toType.get$typeofName();
20446 if ($notnull_bool($ne(typeofName, null))) { 20470 if ($notnull_bool($ne(typeofName, null))) {
20447 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '==' : '!=') + " '" + typeofName + "')"); 20471 testCode = ("(typeof(" + this.code + ") " + ($notnull_bool(isTrue) ? '==' : '!=') + " '" + typeofName + "')");
20448 } 20472 }
20449 } 20473 }
20450 if ($notnull_bool(toType.get$isClass()) && !(toType instanceof ConcreteType)) { 20474 if ($notnull_bool(toType.get$isClass()) && !(toType instanceof ConcreteType)) {
20451 toType.markUsed(); 20475 toType.markUsed();
20452 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')'); 20476 testCode = ('(' + this.code + ' instanceof ' + toType.get$jsname() + ')');
20453 if (!$notnull_bool(isTrue)) { 20477 if (!$notnull_bool(isTrue)) {
20454 testCode = '!' + testCode; 20478 testCode = '!' + testCode;
20455 } 20479 }
20456 } 20480 }
20457 if (testCode == null) { 20481 if (testCode == null) {
20458 toType.isTested = true; 20482 toType.isTested = true;
20459 var temp = context.getTemp(this); 20483 var temp = context.getTemp(this);
20460 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&'); 20484 testCode = ('(' + context.assignTemp((temp && temp.is$Value()), this).code + ' &&');
20461 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')' ); 20485 testCode = testCode + (' ' + temp.code + '.is\$' + toType.get$jsname() + ')' );
20462 if ($notnull_bool(isTrue)) { 20486 if ($notnull_bool(isTrue)) {
20463 testCode = '!!' + testCode; 20487 testCode = '!!' + testCode;
20464 } 20488 }
20465 else { 20489 else {
20466 testCode = '!' + testCode; 20490 testCode = '!' + testCode;
20467 } 20491 }
20468 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value())); 20492 if ($ne(this, temp)) context.freeTemp((temp && temp.is$Value()));
20469 } 20493 }
20470 return new Value(world.nonNullBool, testCode, span, true); 20494 return new Value($globals.world.nonNullBool, testCode, span, true);
20471 } 20495 }
20472 Value.prototype.convertWarning = function(toType, node) { 20496 Value.prototype.convertWarning = function(toType, node) {
20473 world.warning(('type "' + this.type.name + '" is not assignable to "' + toType .name + '"'), node.span); 20497 $globals.world.warning(('type "' + this.type.name + '" is not assignable to "' + toType.name + '"'), node.span);
20474 } 20498 }
20475 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { 20499 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
20476 var pos = ''; 20500 var pos = '';
20477 if (args != null) { 20501 if (args != null) {
20478 var argsCode = []; 20502 var argsCode = [];
20479 for (var i = 0; 20503 for (var i = 0;
20480 i < args.get$length(); i++) { 20504 i < args.get$length(); i++) {
20481 argsCode.add$1(args.values.$index(i).code); 20505 argsCode.add$1(args.values.$index(i).code);
20482 } 20506 }
20483 pos = Strings.join((argsCode && argsCode.is$List$String()), ", "); 20507 pos = Strings.join((argsCode && argsCode.is$List$String()), ", ");
20484 } 20508 }
20485 var noSuchArgs = [new Value(world.stringType, ('"' + name + '"'), node.span, t rue), new Value(world.listType, ('[' + pos + ']'), node.span, true)]; 20509 var noSuchArgs = [new Value($globals.world.stringType, ('"' + name + '"'), nod e.span, true), new Value($globals.world.listType, ('[' + pos + ']'), node.span, true)];
20486 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont ext, node, this, new Arguments(null, noSuchArgs)); 20510 return this._resolveMember(context, 'noSuchMethod', node, false).invoke$4(cont ext, node, this, new Arguments(null, noSuchArgs));
20487 } 20511 }
20488 Value.prototype.invokeSpecial = function(name, args, returnType) { 20512 Value.prototype.invokeSpecial = function(name, args, returnType) {
20489 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 483, 12 ); 20513 $assert(name.startsWith('\$'), "name.startsWith('\\$')", "value.dart", 483, 12 );
20490 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 84, 12); 20514 $assert(!$notnull_bool(args.get$hasNames()), "!args.hasNames", "value.dart", 4 84, 12);
20491 var argsString = args.getCode(); 20515 var argsString = args.getCode();
20492 if (name == '\$index' || name == '\$setindex') { 20516 if (name == '\$index' || name == '\$setindex') {
20493 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true); 20517 return new Value(returnType, ('' + this.code + '.' + name + '(' + argsString + ')'), this.span, true);
20494 } 20518 }
20495 else { 20519 else {
20496 if (argsString.length > 0) argsString = (', ' + argsString + ''); 20520 if (argsString.length > 0) argsString = (', ' + argsString + '');
20497 world.gen.corejs.useOperator(name); 20521 $globals.world.gen.corejs.useOperator(name);
20498 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, true); 20522 return new Value(returnType, ('' + name + '(' + this.code + '' + argsString + ')'), this.span, true);
20499 } 20523 }
20500 } 20524 }
20501 Value.prototype.checkFirstClass$1 = function($0) { 20525 Value.prototype.checkFirstClass$1 = function($0) {
20502 return this.checkFirstClass(($0 && $0.is$SourceSpan())); 20526 return this.checkFirstClass(($0 && $0.is$SourceSpan()));
20503 }; 20527 };
20504 Value.prototype.convertTo$3 = function($0, $1, $2) { 20528 Value.prototype.convertTo$3 = function($0, $1, $2) {
20505 return this.convertTo(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Type( )), ($2 && $2.is$lang_Node()), false); 20529 return this.convertTo(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Type( )), ($2 && $2.is$lang_Node()), false);
20506 }; 20530 };
20507 Value.prototype.convertTo$4 = function($0, $1, $2, $3) { 20531 Value.prototype.convertTo$4 = function($0, $1, $2, $3) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
20600 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + '')); 20624 fieldValues.add(('' + f + ' = ' + fields.$index(f).get$actualValue() + ''));
20601 } 20625 }
20602 fieldValues.sort((function (a, b) { 20626 fieldValues.sort((function (a, b) {
20603 return a.compareTo$1(b); 20627 return a.compareTo$1(b);
20604 }) 20628 })
20605 ); 20629 );
20606 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa lues, ',') + ']'; 20630 var actualValue = ('const ' + type.get$jsname() + ' [') + Strings.join(fieldVa lues, ',') + ']';
20607 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span)); 20631 return new ConstObjectValue._internal$ctor(type, fields, actualValue, canonica lCode, span, EvaluatedValue.codeWithComments(canonicalCode, span));
20608 } 20632 }
20609 // ********** Code for GlobalValue ************** 20633 // ********** Code for GlobalValue **************
20610 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, dependencies) { 20634 function GlobalValue(type, code, isConst, field, name, exp, canonicalCode, span, _dependencies) {
20611 this.field = field; 20635 this.field = field;
20612 this.name = name; 20636 this.name = name;
20613 this.exp = exp; 20637 this.exp = exp;
20614 this.canonicalCode = canonicalCode; 20638 this.canonicalCode = canonicalCode;
20615 this.dependencies = dependencies; 20639 this.dependencies = [];
20616 // Initializers done 20640 // Initializers done
20617 Value.call(this, type, code, span, !$notnull_bool(isConst)); 20641 Value.call(this, type, code, span, !$notnull_bool(isConst));
20642 for (var $i = 0;$i < _dependencies.length; $i++) {
20643 var dep = _dependencies.$index($i);
20644 this.dependencies.add(dep);
20645 this.dependencies.addAll(dep.dependencies);
20646 }
20618 } 20647 }
20619 $inherits(GlobalValue, Value); 20648 $inherits(GlobalValue, Value);
20620 GlobalValue.prototype.is$GlobalValue = function(){return this;}; 20649 GlobalValue.prototype.is$GlobalValue = function(){return this;};
20621 GlobalValue.prototype.is$Comparable = function(){return this;}; 20650 GlobalValue.prototype.is$Comparable = function(){return this;};
20622 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) { 20651 GlobalValue.GlobalValue$fromStatic$factory = function(field, exp, dependencies) {
20652 var $0;
20623 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode); 20653 var code = ($notnull_bool(exp.get$isConst()) ? exp.get$canonicalCode() : exp.c ode);
20624 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie ld.get$name() + '*/'); 20654 var codeWithComment = ('' + code + '/*' + field.declaringType.name + '.' + fie ld.get$name() + '*/');
20625 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.get$is Final(), field, null, exp, code, exp.span, dependencies.filter$1((function (d) { 20655 return new GlobalValue(exp.type, $assert_String(codeWithComment), field.get$is Final(), field, null, exp, code, exp.span, (($0 = dependencies.filter$1((functio n (d) {
20626 return (d instanceof GlobalValue); 20656 return (d instanceof GlobalValue);
20627 }) 20657 })
20628 )); 20658 )) && $0.is$List$GlobalValue()));
20629 } 20659 }
20630 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) { 20660 GlobalValue.GlobalValue$fromConst$factory = function(uniqueId, exp, dependencies ) {
20661 var $0;
20631 var name = ("const\$" + uniqueId + ""); 20662 var name = ("const\$" + uniqueId + "");
20632 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/"); 20663 var codeWithComment = ("" + name + "/*" + exp.span.get$text() + "*/");
20633 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null, name, exp, name, exp.span, dependencies.filter$1((function (d) { 20664 return new GlobalValue(exp.type, $assert_String(codeWithComment), true, null, name, exp, name, exp.span, (($0 = dependencies.filter$1((function (d) {
20634 return (d instanceof GlobalValue); 20665 return (d instanceof GlobalValue);
20635 }) 20666 })
20636 )); 20667 )) && $0.is$List$GlobalValue()));
20637 } 20668 }
20638 GlobalValue.prototype.get$name = function() { return this.name; }; 20669 GlobalValue.prototype.get$name = function() { return this.name; };
20639 GlobalValue.prototype.set$name = function(value) { return this.name = value; }; 20670 GlobalValue.prototype.set$name = function(value) { return this.name = value; };
20640 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; }; 20671 GlobalValue.prototype.get$canonicalCode = function() { return this.canonicalCode ; };
20641 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; }; 20672 GlobalValue.prototype.set$canonicalCode = function(value) { return this.canonica lCode = value; };
20642 GlobalValue.prototype.get$isConst = function() { 20673 GlobalValue.prototype.get$isConst = function() {
20643 return $notnull_bool(this.exp.get$isConst()) && (this.field == null || $notnul l_bool(this.field.isFinal)); 20674 return $notnull_bool(this.exp.get$isConst()) && (this.field == null || $notnul l_bool(this.field.isFinal));
20644 } 20675 }
20645 GlobalValue.prototype.get$actualValue = function() { 20676 GlobalValue.prototype.get$actualValue = function() {
20646 return this.exp.get$dynamic().get$actualValue(); 20677 return this.exp.get$dynamic().get$actualValue();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
20679 }; 20710 };
20680 // ********** Code for BareValue ************** 20711 // ********** Code for BareValue **************
20681 function BareValue(home, outermost, span) { 20712 function BareValue(home, outermost, span) {
20682 this.home = home; 20713 this.home = home;
20683 // Initializers done 20714 // Initializers done
20684 Value.call(this, outermost.method.declaringType, null, span, false); 20715 Value.call(this, outermost.method.declaringType, null, span, false);
20685 this.isType = outermost.get$isStatic(); 20716 this.isType = outermost.get$isStatic();
20686 } 20717 }
20687 $inherits(BareValue, Value); 20718 $inherits(BareValue, Value);
20688 BareValue.prototype._tryResolveMember = function(context, name) { 20719 BareValue.prototype._tryResolveMember = function(context, name) {
20689 $assert($eq(context, this.home), "context == home", "value.dart", 688, 12); 20720 $assert($eq(context, this.home), "context == home", "value.dart", 694, 12);
20690 var member = this.type.resolveMember(name); 20721 var member = this.type.resolveMember(name);
20691 if ($notnull_bool($ne(member, null))) { 20722 if ($notnull_bool($ne(member, null))) {
20692 $assert(this.code == null, "code == null", "value.dart", 693, 14); 20723 $assert(this.code == null, "code == null", "value.dart", 699, 14);
20693 if ($notnull_bool(this.isType)) { 20724 if ($notnull_bool(this.isType)) {
20694 this.code = this.type.get$jsname(); 20725 this.code = this.type.get$jsname();
20695 } 20726 }
20696 else { 20727 else {
20697 this.code = this.home._makeThisCode(); 20728 this.code = this.home._makeThisCode();
20698 } 20729 }
20699 return member; 20730 return member;
20700 } 20731 }
20701 member = this.home.get$library().lookup(name, this.span); 20732 member = this.home.get$library().lookup(name, this.span);
20702 if ($notnull_bool($ne(member, null))) { 20733 if ($notnull_bool($ne(member, null))) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
20781 else { 20812 else {
20782 mset.get$members().add$1(member); 20813 mset.get$members().add$1(member);
20783 } 20814 }
20784 } 20815 }
20785 World.prototype._addTopName = function(named) { 20816 World.prototype._addTopName = function(named) {
20786 var existing = this._topNames.$index(named.get$name()); 20817 var existing = this._topNames.$index(named.get$name());
20787 if ($notnull_bool($ne(existing, null))) { 20818 if ($notnull_bool($ne(existing, null))) {
20788 this.info(('mangling matching top level name "' + named.get$name() + '" in ' ) + ('both "' + named.get$library().name + '" and "' + existing.get$library().na me + '"')); 20819 this.info(('mangling matching top level name "' + named.get$name() + '" in ' ) + ('both "' + named.get$library().name + '" and "' + existing.get$library().na me + '"'));
20789 if ($notnull_bool(named.get$isNative())) { 20820 if ($notnull_bool(named.get$isNative())) {
20790 if ($notnull_bool(existing.get$isNative())) { 20821 if ($notnull_bool(existing.get$isNative())) {
20791 world.internalError(('conflicting native names "' + named.get$name() + ' " ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'), named.get$span()); 20822 $globals.world.internalError(('conflicting native names "' + named.get$n ame() + '" ') + ('(already defined in ' + existing.get$span().get$locationText() + ')'), named.get$span());
20792 } 20823 }
20793 else { 20824 else {
20794 this._topNames.$setindex(named.get$name(), named); 20825 this._topNames.$setindex(named.get$name(), named);
20795 this._addJavascriptTopName((existing && existing.is$Named())); 20826 this._addJavascriptTopName((existing && existing.is$Named()));
20796 } 20827 }
20797 } 20828 }
20798 else if ($notnull_bool(named.get$library().get$isCore())) { 20829 else if ($notnull_bool(named.get$library().get$isCore())) {
20799 if ($notnull_bool(existing.get$library().get$isCore())) { 20830 if ($notnull_bool(existing.get$library().get$isCore())) {
20800 world.internalError(('conflicting top-level names in core "' + named.get $name() + '" ') + ('(previously defined in ' + existing.get$span().get$locationT ext() + ')'), named.get$span()); 20831 $globals.world.internalError(('conflicting top-level names in core "' + named.get$name() + '" ') + ('(previously defined in ' + existing.get$span().get$ locationText() + ')'), named.get$span());
20801 } 20832 }
20802 else { 20833 else {
20803 this._topNames.$setindex(named.get$name(), named); 20834 this._topNames.$setindex(named.get$name(), named);
20804 this._addJavascriptTopName((existing && existing.is$Named())); 20835 this._addJavascriptTopName((existing && existing.is$Named()));
20805 } 20836 }
20806 } 20837 }
20807 else { 20838 else {
20808 this._addJavascriptTopName(named); 20839 this._addJavascriptTopName(named);
20809 } 20840 }
20810 } 20841 }
20811 else { 20842 else {
20812 this._topNames.$setindex(named.get$name(), named); 20843 this._topNames.$setindex(named.get$name(), named);
20813 } 20844 }
20814 } 20845 }
20815 World.prototype._addJavascriptTopName = function(named) { 20846 World.prototype._addJavascriptTopName = function(named) {
20816 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name () + '')); 20847 named.set$jsname(('' + named.get$library().get$jsname() + '_' + named.get$name () + ''));
20817 var existing = this._topNames.$index(named.get$jsname()); 20848 var existing = this._topNames.$index(named.get$jsname());
20818 if ($notnull_bool($ne(existing, null)) && $notnull_bool($ne(existing, named))) { 20849 if ($notnull_bool($ne(existing, null)) && $notnull_bool($ne(existing, named))) {
20819 world.internalError(('name mangling failed for "' + named.get$jsname() + '" ') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$span().get $locationText() + ')'), named.get$span()); 20850 $globals.world.internalError(('name mangling failed for "' + named.get$jsnam e() + '" ') + ('("' + named.get$jsname() + '" defined also in ' + existing.get$s pan().get$locationText() + ')'), named.get$span());
20820 } 20851 }
20821 this._topNames.$setindex(named.get$jsname(), named); 20852 this._topNames.$setindex(named.get$jsname(), named);
20822 } 20853 }
20823 World.prototype._addType = function(type) { 20854 World.prototype._addType = function(type) {
20824 if (!$notnull_bool(type.get$isTop())) this._addTopName(type); 20855 if (!$notnull_bool(type.get$isTop())) this._addTopName(type);
20825 } 20856 }
20826 World.prototype._addToCoreLib = function(name, isClass) { 20857 World.prototype._addToCoreLib = function(name, isClass) {
20827 var ret = new DefinedType(name, this.corelib, null, isClass); 20858 var ret = new DefinedType(name, this.corelib, null, isClass);
20828 this.corelib.types.$setindex(name, ret); 20859 this.corelib.types.$setindex(name, ret);
20829 return ret; 20860 return ret;
20830 } 20861 }
20831 World.prototype.toJsIdentifier = function(name) { 20862 World.prototype.toJsIdentifier = function(name) {
20832 if (this._jsKeywords == null) { 20863 if (this._jsKeywords == null) {
20833 this._jsKeywords = HashSetImplementation.HashSetImplementation$from$factory( ['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'e lse', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', ' switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'clas s', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', ' let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'native']) ; 20864 this._jsKeywords = HashSetImplementation.HashSetImplementation$from$factory( ['break', 'case', 'catch', 'continue', 'debugger', 'default', 'delete', 'do', 'e lse', 'finally', 'for', 'function', 'if', 'in', 'instanceof', 'new', 'return', ' switch', 'this', 'throw', 'try', 'typeof', 'var', 'void', 'while', 'with', 'clas s', 'enum', 'export', 'extends', 'import', 'super', 'implements', 'interface', ' let', 'package', 'private', 'protected', 'public', 'static', 'yield', 'native']) ;
20834 } 20865 }
20835 if (this._jsKeywords.contains(name)) { 20866 if (this._jsKeywords.contains(name)) {
20836 return name + '_'; 20867 return name + '_';
20837 } 20868 }
20838 else { 20869 else {
20839 return name; 20870 return name;
20840 } 20871 }
20841 } 20872 }
20842 World.prototype.compile = function() { 20873 World.prototype.compile = function() {
20843 if (options.dartScript == null) { 20874 if ($globals.options.dartScript == null) {
20844 this.fatal('no script provided to compile'); 20875 this.fatal('no script provided to compile');
20845 return false; 20876 return false;
20846 } 20877 }
20847 try { 20878 try {
20848 this.info(('compiling ' + options.dartScript + ' with corelib ' + this.corel ib + '')); 20879 this.info(('compiling ' + $globals.options.dartScript + ' with corelib ' + t his.corelib + ''));
20849 if (!$notnull_bool(this.runLeg())) this.runCompilationPhases(); 20880 if (!$notnull_bool(this.runLeg())) this.runCompilationPhases();
20850 } catch (exc) { 20881 } catch (exc) {
20851 exc = $toDartException(exc); 20882 exc = $toDartException(exc);
20852 if ($notnull_bool(this.get$hasErrors()) && !$notnull_bool(options.throwOnErr ors)) { 20883 if ($notnull_bool(this.get$hasErrors()) && !$notnull_bool($globals.options.t hrowOnErrors)) {
20853 } 20884 }
20854 else { 20885 else {
20855 throw exc; 20886 throw exc;
20856 } 20887 }
20857 } 20888 }
20858 this.printStatus(); 20889 this.printStatus();
20859 return !$notnull_bool(this.get$hasErrors()); 20890 return !$notnull_bool(this.get$hasErrors());
20860 } 20891 }
20861 World.prototype.runLeg = function() { 20892 World.prototype.runLeg = function() {
20862 var $this = this; // closure support 20893 var $this = this; // closure support
20863 if (!$notnull_bool(options.enableLeg)) return false; 20894 if (!$notnull_bool($globals.options.enableLeg)) return false;
20864 var res = $assert_bool(this.withTiming('try leg compile', (function () { 20895 var res = $assert_bool(this.withTiming('try leg compile', (function () {
20865 return compile($this); 20896 return compile($this);
20866 }) 20897 })
20867 )); 20898 ));
20868 if (!$notnull_bool(res) && $notnull_bool(options.legOnly)) { 20899 if (!$notnull_bool(res) && $notnull_bool($globals.options.legOnly)) {
20869 this.fatal(("Leg could not compile " + options.dartScript + "")); 20900 this.fatal(("Leg could not compile " + $globals.options.dartScript + ""));
20870 return true; 20901 return true;
20871 } 20902 }
20872 return res; 20903 return res;
20873 } 20904 }
20874 World.prototype.runCompilationPhases = function() { 20905 World.prototype.runCompilationPhases = function() {
20875 var $this = this; // closure support 20906 var $this = this; // closure support
20876 var lib = this.withTiming('first pass', (function () { 20907 var lib = this.withTiming('first pass', (function () {
20877 return $this.processScript(options.dartScript); 20908 return $this.processScript($globals.options.dartScript);
20878 }) 20909 })
20879 ); 20910 );
20880 this.withTiming('resolve top level', (function () { 20911 this.withTiming('resolve top level', (function () {
20881 $this.resolveAll(); 20912 $this.resolveAll();
20882 }) 20913 })
20883 ); 20914 );
20884 this.withTiming('generate code', (function () { 20915 this.withTiming('generate code', (function () {
20885 var mainMembers = lib.topType.resolveMember('main'); 20916 var mainMembers = lib.topType.resolveMember('main');
20886 var main = null; 20917 var main = null;
20887 if ($notnull_bool(mainMembers == null) || mainMembers.get$members().length = = 0) { 20918 if ($notnull_bool(mainMembers == null) || mainMembers.get$members().length = = 0) {
(...skipping 12 matching lines...) Expand all
20900 } 20931 }
20901 var codeWriter = new CodeWriter(); 20932 var codeWriter = new CodeWriter();
20902 $this.gen = new WorldGenerator(main, codeWriter); 20933 $this.gen = new WorldGenerator(main, codeWriter);
20903 $this.gen.run(); 20934 $this.gen.run();
20904 $this.jsBytesWritten = codeWriter.get$text().length; 20935 $this.jsBytesWritten = codeWriter.get$text().length;
20905 }) 20936 })
20906 ); 20937 );
20907 } 20938 }
20908 World.prototype.getGeneratedCode = function() { 20939 World.prototype.getGeneratedCode = function() {
20909 if (this.legCode != null) { 20940 if (this.legCode != null) {
20910 $assert(options.enableLeg, "options.enableLeg", "world.dart", 310, 14); 20941 $assert($globals.options.enableLeg, "options.enableLeg", "world.dart", 310, 14);
20911 return this.legCode; 20942 return this.legCode;
20912 } 20943 }
20913 else { 20944 else {
20914 return this.gen.writer.get$text(); 20945 return this.gen.writer.get$text();
20915 } 20946 }
20916 } 20947 }
20917 World.prototype.readFile = function(filename) { 20948 World.prototype.readFile = function(filename) {
20918 try { 20949 try {
20919 var sourceFile = this.reader.readFile(filename); 20950 var sourceFile = this.reader.readFile(filename);
20920 this.dartBytesRead += sourceFile.get$text().length; 20951 this.dartBytesRead += sourceFile.get$text().length;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
20975 } 21006 }
20976 if (span2 != null) { 21007 if (span2 != null) {
20977 print(span2.toMessageString(message)); 21008 print(span2.toMessageString(message));
20978 } 21009 }
20979 if ($notnull_bool(throwing)) { 21010 if ($notnull_bool(throwing)) {
20980 $throw(new CompilerException(message, span)); 21011 $throw(new CompilerException(message, span));
20981 } 21012 }
20982 } 21013 }
20983 World.prototype.error = function(message, span, span1, span2) { 21014 World.prototype.error = function(message, span, span1, span2) {
20984 this.errors++; 21015 this.errors++;
20985 this._message(('error: ' + message + ''), span, span1, span2, options.throwOnE rrors); 21016 this._message(('error: ' + message + ''), span, span1, span2, $globals.options .throwOnErrors);
20986 } 21017 }
20987 World.prototype.warning = function(message, span, span1, span2) { 21018 World.prototype.warning = function(message, span, span1, span2) {
20988 this.warnings++; 21019 this.warnings++;
20989 if ($notnull_bool(options.showWarnings)) { 21020 if ($notnull_bool($globals.options.showWarnings)) {
20990 this._message(('warning: ' + message + ''), span, span1, span2, options.thro wOnWarnings); 21021 this._message(('warning: ' + message + ''), span, span1, span2, $globals.opt ions.throwOnWarnings);
20991 } 21022 }
20992 } 21023 }
20993 World.prototype.fatal = function(message, span, span1, span2) { 21024 World.prototype.fatal = function(message, span, span1, span2) {
20994 this.errors++; 21025 this.errors++;
20995 this.seenFatal = true; 21026 this.seenFatal = true;
20996 this._message(('fatal: ' + message + ''), span, span1, span2, $notnull_bool(op tions.throwOnFatal) || $notnull_bool(options.throwOnErrors)); 21027 this._message(('fatal: ' + message + ''), span, span1, span2, $notnull_bool($g lobals.options.throwOnFatal) || $notnull_bool($globals.options.throwOnErrors));
20997 } 21028 }
20998 World.prototype.internalError = function(message, span, span1, span2) { 21029 World.prototype.internalError = function(message, span, span1, span2) {
20999 this._message(('We are sorry, but... ' + message + ''), span, span1, span2, tr ue); 21030 this._message(('We are sorry, but... ' + message + ''), span, span1, span2, tr ue);
21000 } 21031 }
21001 World.prototype.info = function(message, span, span1, span2) { 21032 World.prototype.info = function(message, span, span1, span2) {
21002 if ($notnull_bool(options.showInfo)) { 21033 if ($notnull_bool($globals.options.showInfo)) {
21003 this._message(('info: ' + message + ''), span, span1, span2, false); 21034 this._message(('info: ' + message + ''), span, span1, span2, false);
21004 } 21035 }
21005 } 21036 }
21006 World.prototype.get$hasErrors = function() { 21037 World.prototype.get$hasErrors = function() {
21007 return this.errors > 0; 21038 return this.errors > 0;
21008 } 21039 }
21009 World.prototype.printStatus = function() { 21040 World.prototype.printStatus = function() {
21010 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes Written + ' bytes JS')); 21041 this.info(('compiled ' + this.dartBytesRead + ' bytes Dart -> ' + this.jsBytes Written + ' bytes JS'));
21011 if ($notnull_bool(this.get$hasErrors())) { 21042 if ($notnull_bool(this.get$hasErrors())) {
21012 print(('compilation failed with ' + this.errors + ' errors')); 21043 print(('compilation failed with ' + this.errors + ' errors'));
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
21149 this.libDir = $assert_String(temp); 21180 this.libDir = $assert_String(temp);
21150 } 21181 }
21151 else { 21182 else {
21152 this.libDir = 'lib'; 21183 this.libDir = 'lib';
21153 } 21184 }
21154 } 21185 }
21155 } 21186 }
21156 // ********** Code for LibraryReader ************** 21187 // ********** Code for LibraryReader **************
21157 function LibraryReader() { 21188 function LibraryReader() {
21158 // Initializers done 21189 // Initializers done
21159 this._specialLibs = $map(['dart:core', joinPaths(options.libDir, 'corelib.dart '), 'dart:coreimpl', joinPaths(options.libDir, 'corelib_impl.dart'), 'dart:html' , joinPaths(options.libDir, '../../client/html/release/html.dart'), 'dart:dom', joinPaths(options.libDir, 'dom/dom.dart'), 'dart:json', joinPaths(options.libDir , 'json.dart')]); 21190 this._specialLibs = $map(['dart:core', joinPaths($globals.options.libDir, 'cor elib.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corelib_impl.d art'), 'dart:html', joinPaths($globals.options.libDir, '../../client/html/releas e/html.dart'), 'dart:dom', joinPaths($globals.options.libDir, 'dom/dom.dart'), ' dart:json', joinPaths($globals.options.libDir, 'json.dart')]);
21160 } 21191 }
21161 LibraryReader.prototype.readFile = function(fullname) { 21192 LibraryReader.prototype.readFile = function(fullname) {
21162 var filename = this._specialLibs.$index(fullname); 21193 var filename = this._specialLibs.$index(fullname);
21163 if ($notnull_bool(filename == null)) { 21194 if ($notnull_bool(filename == null)) {
21164 filename = fullname; 21195 filename = fullname;
21165 } 21196 }
21166 if ($notnull_bool(world.files.fileExists($assert_String(filename)))) { 21197 if ($notnull_bool($globals.world.files.fileExists($assert_String(filename)))) {
21167 return new SourceFile(filename, world.files.readAll($assert_String(filename) )); 21198 return new SourceFile(filename, $globals.world.files.readAll($assert_String( filename)));
21168 } 21199 }
21169 else { 21200 else {
21170 world.error(('File not found: ' + filename + '')); 21201 $globals.world.error(('File not found: ' + filename + ''));
21171 return new SourceFile(filename, ''); 21202 return new SourceFile(filename, '');
21172 } 21203 }
21173 } 21204 }
21174 // ********** Code for VarMember ************** 21205 // ********** Code for VarMember **************
21175 function VarMember(name) { 21206 function VarMember(name) {
21176 this.name = name; 21207 this.name = name;
21177 // Initializers done 21208 // Initializers done
21178 } 21209 }
21179 VarMember.prototype.is$VarMember = function(){return this;}; 21210 VarMember.prototype.is$VarMember = function(){return this;};
21180 VarMember.prototype.get$name = function() { return this.name; }; 21211 VarMember.prototype.get$name = function() { return this.name; };
21181 VarMember.prototype.get$returnType = function() { 21212 VarMember.prototype.get$returnType = function() {
21182 return world.varType; 21213 return $globals.world.varType;
21183 } 21214 }
21184 VarMember.prototype.invoke = function(context, node, target, args) { 21215 VarMember.prototype.invoke = function(context, node, target, args) {
21185 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name + '(' + args.getCode() + ')'), node.span, true); 21216 return new Value(this.get$returnType(), ('' + target.code + '.' + this.name + '(' + args.getCode() + ')'), node.span, true);
21186 } 21217 }
21187 VarMember.prototype.generate$1 = function($0) { 21218 VarMember.prototype.generate$1 = function($0) {
21188 return this.generate(($0 && $0.is$CodeWriter())); 21219 return this.generate(($0 && $0.is$CodeWriter()));
21189 }; 21220 };
21190 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) { 21221 VarMember.prototype.invoke$4 = function($0, $1, $2, $3) {
21191 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments())); 21222 return this.invoke(($0 && $0.is$MethodGenerator()), ($1 && $1.is$lang_Node()), ($2 && $2.is$Value()), ($3 && $3.is$Arguments()));
21192 }; 21223 };
21193 // ********** Code for VarFunctionStub ************** 21224 // ********** Code for VarFunctionStub **************
21194 function VarFunctionStub(name, callArgs) { 21225 function VarFunctionStub(name, callArgs) {
21195 this.args = callArgs.toCallStubArgs(); 21226 this.args = callArgs.toCallStubArgs();
21196 // Initializers done 21227 // Initializers done
21197 VarMember.call(this, name); 21228 VarMember.call(this, name);
21198 world.gen.corejs.useGenStub = true; 21229 $globals.world.gen.corejs.useGenStub = true;
21199 } 21230 }
21200 $inherits(VarFunctionStub, VarMember); 21231 $inherits(VarFunctionStub, VarMember);
21201 VarFunctionStub.prototype.is$VarFunctionStub = function(){return this;}; 21232 VarFunctionStub.prototype.is$VarFunctionStub = function(){return this;};
21202 VarFunctionStub.prototype.generate = function(code) { 21233 VarFunctionStub.prototype.generate = function(code) {
21203 if ($notnull_bool(this.args.get$hasNames())) { 21234 if ($notnull_bool(this.args.get$hasNames())) {
21204 this.generateNamed(code); 21235 this.generateNamed(code);
21205 } 21236 }
21206 else { 21237 else {
21207 this.generatePositional(code); 21238 this.generatePositional(code);
21208 } 21239 }
(...skipping 26 matching lines...) Expand all
21235 function VarMethodStub(name, member, args, body) { 21266 function VarMethodStub(name, member, args, body) {
21236 this.member = member; 21267 this.member = member;
21237 this.args = args; 21268 this.args = args;
21238 this.body = body; 21269 this.body = body;
21239 // Initializers done 21270 // Initializers done
21240 VarMember.call(this, name); 21271 VarMember.call(this, name);
21241 } 21272 }
21242 $inherits(VarMethodStub, VarMember); 21273 $inherits(VarMethodStub, VarMember);
21243 VarMethodStub.prototype.get$returnType = function() { 21274 VarMethodStub.prototype.get$returnType = function() {
21244 var $0; 21275 var $0;
21245 return (($0 = this.member != null ? this.member.get$returnType() : world.varTy pe) && $0.is$lang_Type()); 21276 return (($0 = this.member != null ? this.member.get$returnType() : $globals.wo rld.varType) && $0.is$lang_Type());
21246 } 21277 }
21247 VarMethodStub.prototype.get$typeName = function() { 21278 VarMethodStub.prototype.get$typeName = function() {
21248 return this.member != null ? this.member.declaringType.get$jsname() : 'Object' ; 21279 return this.member != null ? this.member.declaringType.get$jsname() : 'Object' ;
21249 } 21280 }
21250 VarMethodStub.prototype.generate = function(code) { 21281 VarMethodStub.prototype.generate = function(code) {
21251 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = ')); 21282 code.write(('' + this.get$typeName() + '.prototype.' + this.name + ' = '));
21252 this.generateBody(code, ';'); 21283 this.generateBody(code, ';');
21253 } 21284 }
21254 VarMethodStub.prototype.generateBody = function(code, end) { 21285 VarMethodStub.prototype.generateBody = function(code, end) {
21255 if ($notnull_bool(this._useDirectCall(this.member, this.args))) { 21286 if ($notnull_bool(this._useDirectCall(this.member, this.args))) {
21256 code.writeln(('' + this.get$typeName() + '.prototype.' + this.member.get$jsn ame() + '' + end + '')); 21287 code.writeln(('' + this.get$typeName() + '.prototype.' + this.member.get$jsn ame() + '' + end + ''));
21257 } 21288 }
21258 else { 21289 else {
21259 code.enterBlock(('function(' + this.args.getCode() + ') {')); 21290 code.enterBlock(('function(' + this.args.getCode() + ') {'));
21260 code.writeln(('return ' + this.body.code + ';')); 21291 code.writeln(('return ' + this.body.code + ';'));
21261 code.exitBlock(('}' + end + '')); 21292 code.exitBlock(('}' + end + ''));
21262 } 21293 }
21263 } 21294 }
21264 VarMethodStub.prototype._useDirectCall = function(member, args) { 21295 VarMethodStub.prototype._useDirectCall = function(member, args) {
21265 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library() , world.get$dom())) { 21296 if ((member instanceof MethodMember) && $ne(member.declaringType.get$library() , $globals.world.get$dom())) {
21266 var method = (member && member.is$MethodMember()); 21297 var method = (member && member.is$MethodMember());
21267 if ($notnull_bool(method.needsArgumentConversion(args))) { 21298 if ($notnull_bool(method.needsArgumentConversion(args))) {
21268 return false; 21299 return false;
21269 } 21300 }
21270 for (var i = args.get$length(); 21301 for (var i = args.get$length();
21271 i < method.parameters.length; i++) { 21302 i < method.parameters.length; i++) {
21272 if ($notnull_bool($ne(method.parameters.$index(i).get$value().code, 'null' ))) { 21303 if ($notnull_bool($ne(method.parameters.$index(i).get$value().code, 'null' ))) {
21273 return false; 21304 return false;
21274 } 21305 }
21275 } 21306 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
21310 var $list = this.members; 21341 var $list = this.members;
21311 for (var $i = 0;$i < $list.length; $i++) { 21342 for (var $i = 0;$i < $list.length; $i++) {
21312 var member = $list.$index($i); 21343 var member = $list.$index($i);
21313 var target = new Value(member.declaringType, 'this', node.span, true); 21344 var target = new Value(member.declaringType, 'this', node.span, true);
21314 var result = member.invoke$4$isDynamic(context, node, target, this.args, tru e); 21345 var result = member.invoke$4$isDynamic(context, node, target, this.args, tru e);
21315 var stub = new VarMethodStub(this.name, member, this.args, result); 21346 var stub = new VarMethodStub(this.name, member, this.args, result);
21316 var type = member.declaringType; 21347 var type = member.declaringType;
21317 if ($notnull_bool(type.get$isObject())) { 21348 if ($notnull_bool(type.get$isObject())) {
21318 objectStub = stub; 21349 objectStub = stub;
21319 } 21350 }
21320 else if ($ne(type.get$library(), world.get$dom())) { 21351 else if ($ne(type.get$library(), $globals.world.get$dom())) {
21321 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember())); 21352 VarMethodSet._addVarStub((type && type.is$lang_Type()), (stub && stub.is$V arMember()));
21322 } 21353 }
21323 else { 21354 else {
21324 this._fallbackStubs.add(stub); 21355 this._fallbackStubs.add(stub);
21325 } 21356 }
21326 } 21357 }
21327 if ($notnull_bool(objectStub == null)) { 21358 if ($notnull_bool(objectStub == null)) {
21328 var target = new Value(world.objectType, 'this', node.span, true); 21359 var target = new Value($globals.world.objectType, 'this', node.span, true);
21329 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, t his.args); 21360 var result = target.invokeNoSuchMethod(context, this.get$baseName(), node, t his.args);
21330 objectStub = new VarMethodStub(this.name, null, this.args, result); 21361 objectStub = new VarMethodStub(this.name, null, this.args, result);
21331 } 21362 }
21332 if (this._fallbackStubs.length == 0) { 21363 if (this._fallbackStubs.length == 0) {
21333 VarMethodSet._addVarStub(world.objectType, (objectStub && objectStub.is$VarM ember())); 21364 VarMethodSet._addVarStub($globals.world.objectType, (objectStub && objectStu b.is$VarMember()));
21334 } 21365 }
21335 else { 21366 else {
21336 this._fallbackStubs.add(objectStub); 21367 this._fallbackStubs.add(objectStub);
21337 world.gen.corejs.useVarMethod = true; 21368 $globals.world.gen.corejs.useVarMethod = true;
21338 } 21369 }
21339 } 21370 }
21340 VarMethodSet._addVarStub = function(type, stub) { 21371 VarMethodSet._addVarStub = function(type, stub) {
21341 if (type.varStubs == null) type.varStubs = $map([]); 21372 if (type.varStubs == null) type.varStubs = $map([]);
21342 type.varStubs.$setindex(stub.name, stub); 21373 type.varStubs.$setindex(stub.name, stub);
21343 } 21374 }
21344 VarMethodSet.prototype.generate = function(code) { 21375 VarMethodSet.prototype.generate = function(code) {
21345 if (this._fallbackStubs.length == 0) return; 21376 if (this._fallbackStubs.length == 0) return;
21346 code.enterBlock(('\$varMethod("' + this.name + '", {')); 21377 code.enterBlock(('\$varMethod("' + this.name + '", {'));
21347 var lastOne = this._fallbackStubs.last(); 21378 var lastOne = this._fallbackStubs.last();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
21437 else { 21468 else {
21438 return text.substring(1); 21469 return text.substring(1);
21439 } 21470 }
21440 } 21471 }
21441 else { 21472 else {
21442 return text; 21473 return text;
21443 } 21474 }
21444 } 21475 }
21445 var world; 21476 var world;
21446 function initializeWorld(files) { 21477 function initializeWorld(files) {
21447 $assert(world == null, "world == null", "world.dart", 13, 10); 21478 $assert($globals.world == null, "world == null", "world.dart", 13, 10);
21448 world = new World(files); 21479 $globals.world = new World(files);
21449 world.init(); 21480 $globals.world.init();
21450 } 21481 }
21451 function lang_compile(homedir, args, files) { 21482 function lang_compile(homedir, args, files) {
21452 parseOptions(homedir, args, files); 21483 parseOptions(homedir, args, files);
21453 initializeWorld(files); 21484 initializeWorld(files);
21454 var success = world.compile(); 21485 var success = $globals.world.compile();
21455 if (options.outfile != null) { 21486 if ($globals.options.outfile != null) {
21456 if ($notnull_bool(success)) { 21487 if ($notnull_bool(success)) {
21457 var code = world.getGeneratedCode(); 21488 var code = $globals.world.getGeneratedCode();
21458 if (!options.outfile.endsWith('.js')) { 21489 if (!$globals.options.outfile.endsWith('.js')) {
21459 code = '#!/usr/bin/env node\n' + code; 21490 code = '#!/usr/bin/env node\n' + code;
21460 } 21491 }
21461 world.files.writeString(options.outfile, $assert_String(code)); 21492 $globals.world.files.writeString($globals.options.outfile, $assert_String( code));
21462 } 21493 }
21463 else { 21494 else {
21464 world.files.writeString(options.outfile, "throw 'Sorry, but I could not ge nerate reasonable code to run.\\n';"); 21495 $globals.world.files.writeString($globals.options.outfile, "throw 'Sorry, but I could not generate reasonable code to run.\\n';");
21465 } 21496 }
21466 } 21497 }
21467 return $assert_bool(success); 21498 return $assert_bool(success);
21468 } 21499 }
21469 var options; 21500 var options;
21470 function parseOptions(homedir, args, files) { 21501 function parseOptions(homedir, args, files) {
21471 $assert(options == null, "options == null", "frog_options.dart", 10, 10); 21502 $assert($globals.options == null, "options == null", "frog_options.dart", 10, 10);
21472 options = new FrogOptions(homedir, args, files); 21503 $globals.options = new FrogOptions(homedir, args, files);
21473 } 21504 }
21474 function _getCallStubName(name, args) { 21505 function _getCallStubName(name, args) {
21475 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount( ) + '')); 21506 var nameBuilder = new StringBufferImpl(('' + name + '\$' + args.get$bareCount( ) + ''));
21476 for (var i = args.get$bareCount(); 21507 for (var i = args.get$bareCount();
21477 i < args.get$length(); i++) { 21508 i < args.get$length(); i++) {
21478 nameBuilder.add('\$').add(args.getName(i)); 21509 nameBuilder.add('\$').add(args.getName(i));
21479 } 21510 }
21480 return nameBuilder.toString(); 21511 return nameBuilder.toString();
21481 } 21512 }
21482 // ********** Library frog ************** 21513 // ********** Library frog **************
21483 // ********** Code for top level ************** 21514 // ********** Code for top level **************
21484 function main() { 21515 function main() {
21485 var homedir = path.dirname(fs.realpathSync($assert_String(process.argv.$index( 1)))); 21516 var homedir = path.dirname(fs.realpathSync($assert_String(process.argv.$index( 1))));
21486 var argv = ListFactory.ListFactory$from$factory(process.argv); 21517 var argv = ListFactory.ListFactory$from$factory(process.argv);
21487 if ($notnull_bool(lang_compile($assert_String(homedir), (argv && argv.is$List$ String()), new NodeFileSystem()))) { 21518 if ($notnull_bool(lang_compile($assert_String(homedir), (argv && argv.is$List$ String()), new NodeFileSystem()))) {
21488 var code = world.getGeneratedCode(); 21519 var code = $globals.world.getGeneratedCode();
21489 if (!$notnull_bool(options.compileOnly)) { 21520 if (!$notnull_bool($globals.options.compileOnly)) {
21490 process.argv = [argv.$index(0), argv.$index(1)]; 21521 process.argv = [argv.$index(0), argv.$index(1)];
21491 process.argv.addAll(options.childArgs); 21522 process.argv.addAll($globals.options.childArgs);
21492 vm.runInNewContext($assert_String(code), createSandbox()); 21523 vm.runInNewContext($assert_String(code), createSandbox());
21493 } 21524 }
21494 } 21525 }
21495 else { 21526 else {
21496 process.exit(1); 21527 process.exit(1);
21497 } 21528 }
21498 } 21529 }
21499 // ********** Globals ************** 21530 // ********** Globals **************
21500 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; 21531 function $static_init(){
21501 var const$10 = new StringWrapper('String')/*const SourceString('String')*/; 21532 $globals.HTracer__singleton = null;
21502 var const$100 = new Keyword("operator", true)/*const Keyword("operator", true)*/ ; 21533 }
21503 var const$102 = new Keyword("set", true)/*const Keyword("set", true)*/; 21534 const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/;
21504 var const$104 = new Keyword("source", true)/*const Keyword("source", true)*/; 21535 const$1 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/;
21505 var const$106 = new Keyword("static", true)/*const Keyword("static", true)*/; 21536 const$10 = new StringWrapper('Dynamic')/*const SourceString('Dynamic')*/;
21506 var const$108 = new Keyword("typedef", true)/*const Keyword("typedef", true)*/; 21537 const$100 = new Keyword("negate", true)/*const Keyword("negate", true)*/;
21507 var const$112 = new StringWrapper('EOF')/*const SourceString('EOF')*/; 21538 const$102 = new Keyword("operator", true)/*const Keyword("operator", true)*/;
21508 var const$12 = new IllegalAccessException()/*const IllegalAccessException()*/; 21539 const$104 = new Keyword("set", true)/*const Keyword("set", true)*/;
21509 var const$13 = ImmutableList.ImmutableList$from$factory([])/*const []*/; 21540 const$106 = new Keyword("source", true)/*const Keyword("source", true)*/;
21510 var const$14 = new LinkTail()/*const EmptyLink()*/; 21541 const$108 = new Keyword("static", true)/*const Keyword("static", true)*/;
21511 var const$199 = new ElementKind('class')/*const ElementKind('class')*/; 21542 const$110 = new Keyword("typedef", true)/*const Keyword("typedef", true)*/;
21512 var const$2 = new StringWrapper('global scope')/*const SourceString('global scop e')*/; 21543 const$114 = new StringWrapper('EOF')/*const SourceString('EOF')*/;
21513 var const$201 = new ElementKind('function')/*const ElementKind('function')*/; 21544 const$12 = new StringWrapper('String')/*const SourceString('String')*/;
21514 var const$203 = new StringWrapper('JS')/*const SourceString('JS')*/; 21545 const$14 = new IllegalAccessException()/*const IllegalAccessException()*/;
21515 var const$204 = new ElementKind('foreign')/*const ElementKind('foreign')*/; 21546 const$15 = ImmutableList.ImmutableList$from$factory([])/*const []*/;
21516 var const$206 = new StringWrapper('main')/*const SourceString('main')*/; 21547 const$16 = new LinkTail()/*const EmptyLink()*/;
21517 var const$208 = new StringWrapper(';')/*const SourceString(';')*/; 21548 const$201 = new ElementKind('class')/*const ElementKind('class')*/;
21518 var const$209 = new NodeList()/*const Prefix()*/; 21549 const$203 = new ElementKind('function')/*const ElementKind('function')*/;
21519 var const$210 = new Prefix()/*const Prefix()*/; 21550 const$205 = new StringWrapper('JS')/*const SourceString('JS')*/;
21520 var const$211 = new Postfix()/*const Postfix()*/; 21551 const$206 = new ElementKind('foreign')/*const ElementKind('foreign')*/;
21521 var const$212 = new ImmutableMap([])/*const {}*/; 21552 const$208 = new StringWrapper('main')/*const SourceString('main')*/;
21522 var const$213 = new StringWrapper('+')/*const SourceString('+')*/; 21553 const$210 = new StringWrapper(';')/*const SourceString(';')*/;
21523 var const$214 = new StringWrapper('add')/*const SourceString('add')*/; 21554 const$211 = new NodeList()/*const Prefix()*/;
21524 var const$215 = new StringWrapper('-')/*const SourceString('-')*/; 21555 const$212 = new Prefix()/*const Prefix()*/;
21525 var const$216 = new StringWrapper('sub')/*const SourceString('sub')*/; 21556 const$213 = new Postfix()/*const Postfix()*/;
21526 var const$217 = new StringWrapper('*')/*const SourceString('*')*/; 21557 const$214 = new ImmutableMap([])/*const {}*/;
21527 var const$218 = new StringWrapper('mul')/*const SourceString('mul')*/; 21558 const$215 = new StringWrapper('+')/*const SourceString('+')*/;
21528 var const$219 = new StringWrapper('/')/*const SourceString('/')*/; 21559 const$216 = new StringWrapper('add')/*const SourceString('add')*/;
21529 var const$22 = new Keyword("break", false)/*const Keyword("break")*/; 21560 const$217 = new StringWrapper('-')/*const SourceString('-')*/;
21530 var const$220 = new StringWrapper('div')/*const SourceString('div')*/; 21561 const$218 = new StringWrapper('sub')/*const SourceString('sub')*/;
21531 var const$221 = new StringWrapper('~/')/*const SourceString('~/')*/; 21562 const$219 = new StringWrapper('*')/*const SourceString('*')*/;
21532 var const$222 = new StringWrapper('tdiv')/*const SourceString('tdiv')*/; 21563 const$220 = new StringWrapper('mul')/*const SourceString('mul')*/;
21533 var const$223 = new StringWrapper('==')/*const SourceString('==')*/; 21564 const$221 = new StringWrapper('/')/*const SourceString('/')*/;
21534 var const$224 = new StringWrapper('eq')/*const SourceString('eq')*/; 21565 const$222 = new StringWrapper('div')/*const SourceString('div')*/;
21535 var const$225 = new StringWrapper('<')/*const SourceString('<')*/; 21566 const$223 = new StringWrapper('~/')/*const SourceString('~/')*/;
21536 var const$226 = new StringWrapper('lt')/*const SourceString('lt')*/; 21567 const$224 = new StringWrapper('tdiv')/*const SourceString('tdiv')*/;
21537 var const$227 = new StringWrapper('var')/*const SourceString('var')*/; 21568 const$225 = new StringWrapper('==')/*const SourceString('==')*/;
21538 var const$228 = new ElementKind('variable')/*const ElementKind('variable')*/; 21569 const$226 = new StringWrapper('eq')/*const SourceString('eq')*/;
21539 var const$234 = new WarningKind('cannot return value from void function')/*const WarningKind( 21570 const$227 = new StringWrapper('<')/*const SourceString('<')*/;
21571 const$228 = new StringWrapper('lt')/*const SourceString('lt')*/;
21572 const$229 = new StringWrapper('var')/*const SourceString('var')*/;
21573 const$230 = new ElementKind('variable')/*const ElementKind('variable')*/;
21574 const$236 = new WarningKind('cannot return value from void function')/*const War ningKind(
21540 'cannot return value from void function')*/; 21575 'cannot return value from void function')*/;
21541 var const$236 = new WarningKind('#{1} is not assignable to #{2}')/*const Warning Kind( 21576 const$238 = new WarningKind('#{1} is not assignable to #{2}')/*const WarningKind (
21542 '#{1} is not assignable to #{2}')*/; 21577 '#{1} is not assignable to #{2}')*/;
21543 var const$238 = new WarningKind('value of type #{1} expected')/*const WarningKin d( 21578 const$24 = new Keyword("break", false)/*const Keyword("break")*/;
21579 const$240 = new WarningKind('value of type #{1} expected')/*const WarningKind(
21544 'value of type #{1} expected')*/; 21580 'value of type #{1} expected')*/;
21545 var const$24 = new Keyword("case", false)/*const Keyword("case")*/; 21581 const$242 = new StringWrapper('=')/*const SourceString('=')*/;
21546 var const$240 = new StringWrapper('=')/*const SourceString('=')*/; 21582 const$243 = new WarningKind('variable cannot be of type void')/*const WarningKin d(
21547 var const$241 = new WarningKind('variable cannot be of type void')/*const Warnin gKind(
21548 'variable cannot be of type void')*/; 21583 'variable cannot be of type void')*/;
21549 var const$243 = new WarningKind('expression does not yield a value')/*const Warn ingKind( 21584 const$245 = new WarningKind('expression does not yield a value')/*const WarningK ind(
21550 'expression does not yield a value')*/; 21585 'expression does not yield a value')*/;
21551 var const$253 = new StringWrapper("+")/*const SourceString("+")*/; 21586 const$255 = new StringWrapper("+")/*const SourceString("+")*/;
21552 var const$254 = new StringWrapper("-")/*const SourceString("-")*/; 21587 const$256 = new StringWrapper("-")/*const SourceString("-")*/;
21553 var const$255 = new StringWrapper("*")/*const SourceString("*")*/; 21588 const$257 = new StringWrapper("*")/*const SourceString("*")*/;
21554 var const$256 = new StringWrapper("/")/*const SourceString("/")*/; 21589 const$258 = new StringWrapper("/")/*const SourceString("/")*/;
21555 var const$257 = new StringWrapper("~/")/*const SourceString("~/")*/; 21590 const$259 = new StringWrapper("~/")/*const SourceString("~/")*/;
21556 var const$258 = new StringWrapper("==")/*const SourceString("==")*/; 21591 const$26 = new Keyword("case", false)/*const Keyword("case")*/;
21557 var const$26 = new Keyword("catch", false)/*const Keyword("catch")*/; 21592 const$260 = new StringWrapper("==")/*const SourceString("==")*/;
21558 var const$261 = ImmutableList.ImmutableList$from$factory(["__PROTO__", "prototyp e"])/*const <String>["__PROTO__", "prototype"]*/; 21593 const$263 = ImmutableList.ImmutableList$from$factory(["__PROTO__", "prototype"]) /*const <String>["__PROTO__", "prototype"]*/;
21559 var const$263 = ImmutableList.ImmutableList$from$factory(["NaN", "Infinity", "un defined", "eval", "parseInt", "parseFloat", "isNan", "isFinite", "decodeURI", "d ecodeURIComponent", "encodeURI", "encodeURIComponent", "Object", "Function", "Ar ray", "String", "Boolean", "Number", "Date", "RegExp", "Error", "EvalError", "Ra ngeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "Math", "ar guments", "escape", "unescape", "applicationCache", "closed", "Components", "con tent", "controllers", "crypto", "defaultStatus", "dialogArguments", "directories ", "document", "frameElement", "frames", "fullScreen", "globalStorage", "history ", "innerHeight", "innerWidth", "length", "location", "locationbar", "localStora ge", "menubar", "mozInnerScreenX", "mozInnerScreenY", "mozScreenPixelsPerCssPixe l", "name", "navigator", "opener", "outerHeight", "outerWidth", "pageXOffset", " pageYOffset", "parent", "personalbar", "pkcs11", "returnValue", "screen", "scrol lbars", "scrollMaxX", "scrollMaxY", "self", "sessionStorage", "sidebar", "status ", "statusbar", "toolbar", "top", "window", "alert", "addEventListener", "atob", "back", "blur", "btoa", "captureEvents", "clearInterval", "clearTimeout", "clos e", "confirm", "disableExternalCapture", "dispatchEvent", "dump", "enableExterna lCapture", "escape", "find", "focus", "forward", "GeckoActiveXObject", "getAtten tion", "getAttentionWithCycleCount", "getComputedStyle", "getSelection", "home", "maximize", "minimize", "moveBy", "moveTo", "open", "openDialog", "postMessage" , "print", "prompt", "QueryInterface", "releaseEvents", "removeEventListener", " resizeBy", "resizeTo", "restore", "routeEvent", "scroll", "scrollBy", "scrollByL ines", "scrollByPages", "scrollTo", "setInterval", "setResizeable", "setTimeout" , "showModalDialog", "sizeToContent", "stop", "uuescape", "updateCommands", "XPC NativeWrapper", "XPCSafeJSOjbectWrapper", "onabort", "onbeforeunload", "onchange ", "onclick", "onclose", "oncontextmenu", "ondragdrop", "onerror", "onfocus", "o nhashchange", "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown", "on mousemove", "onmouseout", "onmouseover", "onmouseup", "onmozorientation", "onpai nt", "onreset", "onresize", "onscroll", "onselect", "onsubmit", "onunload", "ont ouchcancel", "ontouchend", "ontouchmove", "ontouchstart", "ongesturestart", "ong esturechange", "ongestureend", "uneval", "getPrototypeOf", "let", "yield", "abst ract", "int", "short", "boolean", "interface", "static", "byte", "long", "char", "final", "native", "synchronized", "float", "package", "throws", "goto", "priva te", "transient", "implements", "protected", "volatile", "double", "public", "at tachEvent", "clientInformation", "clipboardData", "createPopup", "dialogHeight", "dialogLeft", "dialogTop", "dialogWidth", "onafterprint", "onbeforedeactivate", "onbeforeprint", "oncontrolselect", "ondeactivate", "onhelp", "onresizeend", "e vent", "external", "Debug", "Enumerator", "Global", "Image", "ActiveXObject", "V BArray", "Components", "toString", "getClass", "constructor", "prototype", "valu eOf", "Anchor", "Applet", "Attr", "Canvas", "CanvasGradient", "CanvasPattern", " CanvasRenderingContext2D", "CDATASection", "CharacterData", "Comment", "CSS2Prop erties", "CSSRule", "CSSStyleSheet", "Document", "DocumentFragment", "DocumentTy pe", "DOMException", "DOMImplementation", "DOMParser", "Element", "Event", "Exte rnalInterface", "FlashPlayer", "Form", "Frame", "History", "HTMLCollection", "HT MLDocument", "HTMLElement", "IFrame", "Image", "Input", "JSObject", "KeyEvent", "Link", "Location", "MimeType", "MouseEvent", "Navigator", "Node", "NodeList", " Option", "Plugin", "ProcessingInstruction", "Range", "RangeException", "Screen", "Select", "Table", "TableCell", "TableRow", "TableSelection", "Text", "TextArea ", "UIEvent", "Window", "XMLHttpRequest", "XMLSerializer", "XPathException", "XP athResult", "XSLTProcessor", "java", "Packages", "netscape", "sun", "JavaObject" , "JavaClass", "JavaArray", "JavaMember", "\$wnd", "\$doc", "\$entry", "\$module Name", "\$moduleBase", "\$gwt_version", "\$sessionId", "\$stack", "\$stackDepth" , "\$location", "call"])/*const <String>[ 21594 const$265 = ImmutableList.ImmutableList$from$factory(["NaN", "Infinity", "undefi ned", "eval", "parseInt", "parseFloat", "isNan", "isFinite", "decodeURI", "decod eURIComponent", "encodeURI", "encodeURIComponent", "Object", "Function", "Array" , "String", "Boolean", "Number", "Date", "RegExp", "Error", "EvalError", "RangeE rror", "ReferenceError", "SyntaxError", "TypeError", "URIError", "Math", "argume nts", "escape", "unescape", "applicationCache", "closed", "Components", "content ", "controllers", "crypto", "defaultStatus", "dialogArguments", "directories", " document", "frameElement", "frames", "fullScreen", "globalStorage", "history", " innerHeight", "innerWidth", "length", "location", "locationbar", "localStorage", "menubar", "mozInnerScreenX", "mozInnerScreenY", "mozScreenPixelsPerCssPixel", "name", "navigator", "opener", "outerHeight", "outerWidth", "pageXOffset", "page YOffset", "parent", "personalbar", "pkcs11", "returnValue", "screen", "scrollbar s", "scrollMaxX", "scrollMaxY", "self", "sessionStorage", "sidebar", "status", " statusbar", "toolbar", "top", "window", "alert", "addEventListener", "atob", "ba ck", "blur", "btoa", "captureEvents", "clearInterval", "clearTimeout", "close", "confirm", "disableExternalCapture", "dispatchEvent", "dump", "enableExternalCap ture", "escape", "find", "focus", "forward", "GeckoActiveXObject", "getAttention ", "getAttentionWithCycleCount", "getComputedStyle", "getSelection", "home", "ma ximize", "minimize", "moveBy", "moveTo", "open", "openDialog", "postMessage", "p rint", "prompt", "QueryInterface", "releaseEvents", "removeEventListener", "resi zeBy", "resizeTo", "restore", "routeEvent", "scroll", "scrollBy", "scrollByLines ", "scrollByPages", "scrollTo", "setInterval", "setResizeable", "setTimeout", "s howModalDialog", "sizeToContent", "stop", "uuescape", "updateCommands", "XPCNati veWrapper", "XPCSafeJSOjbectWrapper", "onabort", "onbeforeunload", "onchange", " onclick", "onclose", "oncontextmenu", "ondragdrop", "onerror", "onfocus", "onhas hchange", "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown", "onmous emove", "onmouseout", "onmouseover", "onmouseup", "onmozorientation", "onpaint", "onreset", "onresize", "onscroll", "onselect", "onsubmit", "onunload", "ontouch cancel", "ontouchend", "ontouchmove", "ontouchstart", "ongesturestart", "ongestu rechange", "ongestureend", "uneval", "getPrototypeOf", "let", "yield", "abstract ", "int", "short", "boolean", "interface", "static", "byte", "long", "char", "fi nal", "native", "synchronized", "float", "package", "throws", "goto", "private", "transient", "implements", "protected", "volatile", "double", "public", "attach Event", "clientInformation", "clipboardData", "createPopup", "dialogHeight", "di alogLeft", "dialogTop", "dialogWidth", "onafterprint", "onbeforedeactivate", "on beforeprint", "oncontrolselect", "ondeactivate", "onhelp", "onresizeend", "event ", "external", "Debug", "Enumerator", "Global", "Image", "ActiveXObject", "VBArr ay", "Components", "toString", "getClass", "constructor", "prototype", "valueOf" , "Anchor", "Applet", "Attr", "Canvas", "CanvasGradient", "CanvasPattern", "Canv asRenderingContext2D", "CDATASection", "CharacterData", "Comment", "CSS2Properti es", "CSSRule", "CSSStyleSheet", "Document", "DocumentFragment", "DocumentType", "DOMException", "DOMImplementation", "DOMParser", "Element", "Event", "External Interface", "FlashPlayer", "Form", "Frame", "History", "HTMLCollection", "HTMLDo cument", "HTMLElement", "IFrame", "Image", "Input", "JSObject", "KeyEvent", "Lin k", "Location", "MimeType", "MouseEvent", "Navigator", "Node", "NodeList", "Opti on", "Plugin", "ProcessingInstruction", "Range", "RangeException", "Screen", "Se lect", "Table", "TableCell", "TableRow", "TableSelection", "Text", "TextArea", " UIEvent", "Window", "XMLHttpRequest", "XMLSerializer", "XPathException", "XPathR esult", "XSLTProcessor", "java", "Packages", "netscape", "sun", "JavaObject", "J avaClass", "JavaArray", "JavaMember", "\$wnd", "\$doc", "\$entry", "\$moduleName ", "\$moduleBase", "\$gwt_version", "\$sessionId", "\$stack", "\$stackDepth", "\ $location", "call"])/*const <String>[
21560 // Section references are from Ecma-262 21595 // Section references are from Ecma-262
21561 // (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pd f) 21596 // (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pd f)
21562 21597
21563 // 15.1.1 Value Properties of the Global Object 21598 // 15.1.1 Value Properties of the Global Object
21564 "NaN", "Infinity", "undefined", 21599 "NaN", "Infinity", "undefined",
21565 21600
21566 // 15.1.2 Function Properties of the Global Object 21601 // 15.1.2 Function Properties of the Global Object
21567 "eval", "parseInt", "parseFloat", "isNan", "isFinite", 21602 "eval", "parseInt", "parseFloat", "isNan", "isFinite",
21568 21603
21569 // 15.1.3 URI Handling Function Properties 21604 // 15.1.3 URI Handling Function Properties
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
21680 // GWT-defined identifiers 21715 // GWT-defined identifiers
21681 "\$wnd", "\$doc", "\$entry", "\$moduleName", "\$moduleBase", 21716 "\$wnd", "\$doc", "\$entry", "\$moduleName", "\$moduleBase",
21682 "\$gwt_version", "\$sessionId", 21717 "\$gwt_version", "\$sessionId",
21683 21718
21684 // Identifiers used by JsStackEmulator; later set to obfuscatable 21719 // Identifiers used by JsStackEmulator; later set to obfuscatable
21685 "\$stack", "\$stackDepth", "\$location", 21720 "\$stack", "\$stackDepth", "\$location",
21686 21721
21687 // TODO: prove why this is necessary or remove it 21722 // TODO: prove why this is necessary or remove it
21688 "call" 21723 "call"
21689 ]*/; 21724 ]*/;
21690 var const$265 = ImmutableList.ImmutableList$from$factory(["break", "delete", "fu nction", "return", "typeof", "case", "do", "if", "switch", "var", "catch", "else ", "in", "this", "void", "continue", "false", "instanceof", "throw", "while", "d ebugger", "finally", "new", "true", "with", "default", "for", "null", "try", "ab stract", "double", "goto", "native", "static", "boolean", "enum", "implements", "package", "super", "byte", "export", "import", "private", "synchronized", "char ", "extends", "int", "protected", "throws", "class", "final", "interface", "publ ic", "transient", "const", "float", "long", "short", "volatile"])/*const <String >[ 21725 const$267 = ImmutableList.ImmutableList$from$factory(["break", "delete", "functi on", "return", "typeof", "case", "do", "if", "switch", "var", "catch", "else", " in", "this", "void", "continue", "false", "instanceof", "throw", "while", "debug ger", "finally", "new", "true", "with", "default", "for", "null", "try", "abstra ct", "double", "goto", "native", "static", "boolean", "enum", "implements", "pac kage", "super", "byte", "export", "import", "private", "synchronized", "char", " extends", "int", "protected", "throws", "class", "final", "interface", "public", "transient", "const", "float", "long", "short", "volatile"])/*const <String>[
21691 // These are current keywords 21726 // These are current keywords
21692 "break", "delete", "function", "return", "typeof", "case", "do", "if", 21727 "break", "delete", "function", "return", "typeof", "case", "do", "if",
21693 "switch", "var", "catch", "else", "in", "this", "void", "continue", 21728 "switch", "var", "catch", "else", "in", "this", "void", "continue",
21694 "false", "instanceof", "throw", "while", "debugger", "finally", "new", 21729 "false", "instanceof", "throw", "while", "debugger", "finally", "new",
21695 "true", "with", "default", "for", "null", "try", 21730 "true", "with", "default", "for", "null", "try",
21696 21731
21697 // These are future keywords 21732 // These are future keywords
21698 "abstract", "double", "goto", "native", "static", "boolean", "enum", 21733 "abstract", "double", "goto", "native", "static", "boolean", "enum",
21699 "implements", "package", "super", "byte", "export", "import", "private", 21734 "implements", "package", "super", "byte", "export", "import", "private",
21700 "synchronized", "char", "extends", "int", "protected", "throws", 21735 "synchronized", "char", "extends", "int", "protected", "throws",
21701 "class", "final", "interface", "public", "transient", "const", "float", 21736 "class", "final", "interface", "public", "transient", "const", "float",
21702 "long", "short", "volatile" 21737 "long", "short", "volatile"
21703 ]*/; 21738 ]*/;
21704 var const$267 = new ExceptionImplementation("Internal Error (Leg): UNREACHABLE") /*const Exception("Internal Error (Leg): UNREACHABLE")*/; 21739 const$269 = new ExceptionImplementation("Internal Error (Leg): UNREACHABLE")/*co nst Exception("Internal Error (Leg): UNREACHABLE")*/;
21705 var const$28 = new Keyword("const", false)/*const Keyword("const")*/; 21740 const$28 = new Keyword("catch", false)/*const Keyword("catch")*/;
21706 var const$3 = new EmptyQueueException()/*const EmptyQueueException()*/; 21741 const$30 = new Keyword("const", false)/*const Keyword("const")*/;
21707 var const$30 = new Keyword("continue", false)/*const Keyword("continue")*/; 21742 const$32 = new Keyword("continue", false)/*const Keyword("continue")*/;
21708 var const$32 = new Keyword("default", false)/*const Keyword("default")*/; 21743 const$34 = new Keyword("default", false)/*const Keyword("default")*/;
21709 var const$34 = new Keyword("do", false)/*const Keyword("do")*/; 21744 const$36 = new Keyword("do", false)/*const Keyword("do")*/;
21710 var const$36 = new Keyword("else", false)/*const Keyword("else")*/; 21745 const$38 = new Keyword("else", false)/*const Keyword("else")*/;
21711 var const$38 = new Keyword("false", false)/*const Keyword("false")*/; 21746 const$382 = ImmutableList.ImmutableList$from$factory(['NullPointerException', 'O bjectNotClosureException', 'NoSuchMethodException', 'StackOverflowException'])/* const [
21712 var const$380 = ImmutableList.ImmutableList$from$factory(['NullPointerException' , 'ObjectNotClosureException', 'NoSuchMethodException', 'StackOverflowException' ])/*const [
21713 'NullPointerException', 'ObjectNotClosureException', 21747 'NullPointerException', 'ObjectNotClosureException',
21714 'NoSuchMethodException', 'StackOverflowException']*/; 21748 'NoSuchMethodException', 'StackOverflowException']*/;
21715 var const$4 = new StringWrapper('void')/*const SourceString('void')*/; 21749 const$4 = new StringWrapper('global scope')/*const SourceString('global scope')* /;
21716 var const$40 = new Keyword("final", false)/*const Keyword("final")*/; 21750 const$40 = new Keyword("false", false)/*const Keyword("false")*/;
21717 var const$42 = new Keyword("finally", false)/*const Keyword("finally")*/; 21751 const$42 = new Keyword("final", false)/*const Keyword("final")*/;
21718 var const$44 = new Keyword("for", false)/*const Keyword("for")*/; 21752 const$44 = new Keyword("finally", false)/*const Keyword("finally")*/;
21719 var const$46 = new Keyword("if", false)/*const Keyword("if")*/; 21753 const$46 = new Keyword("for", false)/*const Keyword("for")*/;
21720 var const$48 = new Keyword("in", false)/*const Keyword("in")*/; 21754 const$48 = new Keyword("if", false)/*const Keyword("if")*/;
21721 var const$50 = new Keyword("is", false)/*const Keyword("is")*/; 21755 const$5 = new EmptyQueueException()/*const EmptyQueueException()*/;
21722 var const$52 = new Keyword("new", false)/*const Keyword("new")*/; 21756 const$50 = new Keyword("in", false)/*const Keyword("in")*/;
21723 var const$54 = new Keyword("null", false)/*const Keyword("null")*/; 21757 const$52 = new Keyword("is", false)/*const Keyword("is")*/;
21724 var const$56 = new Keyword("return", false)/*const Keyword("return")*/; 21758 const$54 = new Keyword("new", false)/*const Keyword("new")*/;
21725 var const$58 = new Keyword("super", false)/*const Keyword("super")*/; 21759 const$56 = new Keyword("null", false)/*const Keyword("null")*/;
21726 var const$6 = new StringWrapper('int')/*const SourceString('int')*/; 21760 const$58 = new Keyword("return", false)/*const Keyword("return")*/;
21727 var const$60 = new Keyword("switch", false)/*const Keyword("switch")*/; 21761 const$6 = new StringWrapper('void')/*const SourceString('void')*/;
21728 var const$62 = new Keyword("this", false)/*const Keyword("this")*/; 21762 const$60 = new Keyword("super", false)/*const Keyword("super")*/;
21729 var const$64 = new Keyword("throw", false)/*const Keyword("throw")*/; 21763 const$62 = new Keyword("switch", false)/*const Keyword("switch")*/;
21730 var const$66 = new Keyword("true", false)/*const Keyword("true")*/; 21764 const$64 = new Keyword("this", false)/*const Keyword("this")*/;
21731 var const$68 = new Keyword("try", false)/*const Keyword("try")*/; 21765 const$66 = new Keyword("throw", false)/*const Keyword("throw")*/;
21732 var const$70 = new Keyword("var", false)/*const Keyword("var")*/; 21766 const$68 = new Keyword("true", false)/*const Keyword("true")*/;
21733 var const$72 = new Keyword("void", false)/*const Keyword("void")*/; 21767 const$70 = new Keyword("try", false)/*const Keyword("try")*/;
21734 var const$74 = new Keyword("while", false)/*const Keyword("while")*/; 21768 const$72 = new Keyword("var", false)/*const Keyword("var")*/;
21735 var const$76 = new Keyword("abstract", true)/*const Keyword("abstract", true)*/; 21769 const$74 = new Keyword("void", false)/*const Keyword("void")*/;
21736 var const$78 = new Keyword("assert", true)/*const Keyword("assert", true)*/; 21770 const$76 = new Keyword("while", false)/*const Keyword("while")*/;
21737 var const$8 = new StringWrapper('Dynamic')/*const SourceString('Dynamic')*/; 21771 const$78 = new Keyword("abstract", true)/*const Keyword("abstract", true)*/;
21738 var const$80 = new Keyword("class", true)/*const Keyword("class", true)*/; 21772 const$8 = new StringWrapper('int')/*const SourceString('int')*/;
21739 var const$82 = new Keyword("extends", true)/*const Keyword("extends", true)*/; 21773 const$80 = new Keyword("assert", true)/*const Keyword("assert", true)*/;
21740 var const$84 = new Keyword("factory", true)/*const Keyword("factory", true)*/; 21774 const$82 = new Keyword("class", true)/*const Keyword("class", true)*/;
21741 var const$86 = new Keyword("get", true)/*const Keyword("get", true)*/; 21775 const$84 = new Keyword("extends", true)/*const Keyword("extends", true)*/;
21742 var const$88 = new Keyword("implements", true)/*const Keyword("implements", true )*/; 21776 const$86 = new Keyword("factory", true)/*const Keyword("factory", true)*/;
21743 var const$90 = new Keyword("import", true)/*const Keyword("import", true)*/; 21777 const$88 = new Keyword("get", true)/*const Keyword("get", true)*/;
21744 var const$92 = new Keyword("interface", true)/*const Keyword("interface", true)* /; 21778 const$90 = new Keyword("implements", true)/*const Keyword("implements", true)*/;
21745 var const$94 = new Keyword("library", true)/*const Keyword("library", true)*/; 21779 const$92 = new Keyword("import", true)/*const Keyword("import", true)*/;
21746 var const$96 = new Keyword("native", true)/*const Keyword("native", true)*/; 21780 const$94 = new Keyword("interface", true)/*const Keyword("interface", true)*/;
21747 var const$98 = new Keyword("negate", true)/*const Keyword("negate", true)*/; 21781 const$96 = new Keyword("library", true)/*const Keyword("library", true)*/;
21748 HTracer._singleton = null; 21782 const$98 = new Keyword("native", true)/*const Keyword("native", true)*/;
21749 var const$110 = ImmutableList.ImmutableList$from$factory([const$22, const$24, co nst$26, const$28, const$30, const$32, const$34, const$36, const$38, const$40, co nst$42, const$44, const$46, const$48, const$50, const$52, const$54, const$56, co nst$58, const$60, const$62, const$64, const$66, const$68, const$70, const$72, co nst$74, const$76, const$78, const$80, const$82, const$84, const$86, const$88, co nst$90, const$92, const$94, const$96, const$98, const$100, const$102, const$104, const$106, const$108])/*const <Keyword> [ 21783 const$112 = ImmutableList.ImmutableList$from$factory([const$24, const$26, const$ 28, const$30, const$32, const$34, const$36, const$38, const$40, const$42, const$ 44, const$46, const$48, const$50, const$52, const$54, const$56, const$58, const$ 60, const$62, const$64, const$66, const$68, const$70, const$72, const$74, const$ 76, const$78, const$80, const$82, const$84, const$86, const$88, const$90, const$ 92, const$94, const$96, const$98, const$100, const$102, const$104, const$106, co nst$108, const$110])/*const <Keyword> [
21750 BREAK, 21784 BREAK,
21751 CASE, 21785 CASE,
21752 CATCH, 21786 CATCH,
21753 CONST, 21787 CONST,
21754 CONTINUE, 21788 CONTINUE,
21755 DEFAULT, 21789 DEFAULT,
21756 DO, 21790 DO,
21757 ELSE, 21791 ELSE,
21758 FALSE, 21792 FALSE,
21759 FINAL, 21793 FINAL,
(...skipping 24 matching lines...) Expand all
21784 IMPORT, 21818 IMPORT,
21785 INTERFACE, 21819 INTERFACE,
21786 LIBRARY, 21820 LIBRARY,
21787 NATIVE, 21821 NATIVE,
21788 NEGATE, 21822 NEGATE,
21789 OPERATOR, 21823 OPERATOR,
21790 SET, 21824 SET,
21791 SOURCE, 21825 SOURCE,
21792 STATIC, 21826 STATIC,
21793 TYPEDEF ]*/; 21827 TYPEDEF ]*/;
21828 var $globals = {};
21829 $static_init();
21794 main(); 21830 main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698