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

Side by Side Diff: frog/frogsh

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

Powered by Google App Engine
This is Rietveld 408576698