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

Side by Side Diff: frog/minfrog

Issue 9034014: Add support for the node net module. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: new version of minfrog Created 8 years, 11 months 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 function $throw(e) { 4 function $throw(e) {
5 // If e is not a value, we can use V8's captureStackTrace utility method. 5 // If e is not a value, we can use V8's captureStackTrace utility method.
6 // TODO(jmesserly): capture the stack trace on other JS engines. 6 // TODO(jmesserly): capture the stack trace on other JS engines.
7 if (e && (typeof e == 'object') && Error.captureStackTrace) { 7 if (e && (typeof e == 'object') && Error.captureStackTrace) {
8 // TODO(jmesserly): this will clobber the e.stack property 8 // TODO(jmesserly): this will clobber the e.stack property
9 Error.captureStackTrace(e, $throw); 9 Error.captureStackTrace(e, $throw);
10 } 10 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 }, enumerable: false, writable: true, configurable: true }); 94 }, enumerable: false, writable: true, configurable: true });
95 Object.defineProperty(Object.prototype, "_checkExtends$0", { value: function() { 95 Object.defineProperty(Object.prototype, "_checkExtends$0", { value: function() {
96 return this.noSuchMethod$2("_checkExtends", []); 96 return this.noSuchMethod$2("_checkExtends", []);
97 }, enumerable: false, writable: true, configurable: true }); 97 }, enumerable: false, writable: true, configurable: true });
98 Object.defineProperty(Object.prototype, "_checkNonStatic$1", { value: function($ 0) { 98 Object.defineProperty(Object.prototype, "_checkNonStatic$1", { value: function($ 0) {
99 return this.noSuchMethod$2("_checkNonStatic", [$0]); 99 return this.noSuchMethod$2("_checkNonStatic", [$0]);
100 }, enumerable: false, writable: true, configurable: true }); 100 }, enumerable: false, writable: true, configurable: true });
101 Object.defineProperty(Object.prototype, "_evalConstConstructor$2", { value: func tion($0, $1) { 101 Object.defineProperty(Object.prototype, "_evalConstConstructor$2", { value: func tion($0, $1) {
102 return this.noSuchMethod$2("_evalConstConstructor", [$0, $1]); 102 return this.noSuchMethod$2("_evalConstConstructor", [$0, $1]);
103 }, enumerable: false, writable: true, configurable: true }); 103 }, enumerable: false, writable: true, configurable: true });
104 Object.defineProperty(Object.prototype, "_forEachKey$2", { value: function($0, $ 1) {
105 return this.noSuchMethod$2("_forEachKey", [$0, $1]);
106 }, enumerable: false, writable: true, configurable: true });
104 Object.defineProperty(Object.prototype, "_get$3", { value: function($0, $1, $2) { 107 Object.defineProperty(Object.prototype, "_get$3", { value: function($0, $1, $2) {
105 return this.noSuchMethod$2("_get", [$0, $1, $2]); 108 return this.noSuchMethod$2("_get", [$0, $1, $2]);
106 }, enumerable: false, writable: true, configurable: true }); 109 }, enumerable: false, writable: true, configurable: true });
107 Object.defineProperty(Object.prototype, "_get$3$isDynamic", { value: function($0 , $1, $2, isDynamic) { 110 Object.defineProperty(Object.prototype, "_get$3$isDynamic", { value: function($0 , $1, $2, isDynamic) {
108 return this.noSuchMethod$2("_get", [$0, $1, $2, isDynamic]); 111 return this.noSuchMethod$2("_get", [$0, $1, $2, isDynamic]);
109 }, enumerable: false, writable: true, configurable: true }); 112 }, enumerable: false, writable: true, configurable: true });
110 Object.defineProperty(Object.prototype, "_get$4", { value: function($0, $1, $2, $3) { 113 Object.defineProperty(Object.prototype, "_get$4", { value: function($0, $1, $2, $3) {
111 return this.noSuchMethod$2("_get", [$0, $1, $2, $3]); 114 return this.noSuchMethod$2("_get", [$0, $1, $2, $3]);
112 }, enumerable: false, writable: true, configurable: true }); 115 }, enumerable: false, writable: true, configurable: true });
113 Object.defineProperty(Object.prototype, "_pushBlock$1", { value: function($0) { 116 Object.defineProperty(Object.prototype, "_pushBlock$1", { value: function($0) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 }, enumerable: false, writable: true, configurable: true }); 187 }, enumerable: false, writable: true, configurable: true });
185 Object.defineProperty(Object.prototype, "endsWith$1", { value: function($0) { 188 Object.defineProperty(Object.prototype, "endsWith$1", { value: function($0) {
186 return this.noSuchMethod$2("endsWith", [$0]); 189 return this.noSuchMethod$2("endsWith", [$0]);
187 }, enumerable: false, writable: true, configurable: true }); 190 }, enumerable: false, writable: true, configurable: true });
188 Object.defineProperty(Object.prototype, "ensureSubtypeOf$3", { value: function($ 0, $1, $2) { 191 Object.defineProperty(Object.prototype, "ensureSubtypeOf$3", { value: function($ 0, $1, $2) {
189 return this.noSuchMethod$2("ensureSubtypeOf", [$0, $1, $2]); 192 return this.noSuchMethod$2("ensureSubtypeOf", [$0, $1, $2]);
190 }, enumerable: false, writable: true, configurable: true }); 193 }, enumerable: false, writable: true, configurable: true });
191 Object.defineProperty(Object.prototype, "evalBody$2", { value: function($0, $1) { 194 Object.defineProperty(Object.prototype, "evalBody$2", { value: function($0, $1) {
192 return this.noSuchMethod$2("evalBody", [$0, $1]); 195 return this.noSuchMethod$2("evalBody", [$0, $1]);
193 }, enumerable: false, writable: true, configurable: true }); 196 }, enumerable: false, writable: true, configurable: true });
197 Object.defineProperty(Object.prototype, "every$1", { value: function($0) {
198 return this.noSuchMethod$2("every", [$0]);
199 }, enumerable: false, writable: true, configurable: true });
194 Object.defineProperty(Object.prototype, "filter$1", { value: function($0) { 200 Object.defineProperty(Object.prototype, "filter$1", { value: function($0) {
195 return this.noSuchMethod$2("filter", [$0]); 201 return this.noSuchMethod$2("filter", [$0]);
196 }, enumerable: false, writable: true, configurable: true }); 202 }, enumerable: false, writable: true, configurable: true });
197 Object.defineProperty(Object.prototype, "findTypeByName$1", { value: function($0 ) { 203 Object.defineProperty(Object.prototype, "findTypeByName$1", { value: function($0 ) {
198 return this.noSuchMethod$2("findTypeByName", [$0]); 204 return this.noSuchMethod$2("findTypeByName", [$0]);
199 }, enumerable: false, writable: true, configurable: true }); 205 }, enumerable: false, writable: true, configurable: true });
200 Object.defineProperty(Object.prototype, "forEach$1", { value: function($0) { 206 Object.defineProperty(Object.prototype, "forEach$1", { value: function($0) {
201 return this.noSuchMethod$2("forEach", [$0]); 207 return this.noSuchMethod$2("forEach", [$0]);
202 }, enumerable: false, writable: true, configurable: true }); 208 }, enumerable: false, writable: true, configurable: true });
203 Object.defineProperty(Object.prototype, "genValue$2", { value: function($0, $1) { 209 Object.defineProperty(Object.prototype, "genValue$2", { value: function($0, $1) {
(...skipping 19 matching lines...) Expand all
223 }, enumerable: false, writable: true, configurable: true }); 229 }, enumerable: false, writable: true, configurable: true });
224 Object.defineProperty(Object.prototype, "getLine$1", { value: function($0) { 230 Object.defineProperty(Object.prototype, "getLine$1", { value: function($0) {
225 return this.noSuchMethod$2("getLine", [$0]); 231 return this.noSuchMethod$2("getLine", [$0]);
226 }, enumerable: false, writable: true, configurable: true }); 232 }, enumerable: false, writable: true, configurable: true });
227 Object.defineProperty(Object.prototype, "getMember$1", { value: function($0) { 233 Object.defineProperty(Object.prototype, "getMember$1", { value: function($0) {
228 return this.noSuchMethod$2("getMember", [$0]); 234 return this.noSuchMethod$2("getMember", [$0]);
229 }, enumerable: false, writable: true, configurable: true }); 235 }, enumerable: false, writable: true, configurable: true });
230 Object.defineProperty(Object.prototype, "getOrMakeConcreteType$1", { value: func tion($0) { 236 Object.defineProperty(Object.prototype, "getOrMakeConcreteType$1", { value: func tion($0) {
231 return this.noSuchMethod$2("getOrMakeConcreteType", [$0]); 237 return this.noSuchMethod$2("getOrMakeConcreteType", [$0]);
232 }, enumerable: false, writable: true, configurable: true }); 238 }, enumerable: false, writable: true, configurable: true });
239 Object.defineProperty(Object.prototype, "getRange$2", { value: function($0, $1) {
240 return this.noSuchMethod$2("getRange", [$0, $1]);
241 }, enumerable: false, writable: true, configurable: true });
233 Object.defineProperty(Object.prototype, "getValues$0", { value: function() { 242 Object.defineProperty(Object.prototype, "getValues$0", { value: function() {
234 return this.noSuchMethod$2("getValues", []); 243 return this.noSuchMethod$2("getValues", []);
235 }, enumerable: false, writable: true, configurable: true }); 244 }, enumerable: false, writable: true, configurable: true });
236 Object.defineProperty(Object.prototype, "get_$3", { value: function($0, $1, $2) { 245 Object.defineProperty(Object.prototype, "get_$3", { value: function($0, $1, $2) {
237 return this.noSuchMethod$2("get_", [$0, $1, $2]); 246 return this.noSuchMethod$2("get_", [$0, $1, $2]);
238 }, enumerable: false, writable: true, configurable: true }); 247 }, enumerable: false, writable: true, configurable: true });
239 Object.defineProperty(Object.prototype, "hasNext$0", { value: function() { 248 Object.defineProperty(Object.prototype, "hasNext$0", { value: function() {
240 return this.noSuchMethod$2("hasNext", []); 249 return this.noSuchMethod$2("hasNext", []);
241 }, enumerable: false, writable: true, configurable: true }); 250 }, enumerable: false, writable: true, configurable: true });
242 Object.defineProperty(Object.prototype, "hashCode$0", { value: function() { 251 Object.defineProperty(Object.prototype, "hashCode$0", { value: function() {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 }, enumerable: false, writable: true, configurable: true }); 346 }, enumerable: false, writable: true, configurable: true });
338 Object.defineProperty(Object.prototype, "setDefinition$1", { value: function($0) { 347 Object.defineProperty(Object.prototype, "setDefinition$1", { value: function($0) {
339 return this.noSuchMethod$2("setDefinition", [$0]); 348 return this.noSuchMethod$2("setDefinition", [$0]);
340 }, enumerable: false, writable: true, configurable: true }); 349 }, enumerable: false, writable: true, configurable: true });
341 Object.defineProperty(Object.prototype, "setIndex$4$kind$returnKind", { value: f unction($0, $1, $2, $3, kind, returnKind) { 350 Object.defineProperty(Object.prototype, "setIndex$4$kind$returnKind", { value: f unction($0, $1, $2, $3, kind, returnKind) {
342 return this.noSuchMethod$2("setIndex", [$0, $1, $2, $3, kind, returnKind]); 351 return this.noSuchMethod$2("setIndex", [$0, $1, $2, $3, kind, returnKind]);
343 }, enumerable: false, writable: true, configurable: true }); 352 }, enumerable: false, writable: true, configurable: true });
344 Object.defineProperty(Object.prototype, "set_$4$kind$returnKind", { value: funct ion($0, $1, $2, $3, kind, returnKind) { 353 Object.defineProperty(Object.prototype, "set_$4$kind$returnKind", { value: funct ion($0, $1, $2, $3, kind, returnKind) {
345 return this.noSuchMethod$2("set_", [$0, $1, $2, $3, kind, returnKind]); 354 return this.noSuchMethod$2("set_", [$0, $1, $2, $3, kind, returnKind]);
346 }, enumerable: false, writable: true, configurable: true }); 355 }, enumerable: false, writable: true, configurable: true });
356 Object.defineProperty(Object.prototype, "some$1", { value: function($0) {
357 return this.noSuchMethod$2("some", [$0]);
358 }, enumerable: false, writable: true, configurable: true });
347 Object.defineProperty(Object.prototype, "sort$1", { value: function($0) { 359 Object.defineProperty(Object.prototype, "sort$1", { value: function($0) {
348 return this.noSuchMethod$2("sort", [$0]); 360 return this.noSuchMethod$2("sort", [$0]);
349 }, enumerable: false, writable: true, configurable: true }); 361 }, enumerable: false, writable: true, configurable: true });
350 Object.defineProperty(Object.prototype, "start$0", { value: function() { 362 Object.defineProperty(Object.prototype, "start$0", { value: function() {
351 return this.noSuchMethod$2("start", []); 363 return this.noSuchMethod$2("start", []);
352 }, enumerable: false, writable: true, configurable: true }); 364 }, enumerable: false, writable: true, configurable: true });
353 Object.defineProperty(Object.prototype, "startsWith$1", { value: function($0) { 365 Object.defineProperty(Object.prototype, "startsWith$1", { value: function($0) {
354 return this.noSuchMethod$2("startsWith", [$0]); 366 return this.noSuchMethod$2("startsWith", [$0]);
355 }, enumerable: false, writable: true, configurable: true }); 367 }, enumerable: false, writable: true, configurable: true });
356 Object.defineProperty(Object.prototype, "stop$0", { value: function() { 368 Object.defineProperty(Object.prototype, "stop$0", { value: function() {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 this._functionName = _functionName; 498 this._functionName = _functionName;
487 this._arguments = _arguments; 499 this._arguments = _arguments;
488 } 500 }
489 NoSuchMethodException.prototype.toString = function() { 501 NoSuchMethodException.prototype.toString = function() {
490 var sb = new StringBufferImpl(""); 502 var sb = new StringBufferImpl("");
491 for (var i = (0); 503 for (var i = (0);
492 i < this._arguments.get$length(); i++) { 504 i < this._arguments.get$length(); i++) {
493 if (i > (0)) { 505 if (i > (0)) {
494 sb.add(", "); 506 sb.add(", ");
495 } 507 }
496 sb.add(this._arguments[i]); 508 sb.add(this._arguments.$index(i));
497 } 509 }
498 sb.add("]"); 510 sb.add("]");
499 return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("fun ction name: '" + this._functionName + "' arguments: [" + sb + "]"); 511 return ("NoSuchMethodException - receiver: '" + this._receiver + "' ") + ("fun ction name: '" + this._functionName + "' arguments: [" + sb + "]");
500 } 512 }
501 NoSuchMethodException.prototype.toString$0 = NoSuchMethodException.prototype.toS tring; 513 NoSuchMethodException.prototype.toString$0 = NoSuchMethodException.prototype.toS tring;
502 // ********** Code for ClosureArgumentMismatchException ************** 514 // ********** Code for ClosureArgumentMismatchException **************
503 function ClosureArgumentMismatchException() { 515 function ClosureArgumentMismatchException() {
504 516
505 } 517 }
506 ClosureArgumentMismatchException.prototype.toString = function() { 518 ClosureArgumentMismatchException.prototype.toString = function() {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 }, enumerable: false, writable: true, configurable: true }); 728 }, enumerable: false, writable: true, configurable: true });
717 Object.defineProperty(ListFactory.prototype, "isEmpty", { value: function() { 729 Object.defineProperty(ListFactory.prototype, "isEmpty", { value: function() {
718 return this.get$length() == (0); 730 return this.get$length() == (0);
719 }, enumerable: false, writable: true, configurable: true }); 731 }, enumerable: false, writable: true, configurable: true });
720 Object.defineProperty(ListFactory.prototype, "iterator", { value: function() { 732 Object.defineProperty(ListFactory.prototype, "iterator", { value: function() {
721 return new ListIterator(this); 733 return new ListIterator(this);
722 }, enumerable: false, writable: true, configurable: true }); 734 }, enumerable: false, writable: true, configurable: true });
723 Object.defineProperty(ListFactory.prototype, "add$1", { value: ListFactory.proto type.add, enumerable: false, writable: true, configurable: true }); 735 Object.defineProperty(ListFactory.prototype, "add$1", { value: ListFactory.proto type.add, enumerable: false, writable: true, configurable: true });
724 Object.defineProperty(ListFactory.prototype, "addAll$1", { value: ListFactory.pr ototype.addAll, enumerable: false, writable: true, configurable: true }); 736 Object.defineProperty(ListFactory.prototype, "addAll$1", { value: ListFactory.pr ototype.addAll, enumerable: false, writable: true, configurable: true });
725 Object.defineProperty(ListFactory.prototype, "addLast$1", { value: ListFactory.p rototype.addLast, enumerable: false, writable: true, configurable: true }); 737 Object.defineProperty(ListFactory.prototype, "addLast$1", { value: ListFactory.p rototype.addLast, enumerable: false, writable: true, configurable: true });
738 Object.defineProperty(ListFactory.prototype, "every$1", { value: function($0) {
739 return this.every(to$call$1($0));
740 }, enumerable: false, writable: true, configurable: true });
726 Object.defineProperty(ListFactory.prototype, "filter$1", { value: function($0) { 741 Object.defineProperty(ListFactory.prototype, "filter$1", { value: function($0) {
727 return this.filter(to$call$1($0)); 742 return this.filter(to$call$1($0));
728 }, enumerable: false, writable: true, configurable: true }); 743 }, enumerable: false, writable: true, configurable: true });
729 Object.defineProperty(ListFactory.prototype, "forEach$1", { value: function($0) { 744 Object.defineProperty(ListFactory.prototype, "forEach$1", { value: function($0) {
730 return this.forEach(to$call$1($0)); 745 return this.forEach(to$call$1($0));
731 }, enumerable: false, writable: true, configurable: true }); 746 }, enumerable: false, writable: true, configurable: true });
747 Object.defineProperty(ListFactory.prototype, "getRange$2", { value: ListFactory. prototype.getRange, enumerable: false, writable: true, configurable: true });
732 Object.defineProperty(ListFactory.prototype, "indexOf$1", { value: ListFactory.p rototype.indexOf, enumerable: false, writable: true, configurable: true }); 748 Object.defineProperty(ListFactory.prototype, "indexOf$1", { value: ListFactory.p rototype.indexOf, enumerable: false, writable: true, configurable: true });
733 Object.defineProperty(ListFactory.prototype, "isEmpty$0", { value: ListFactory.p rototype.isEmpty, enumerable: false, writable: true, configurable: true }); 749 Object.defineProperty(ListFactory.prototype, "isEmpty$0", { value: ListFactory.p rototype.isEmpty, enumerable: false, writable: true, configurable: true });
734 Object.defineProperty(ListFactory.prototype, "iterator$0", { value: ListFactory. prototype.iterator, enumerable: false, writable: true, configurable: true }); 750 Object.defineProperty(ListFactory.prototype, "iterator$0", { value: ListFactory. prototype.iterator, enumerable: false, writable: true, configurable: true });
735 Object.defineProperty(ListFactory.prototype, "last$0", { value: ListFactory.prot otype.last, enumerable: false, writable: true, configurable: true }); 751 Object.defineProperty(ListFactory.prototype, "last$0", { value: ListFactory.prot otype.last, enumerable: false, writable: true, configurable: true });
736 Object.defineProperty(ListFactory.prototype, "removeLast$0", { value: ListFactor y.prototype.removeLast, enumerable: false, writable: true, configurable: true }) ; 752 Object.defineProperty(ListFactory.prototype, "removeLast$0", { value: ListFactor y.prototype.removeLast, enumerable: false, writable: true, configurable: true }) ;
753 Object.defineProperty(ListFactory.prototype, "some$1", { value: function($0) {
754 return this.some(to$call$1($0));
755 }, enumerable: false, writable: true, configurable: true });
737 Object.defineProperty(ListFactory.prototype, "sort$1", { value: function($0) { 756 Object.defineProperty(ListFactory.prototype, "sort$1", { value: function($0) {
738 return this.sort(to$call$2($0)); 757 return this.sort(to$call$2($0));
739 }, enumerable: false, writable: true, configurable: true }); 758 }, enumerable: false, writable: true, configurable: true });
740 ListFactory_E = ListFactory; 759 ListFactory_E = ListFactory;
741 ListFactory_Expression = ListFactory; 760 ListFactory_Expression = ListFactory;
742 ListFactory_K = ListFactory; 761 ListFactory_K = ListFactory;
743 ListFactory_dart_core_String = ListFactory; 762 ListFactory_dart_core_String = ListFactory;
744 ListFactory_V = ListFactory; 763 ListFactory_V = ListFactory;
745 ListFactory_VariableValue = ListFactory; 764 ListFactory_VariableValue = ListFactory;
746 ListFactory_int = ListFactory; 765 ListFactory_int = ListFactory;
747 // ********** Code for ListIterator ************** 766 // ********** Code for ListIterator **************
748 function ListIterator(array) { 767 function ListIterator(array) {
749 this._array = array; 768 this._array = array;
750 this._pos = (0); 769 this._pos = (0);
751 } 770 }
752 ListIterator.prototype.hasNext = function() { 771 ListIterator.prototype.hasNext = function() {
753 return this._array.get$length() > this._pos; 772 return this._array.get$length() > this._pos;
754 } 773 }
755 ListIterator.prototype.next = function() { 774 ListIterator.prototype.next = function() {
756 if (!this.hasNext()) { 775 if (!this.hasNext()) {
757 $throw(const$0005); 776 $throw(const$0005);
758 } 777 }
759 return this._array[this._pos++]; 778 return this._array.$index(this._pos++);
760 } 779 }
761 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext; 780 ListIterator.prototype.hasNext$0 = ListIterator.prototype.hasNext;
762 ListIterator.prototype.next$0 = ListIterator.prototype.next; 781 ListIterator.prototype.next$0 = ListIterator.prototype.next;
763 // ********** Code for ImmutableList ************** 782 // ********** Code for ImmutableList **************
764 /** Implements extends for Dart classes on JavaScript prototypes. */ 783 /** Implements extends for Dart classes on JavaScript prototypes. */
765 function $inherits(child, parent) { 784 function $inherits(child, parent) {
766 if (child.prototype.__proto__) { 785 if (child.prototype.__proto__) {
767 child.prototype.__proto__ = parent.prototype; 786 child.prototype.__proto__ = parent.prototype;
768 } else { 787 } else {
769 function tmp() {}; 788 function tmp() {};
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 } 911 }
893 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length ) { 912 HashMapImplementation._nextProbe = function(currentProbe, numberOfProbes, length ) {
894 return (currentProbe + numberOfProbes) & (length - (1)); 913 return (currentProbe + numberOfProbes) & (length - (1));
895 } 914 }
896 HashMapImplementation.prototype._probeForAdding = function(key) { 915 HashMapImplementation.prototype._probeForAdding = function(key) {
897 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length()); 916 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length());
898 var numberOfProbes = (1); 917 var numberOfProbes = (1);
899 var initialHash = hash; 918 var initialHash = hash;
900 var insertionIndex = (-1); 919 var insertionIndex = (-1);
901 while (true) { 920 while (true) {
902 var existingKey = this._keys[hash]; 921 var existingKey = this._keys.$index(hash);
903 if (existingKey == null) { 922 if (existingKey == null) {
904 if (insertionIndex < (0)) return hash; 923 if (insertionIndex < (0)) return hash;
905 return insertionIndex; 924 return insertionIndex;
906 } 925 }
907 else if ($eq(existingKey, key)) { 926 else if ($eq(existingKey, key)) {
908 return hash; 927 return hash;
909 } 928 }
910 else if ((insertionIndex < (0)) && (const$0001 == existingKey)) { 929 else if ((insertionIndex < (0)) && (const$0001 == existingKey)) {
911 insertionIndex = hash; 930 insertionIndex = hash;
912 } 931 }
913 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length()); 932 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length());
914 } 933 }
915 } 934 }
916 HashMapImplementation.prototype._probeForLookup = function(key) { 935 HashMapImplementation.prototype._probeForLookup = function(key) {
917 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length()); 936 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length());
918 var numberOfProbes = (1); 937 var numberOfProbes = (1);
919 var initialHash = hash; 938 var initialHash = hash;
920 while (true) { 939 while (true) {
921 var existingKey = this._keys[hash]; 940 var existingKey = this._keys.$index(hash);
922 if (existingKey == null) return (-1); 941 if (existingKey == null) return (-1);
923 if ($eq(existingKey, key)) return hash; 942 if ($eq(existingKey, key)) return hash;
924 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length()); 943 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length());
925 } 944 }
926 } 945 }
927 HashMapImplementation.prototype._ensureCapacity = function() { 946 HashMapImplementation.prototype._ensureCapacity = function() {
928 var newNumberOfEntries = this._numberOfEntries + (1); 947 var newNumberOfEntries = this._numberOfEntries + (1);
929 if (newNumberOfEntries >= this._loadLimit) { 948 if (newNumberOfEntries >= this._loadLimit) {
930 this._grow(this._keys.get$length() * (2)); 949 this._grow(this._keys.get$length() * (2));
931 return; 950 return;
(...skipping 10 matching lines...) Expand all
942 } 961 }
943 HashMapImplementation.prototype._grow = function(newCapacity) { 962 HashMapImplementation.prototype._grow = function(newCapacity) {
944 var capacity = this._keys.get$length(); 963 var capacity = this._keys.get$length();
945 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); 964 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity);
946 var oldKeys = this._keys; 965 var oldKeys = this._keys;
947 var oldValues = this._values; 966 var oldValues = this._values;
948 this._keys = new Array(newCapacity); 967 this._keys = new Array(newCapacity);
949 this._values = new Array(newCapacity); 968 this._values = new Array(newCapacity);
950 for (var i = (0); 969 for (var i = (0);
951 i < capacity; i++) { 970 i < capacity; i++) {
952 var key = oldKeys[i]; 971 var key = oldKeys.$index(i);
953 if (key == null || key == const$0001) { 972 if (key == null || key == const$0001) {
954 continue; 973 continue;
955 } 974 }
956 var value = oldValues[i]; 975 var value = oldValues.$index(i);
957 var newIndex = this._probeForAdding(key); 976 var newIndex = this._probeForAdding(key);
958 this._keys.$setindex(newIndex, key); 977 this._keys.$setindex(newIndex, key);
959 this._values.$setindex(newIndex, value); 978 this._values.$setindex(newIndex, value);
960 } 979 }
961 this._numberOfDeleted = (0); 980 this._numberOfDeleted = (0);
962 } 981 }
963 HashMapImplementation.prototype.$setindex = function(key, value) { 982 HashMapImplementation.prototype.$setindex = function(key, value) {
964 this._ensureCapacity(); 983 this._ensureCapacity();
965 var index = this._probeForAdding(key); 984 var index = this._probeForAdding(key);
966 if ((this._keys[index] == null) || (this._keys[index] == const$0001)) { 985 if ((this._keys.$index(index) == null) || (this._keys.$index(index) == const$0 001)) {
967 this._numberOfEntries++; 986 this._numberOfEntries++;
968 } 987 }
969 this._keys.$setindex(index, key); 988 this._keys.$setindex(index, key);
970 this._values.$setindex(index, value); 989 this._values.$setindex(index, value);
971 } 990 }
972 HashMapImplementation.prototype.$index = function(key) { 991 HashMapImplementation.prototype.$index = function(key) {
973 var index = this._probeForLookup(key); 992 var index = this._probeForLookup(key);
974 if (index < (0)) return null; 993 if (index < (0)) return null;
975 return this._values[index]; 994 return this._values.$index(index);
976 } 995 }
977 HashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) { 996 HashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) {
978 var index = this._probeForLookup(key); 997 var index = this._probeForLookup(key);
979 if (index >= (0)) return this._values[index]; 998 if (index >= (0)) return this._values.$index(index);
980 var value = ifAbsent.call$0(); 999 var value = ifAbsent.call$0();
981 this.$setindex(key, value); 1000 this.$setindex(key, value);
982 return value; 1001 return value;
983 } 1002 }
984 HashMapImplementation.prototype.isEmpty = function() { 1003 HashMapImplementation.prototype.isEmpty = function() {
985 return this._numberOfEntries == (0); 1004 return this._numberOfEntries == (0);
986 } 1005 }
987 HashMapImplementation.prototype.get$length = function() { 1006 HashMapImplementation.prototype.get$length = function() {
988 return this._numberOfEntries; 1007 return this._numberOfEntries;
989 } 1008 }
990 HashMapImplementation.prototype.forEach = function(f) { 1009 HashMapImplementation.prototype.forEach = function(f) {
991 var length = this._keys.get$length(); 1010 var length = this._keys.get$length();
992 for (var i = (0); 1011 for (var i = (0);
993 i < length; i++) { 1012 i < length; i++) {
994 var key = this._keys[i]; 1013 var key = this._keys.$index(i);
995 if ((key != null) && (key != const$0001)) { 1014 if ((key != null) && (key != const$0001)) {
996 f.call$2(key, this._values[i]); 1015 f.call$2(key, this._values.$index(i));
997 } 1016 }
998 } 1017 }
999 } 1018 }
1000 HashMapImplementation.prototype.getKeys = function() { 1019 HashMapImplementation.prototype.getKeys = function() {
1001 var list = new Array(this.get$length()); 1020 var list = new Array(this.get$length());
1002 var i = (0); 1021 var i = (0);
1003 this.forEach(function _(key, value) { 1022 this.forEach(function _(key, value) {
1004 list.$setindex(i++, key); 1023 list.$setindex(i++, key);
1005 } 1024 }
1006 ); 1025 );
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 } 1061 }
1043 HashMapImplementation_E$E._nextProbe = function(currentProbe, numberOfProbes, le ngth) { 1062 HashMapImplementation_E$E._nextProbe = function(currentProbe, numberOfProbes, le ngth) {
1044 return (currentProbe + numberOfProbes) & (length - (1)); 1063 return (currentProbe + numberOfProbes) & (length - (1));
1045 } 1064 }
1046 HashMapImplementation_E$E.prototype._probeForAdding = function(key) { 1065 HashMapImplementation_E$E.prototype._probeForAdding = function(key) {
1047 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length()); 1066 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length());
1048 var numberOfProbes = (1); 1067 var numberOfProbes = (1);
1049 var initialHash = hash; 1068 var initialHash = hash;
1050 var insertionIndex = (-1); 1069 var insertionIndex = (-1);
1051 while (true) { 1070 while (true) {
1052 var existingKey = this._keys[hash]; 1071 var existingKey = this._keys.$index(hash);
1053 if (existingKey == null) { 1072 if (existingKey == null) {
1054 if (insertionIndex < (0)) return hash; 1073 if (insertionIndex < (0)) return hash;
1055 return insertionIndex; 1074 return insertionIndex;
1056 } 1075 }
1057 else if ($eq(existingKey, key)) { 1076 else if ($eq(existingKey, key)) {
1058 return hash; 1077 return hash;
1059 } 1078 }
1060 else if ((insertionIndex < (0)) && (const$0001 == existingKey)) { 1079 else if ((insertionIndex < (0)) && (const$0001 == existingKey)) {
1061 insertionIndex = hash; 1080 insertionIndex = hash;
1062 } 1081 }
1063 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length()); 1082 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length());
1064 } 1083 }
1065 } 1084 }
1066 HashMapImplementation_E$E.prototype._probeForLookup = function(key) { 1085 HashMapImplementation_E$E.prototype._probeForLookup = function(key) {
1067 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length()); 1086 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length());
1068 var numberOfProbes = (1); 1087 var numberOfProbes = (1);
1069 var initialHash = hash; 1088 var initialHash = hash;
1070 while (true) { 1089 while (true) {
1071 var existingKey = this._keys[hash]; 1090 var existingKey = this._keys.$index(hash);
1072 if (existingKey == null) return (-1); 1091 if (existingKey == null) return (-1);
1073 if ($eq(existingKey, key)) return hash; 1092 if ($eq(existingKey, key)) return hash;
1074 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length()); 1093 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length());
1075 } 1094 }
1076 } 1095 }
1077 HashMapImplementation_E$E.prototype._ensureCapacity = function() { 1096 HashMapImplementation_E$E.prototype._ensureCapacity = function() {
1078 var newNumberOfEntries = this._numberOfEntries + (1); 1097 var newNumberOfEntries = this._numberOfEntries + (1);
1079 if (newNumberOfEntries >= this._loadLimit) { 1098 if (newNumberOfEntries >= this._loadLimit) {
1080 this._grow(this._keys.get$length() * (2)); 1099 this._grow(this._keys.get$length() * (2));
1081 return; 1100 return;
(...skipping 10 matching lines...) Expand all
1092 } 1111 }
1093 HashMapImplementation_E$E.prototype._grow = function(newCapacity) { 1112 HashMapImplementation_E$E.prototype._grow = function(newCapacity) {
1094 var capacity = this._keys.get$length(); 1113 var capacity = this._keys.get$length();
1095 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); 1114 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity);
1096 var oldKeys = this._keys; 1115 var oldKeys = this._keys;
1097 var oldValues = this._values; 1116 var oldValues = this._values;
1098 this._keys = new Array(newCapacity); 1117 this._keys = new Array(newCapacity);
1099 this._values = new Array(newCapacity); 1118 this._values = new Array(newCapacity);
1100 for (var i = (0); 1119 for (var i = (0);
1101 i < capacity; i++) { 1120 i < capacity; i++) {
1102 var key = oldKeys[i]; 1121 var key = oldKeys.$index(i);
1103 if (key == null || key == const$0001) { 1122 if (key == null || key == const$0001) {
1104 continue; 1123 continue;
1105 } 1124 }
1106 var value = oldValues[i]; 1125 var value = oldValues.$index(i);
1107 var newIndex = this._probeForAdding(key); 1126 var newIndex = this._probeForAdding(key);
1108 this._keys.$setindex(newIndex, key); 1127 this._keys.$setindex(newIndex, key);
1109 this._values.$setindex(newIndex, value); 1128 this._values.$setindex(newIndex, value);
1110 } 1129 }
1111 this._numberOfDeleted = (0); 1130 this._numberOfDeleted = (0);
1112 } 1131 }
1113 HashMapImplementation_E$E.prototype.$setindex = function(key, value) { 1132 HashMapImplementation_E$E.prototype.$setindex = function(key, value) {
1114 this._ensureCapacity(); 1133 this._ensureCapacity();
1115 var index = this._probeForAdding(key); 1134 var index = this._probeForAdding(key);
1116 if ((this._keys[index] == null) || (this._keys[index] == const$0001)) { 1135 if ((this._keys.$index(index) == null) || (this._keys.$index(index) == const$0 001)) {
1117 this._numberOfEntries++; 1136 this._numberOfEntries++;
1118 } 1137 }
1119 this._keys.$setindex(index, key); 1138 this._keys.$setindex(index, key);
1120 this._values.$setindex(index, value); 1139 this._values.$setindex(index, value);
1121 } 1140 }
1122 HashMapImplementation_E$E.prototype.isEmpty = function() { 1141 HashMapImplementation_E$E.prototype.isEmpty = function() {
1123 return this._numberOfEntries == (0); 1142 return this._numberOfEntries == (0);
1124 } 1143 }
1125 HashMapImplementation_E$E.prototype.forEach = function(f) { 1144 HashMapImplementation_E$E.prototype.forEach = function(f) {
1126 var length = this._keys.get$length(); 1145 var length = this._keys.get$length();
1127 for (var i = (0); 1146 for (var i = (0);
1128 i < length; i++) { 1147 i < length; i++) {
1129 var key = this._keys[i]; 1148 var key = this._keys.$index(i);
1130 if ((key != null) && (key != const$0001)) { 1149 if ((key != null) && (key != const$0001)) {
1131 f.call$2(key, this._values[i]); 1150 f.call$2(key, this._values.$index(i));
1132 } 1151 }
1133 } 1152 }
1134 } 1153 }
1135 HashMapImplementation_E$E.prototype.getKeys = function() { 1154 HashMapImplementation_E$E.prototype.getKeys = function() {
1136 var list = new Array(this.get$length()); 1155 var list = new Array(this.get$length());
1137 var i = (0); 1156 var i = (0);
1138 this.forEach(function _(key, value) { 1157 this.forEach(function _(key, value) {
1139 list.$setindex(i++, key); 1158 list.$setindex(i++, key);
1140 } 1159 }
1141 ); 1160 );
(...skipping 22 matching lines...) Expand all
1164 } 1183 }
1165 HashMapImplementation_K$V._nextProbe = function(currentProbe, numberOfProbes, le ngth) { 1184 HashMapImplementation_K$V._nextProbe = function(currentProbe, numberOfProbes, le ngth) {
1166 return (currentProbe + numberOfProbes) & (length - (1)); 1185 return (currentProbe + numberOfProbes) & (length - (1));
1167 } 1186 }
1168 HashMapImplementation_K$V.prototype._probeForAdding = function(key) { 1187 HashMapImplementation_K$V.prototype._probeForAdding = function(key) {
1169 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length()); 1188 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length());
1170 var numberOfProbes = (1); 1189 var numberOfProbes = (1);
1171 var initialHash = hash; 1190 var initialHash = hash;
1172 var insertionIndex = (-1); 1191 var insertionIndex = (-1);
1173 while (true) { 1192 while (true) {
1174 var existingKey = this._keys[hash]; 1193 var existingKey = this._keys.$index(hash);
1175 if (existingKey == null) { 1194 if (existingKey == null) {
1176 if (insertionIndex < (0)) return hash; 1195 if (insertionIndex < (0)) return hash;
1177 return insertionIndex; 1196 return insertionIndex;
1178 } 1197 }
1179 else if ($eq(existingKey, key)) { 1198 else if ($eq(existingKey, key)) {
1180 return hash; 1199 return hash;
1181 } 1200 }
1182 else if ((insertionIndex < (0)) && (const$0001 == existingKey)) { 1201 else if ((insertionIndex < (0)) && (const$0001 == existingKey)) {
1183 insertionIndex = hash; 1202 insertionIndex = hash;
1184 } 1203 }
1185 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length()); 1204 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length());
1186 } 1205 }
1187 } 1206 }
1188 HashMapImplementation_K$V.prototype._probeForLookup = function(key) { 1207 HashMapImplementation_K$V.prototype._probeForLookup = function(key) {
1189 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length()); 1208 var hash = HashMapImplementation._firstProbe(key.hashCode$0(), this._keys.get$ length());
1190 var numberOfProbes = (1); 1209 var numberOfProbes = (1);
1191 var initialHash = hash; 1210 var initialHash = hash;
1192 while (true) { 1211 while (true) {
1193 var existingKey = this._keys[hash]; 1212 var existingKey = this._keys.$index(hash);
1194 if (existingKey == null) return (-1); 1213 if (existingKey == null) return (-1);
1195 if ($eq(existingKey, key)) return hash; 1214 if ($eq(existingKey, key)) return hash;
1196 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length()); 1215 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length());
1197 } 1216 }
1198 } 1217 }
1199 HashMapImplementation_K$V.prototype._ensureCapacity = function() { 1218 HashMapImplementation_K$V.prototype._ensureCapacity = function() {
1200 var newNumberOfEntries = this._numberOfEntries + (1); 1219 var newNumberOfEntries = this._numberOfEntries + (1);
1201 if (newNumberOfEntries >= this._loadLimit) { 1220 if (newNumberOfEntries >= this._loadLimit) {
1202 this._grow(this._keys.get$length() * (2)); 1221 this._grow(this._keys.get$length() * (2));
1203 return; 1222 return;
(...skipping 10 matching lines...) Expand all
1214 } 1233 }
1215 HashMapImplementation_K$V.prototype._grow = function(newCapacity) { 1234 HashMapImplementation_K$V.prototype._grow = function(newCapacity) {
1216 var capacity = this._keys.get$length(); 1235 var capacity = this._keys.get$length();
1217 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); 1236 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity);
1218 var oldKeys = this._keys; 1237 var oldKeys = this._keys;
1219 var oldValues = this._values; 1238 var oldValues = this._values;
1220 this._keys = new Array(newCapacity); 1239 this._keys = new Array(newCapacity);
1221 this._values = new Array(newCapacity); 1240 this._values = new Array(newCapacity);
1222 for (var i = (0); 1241 for (var i = (0);
1223 i < capacity; i++) { 1242 i < capacity; i++) {
1224 var key = oldKeys[i]; 1243 var key = oldKeys.$index(i);
1225 if (key == null || key == const$0001) { 1244 if (key == null || key == const$0001) {
1226 continue; 1245 continue;
1227 } 1246 }
1228 var value = oldValues[i]; 1247 var value = oldValues.$index(i);
1229 var newIndex = this._probeForAdding(key); 1248 var newIndex = this._probeForAdding(key);
1230 this._keys.$setindex(newIndex, key); 1249 this._keys.$setindex(newIndex, key);
1231 this._values.$setindex(newIndex, value); 1250 this._values.$setindex(newIndex, value);
1232 } 1251 }
1233 this._numberOfDeleted = (0); 1252 this._numberOfDeleted = (0);
1234 } 1253 }
1235 HashMapImplementation_K$V.prototype.$setindex = function(key, value) { 1254 HashMapImplementation_K$V.prototype.$setindex = function(key, value) {
1236 this._ensureCapacity(); 1255 this._ensureCapacity();
1237 var index = this._probeForAdding(key); 1256 var index = this._probeForAdding(key);
1238 if ((this._keys[index] == null) || (this._keys[index] == const$0001)) { 1257 if ((this._keys.$index(index) == null) || (this._keys.$index(index) == const$0 001)) {
1239 this._numberOfEntries++; 1258 this._numberOfEntries++;
1240 } 1259 }
1241 this._keys.$setindex(index, key); 1260 this._keys.$setindex(index, key);
1242 this._values.$setindex(index, value); 1261 this._values.$setindex(index, value);
1243 } 1262 }
1244 HashMapImplementation_K$V.prototype.$index = function(key) { 1263 HashMapImplementation_K$V.prototype.$index = function(key) {
1245 var index = this._probeForLookup(key); 1264 var index = this._probeForLookup(key);
1246 if (index < (0)) return null; 1265 if (index < (0)) return null;
1247 return this._values[index]; 1266 return this._values.$index(index);
1248 } 1267 }
1249 HashMapImplementation_K$V.prototype.putIfAbsent = function(key, ifAbsent) { 1268 HashMapImplementation_K$V.prototype.putIfAbsent = function(key, ifAbsent) {
1250 var index = this._probeForLookup(key); 1269 var index = this._probeForLookup(key);
1251 if (index >= (0)) return this._values[index]; 1270 if (index >= (0)) return this._values.$index(index);
1252 var value = ifAbsent.call$0(); 1271 var value = ifAbsent.call$0();
1253 this.$setindex(key, value); 1272 this.$setindex(key, value);
1254 return value; 1273 return value;
1255 } 1274 }
1256 HashMapImplementation_K$V.prototype.isEmpty = function() { 1275 HashMapImplementation_K$V.prototype.isEmpty = function() {
1257 return this._numberOfEntries == (0); 1276 return this._numberOfEntries == (0);
1258 } 1277 }
1259 HashMapImplementation_K$V.prototype.forEach = function(f) { 1278 HashMapImplementation_K$V.prototype.forEach = function(f) {
1260 var length = this._keys.get$length(); 1279 var length = this._keys.get$length();
1261 for (var i = (0); 1280 for (var i = (0);
1262 i < length; i++) { 1281 i < length; i++) {
1263 var key = this._keys[i]; 1282 var key = this._keys.$index(i);
1264 if ((key != null) && (key != const$0001)) { 1283 if ((key != null) && (key != const$0001)) {
1265 f.call$2(key, this._values[i]); 1284 f.call$2(key, this._values.$index(i));
1266 } 1285 }
1267 } 1286 }
1268 } 1287 }
1269 HashMapImplementation_K$V.prototype.getKeys = function() { 1288 HashMapImplementation_K$V.prototype.getKeys = function() {
1270 var list = new Array(this.get$length()); 1289 var list = new Array(this.get$length());
1271 var i = (0); 1290 var i = (0);
1272 this.forEach(function _(key, value) { 1291 this.forEach(function _(key, value) {
1273 list.$setindex(i++, key); 1292 list.$setindex(i++, key);
1274 } 1293 }
1275 ); 1294 );
(...skipping 28 matching lines...) Expand all
1304 } 1323 }
1305 HashMapImplementation_dart_core_String$VariableValue._nextProbe = function(curre ntProbe, numberOfProbes, length) { 1324 HashMapImplementation_dart_core_String$VariableValue._nextProbe = function(curre ntProbe, numberOfProbes, length) {
1306 return (currentProbe + numberOfProbes) & (length - (1)); 1325 return (currentProbe + numberOfProbes) & (length - (1));
1307 } 1326 }
1308 HashMapImplementation_dart_core_String$VariableValue.prototype._probeForAdding = function(key) { 1327 HashMapImplementation_dart_core_String$VariableValue.prototype._probeForAdding = function(key) {
1309 var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$le ngth()); 1328 var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$le ngth());
1310 var numberOfProbes = (1); 1329 var numberOfProbes = (1);
1311 var initialHash = hash; 1330 var initialHash = hash;
1312 var insertionIndex = (-1); 1331 var insertionIndex = (-1);
1313 while (true) { 1332 while (true) {
1314 var existingKey = this._keys[hash]; 1333 var existingKey = this._keys.$index(hash);
1315 if (existingKey == null) { 1334 if (existingKey == null) {
1316 if (insertionIndex < (0)) return hash; 1335 if (insertionIndex < (0)) return hash;
1317 return insertionIndex; 1336 return insertionIndex;
1318 } 1337 }
1319 else if ($eq(existingKey, key)) { 1338 else if ($eq(existingKey, key)) {
1320 return hash; 1339 return hash;
1321 } 1340 }
1322 else if ((insertionIndex < (0)) && (const$0001 == existingKey)) { 1341 else if ((insertionIndex < (0)) && (const$0001 == existingKey)) {
1323 insertionIndex = hash; 1342 insertionIndex = hash;
1324 } 1343 }
1325 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length()); 1344 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length());
1326 } 1345 }
1327 } 1346 }
1328 HashMapImplementation_dart_core_String$VariableValue.prototype._probeForLookup = function(key) { 1347 HashMapImplementation_dart_core_String$VariableValue.prototype._probeForLookup = function(key) {
1329 var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$le ngth()); 1348 var hash = HashMapImplementation._firstProbe(key.hashCode(), this._keys.get$le ngth());
1330 var numberOfProbes = (1); 1349 var numberOfProbes = (1);
1331 var initialHash = hash; 1350 var initialHash = hash;
1332 while (true) { 1351 while (true) {
1333 var existingKey = this._keys[hash]; 1352 var existingKey = this._keys.$index(hash);
1334 if (existingKey == null) return (-1); 1353 if (existingKey == null) return (-1);
1335 if ($eq(existingKey, key)) return hash; 1354 if ($eq(existingKey, key)) return hash;
1336 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length()); 1355 hash = HashMapImplementation._nextProbe(hash, numberOfProbes++, this._keys.g et$length());
1337 } 1356 }
1338 } 1357 }
1339 HashMapImplementation_dart_core_String$VariableValue.prototype._ensureCapacity = function() { 1358 HashMapImplementation_dart_core_String$VariableValue.prototype._ensureCapacity = function() {
1340 var newNumberOfEntries = this._numberOfEntries + (1); 1359 var newNumberOfEntries = this._numberOfEntries + (1);
1341 if (newNumberOfEntries >= this._loadLimit) { 1360 if (newNumberOfEntries >= this._loadLimit) {
1342 this._grow(this._keys.get$length() * (2)); 1361 this._grow(this._keys.get$length() * (2));
1343 return; 1362 return;
(...skipping 10 matching lines...) Expand all
1354 } 1373 }
1355 HashMapImplementation_dart_core_String$VariableValue.prototype._grow = function( newCapacity) { 1374 HashMapImplementation_dart_core_String$VariableValue.prototype._grow = function( newCapacity) {
1356 var capacity = this._keys.get$length(); 1375 var capacity = this._keys.get$length();
1357 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity); 1376 this._loadLimit = HashMapImplementation._computeLoadLimit(newCapacity);
1358 var oldKeys = this._keys; 1377 var oldKeys = this._keys;
1359 var oldValues = this._values; 1378 var oldValues = this._values;
1360 this._keys = new Array(newCapacity); 1379 this._keys = new Array(newCapacity);
1361 this._values = new Array(newCapacity); 1380 this._values = new Array(newCapacity);
1362 for (var i = (0); 1381 for (var i = (0);
1363 i < capacity; i++) { 1382 i < capacity; i++) {
1364 var key = oldKeys[i]; 1383 var key = oldKeys.$index(i);
1365 if (key == null || key == const$0001) { 1384 if (key == null || key == const$0001) {
1366 continue; 1385 continue;
1367 } 1386 }
1368 var value = oldValues[i]; 1387 var value = oldValues.$index(i);
1369 var newIndex = this._probeForAdding(key); 1388 var newIndex = this._probeForAdding(key);
1370 this._keys.$setindex(newIndex, key); 1389 this._keys.$setindex(newIndex, key);
1371 this._values.$setindex(newIndex, value); 1390 this._values.$setindex(newIndex, value);
1372 } 1391 }
1373 this._numberOfDeleted = (0); 1392 this._numberOfDeleted = (0);
1374 } 1393 }
1375 HashMapImplementation_dart_core_String$VariableValue.prototype.$setindex = funct ion(key, value) { 1394 HashMapImplementation_dart_core_String$VariableValue.prototype.$setindex = funct ion(key, value) {
1376 this._ensureCapacity(); 1395 this._ensureCapacity();
1377 var index = this._probeForAdding(key); 1396 var index = this._probeForAdding(key);
1378 if ((this._keys[index] == null) || (this._keys[index] == const$0001)) { 1397 if ((this._keys.$index(index) == null) || (this._keys.$index(index) == const$0 001)) {
1379 this._numberOfEntries++; 1398 this._numberOfEntries++;
1380 } 1399 }
1381 this._keys.$setindex(index, key); 1400 this._keys.$setindex(index, key);
1382 this._values.$setindex(index, value); 1401 this._values.$setindex(index, value);
1383 } 1402 }
1384 HashMapImplementation_dart_core_String$VariableValue.prototype.$index = function (key) { 1403 HashMapImplementation_dart_core_String$VariableValue.prototype.$index = function (key) {
1385 var index = this._probeForLookup(key); 1404 var index = this._probeForLookup(key);
1386 if (index < (0)) return null; 1405 if (index < (0)) return null;
1387 return this._values[index]; 1406 return this._values.$index(index);
1388 } 1407 }
1389 HashMapImplementation_dart_core_String$VariableValue.prototype.forEach = functio n(f) { 1408 HashMapImplementation_dart_core_String$VariableValue.prototype.forEach = functio n(f) {
1390 var length = this._keys.get$length(); 1409 var length = this._keys.get$length();
1391 for (var i = (0); 1410 for (var i = (0);
1392 i < length; i++) { 1411 i < length; i++) {
1393 var key = this._keys[i]; 1412 var key = this._keys.$index(i);
1394 if ((key != null) && (key != const$0001)) { 1413 if ((key != null) && (key != const$0001)) {
1395 f.call$2(key, this._values[i]); 1414 f.call$2(key, this._values.$index(i));
1396 } 1415 }
1397 } 1416 }
1398 } 1417 }
1399 HashMapImplementation_dart_core_String$VariableValue.prototype.containsKey = fun ction(key) { 1418 HashMapImplementation_dart_core_String$VariableValue.prototype.containsKey = fun ction(key) {
1400 return (this._probeForLookup(key) != (-1)); 1419 return (this._probeForLookup(key) != (-1));
1401 } 1420 }
1402 // ********** Code for HashSetImplementation ************** 1421 // ********** Code for HashSetImplementation **************
1403 function HashSetImplementation() { 1422 function HashSetImplementation() {
1404 this._backingMap = new HashMapImplementation_E$E(); 1423 this._backingMap = new HashMapImplementation_E$E();
1405 } 1424 }
(...skipping 13 matching lines...) Expand all
1419 } 1438 }
1420 HashSetImplementation.prototype.addAll = function(collection) { 1439 HashSetImplementation.prototype.addAll = function(collection) {
1421 var $this = this; // closure support 1440 var $this = this; // closure support
1422 collection.forEach(function _(value) { 1441 collection.forEach(function _(value) {
1423 $this.add(value); 1442 $this.add(value);
1424 } 1443 }
1425 ); 1444 );
1426 } 1445 }
1427 HashSetImplementation.prototype.forEach = function(f) { 1446 HashSetImplementation.prototype.forEach = function(f) {
1428 this._backingMap.forEach(function _(key, value) { 1447 this._backingMap.forEach(function _(key, value) {
1429 f.call$1(key); 1448 f(key);
1430 } 1449 }
1431 ); 1450 );
1432 } 1451 }
1433 HashSetImplementation.prototype.filter = function(f) { 1452 HashSetImplementation.prototype.filter = function(f) {
1434 var result = new HashSetImplementation(); 1453 var result = new HashSetImplementation();
1435 this._backingMap.forEach(function _(key, value) { 1454 this._backingMap.forEach(function _(key, value) {
1436 if (f.call$1(key)) result.add(key); 1455 if (f(key)) result.add(key);
1437 } 1456 }
1438 ); 1457 );
1439 return result; 1458 return result;
1440 } 1459 }
1441 HashSetImplementation.prototype.every = function(f) { 1460 HashSetImplementation.prototype.every = function(f) {
1442 var keys = this._backingMap.getKeys(); 1461 var keys = this._backingMap.getKeys();
1443 return keys.every(f); 1462 return keys.every(f);
1444 } 1463 }
1445 HashSetImplementation.prototype.some = function(f) { 1464 HashSetImplementation.prototype.some = function(f) {
1446 var keys = this._backingMap.getKeys(); 1465 var keys = this._backingMap.getKeys();
1447 return keys.some(f); 1466 return keys.some(f);
1448 } 1467 }
1449 HashSetImplementation.prototype.isEmpty = function() { 1468 HashSetImplementation.prototype.isEmpty = function() {
1450 return this._backingMap.isEmpty(); 1469 return this._backingMap.isEmpty();
1451 } 1470 }
1452 HashSetImplementation.prototype.get$length = function() { 1471 HashSetImplementation.prototype.get$length = function() {
1453 return this._backingMap.get$length(); 1472 return this._backingMap.get$length();
1454 } 1473 }
1455 HashSetImplementation.prototype.iterator = function() { 1474 HashSetImplementation.prototype.iterator = function() {
1456 return new HashSetIterator_E(this); 1475 return new HashSetIterator_E(this);
1457 } 1476 }
1458 HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add; 1477 HashSetImplementation.prototype.add$1 = HashSetImplementation.prototype.add;
1459 HashSetImplementation.prototype.addAll$1 = HashSetImplementation.prototype.addAl l; 1478 HashSetImplementation.prototype.addAll$1 = HashSetImplementation.prototype.addAl l;
1460 HashSetImplementation.prototype.contains$1 = HashSetImplementation.prototype.con tains; 1479 HashSetImplementation.prototype.contains$1 = HashSetImplementation.prototype.con tains;
1480 HashSetImplementation.prototype.every$1 = function($0) {
1481 return this.every(to$call$1($0));
1482 };
1461 HashSetImplementation.prototype.filter$1 = function($0) { 1483 HashSetImplementation.prototype.filter$1 = function($0) {
1462 return this.filter(to$call$1($0)); 1484 return this.filter(to$call$1($0));
1463 }; 1485 };
1464 HashSetImplementation.prototype.forEach$1 = function($0) { 1486 HashSetImplementation.prototype.forEach$1 = function($0) {
1465 return this.forEach(to$call$1($0)); 1487 return this.forEach(to$call$1($0));
1466 }; 1488 };
1467 HashSetImplementation.prototype.isEmpty$0 = HashSetImplementation.prototype.isEm pty; 1489 HashSetImplementation.prototype.isEmpty$0 = HashSetImplementation.prototype.isEm pty;
1468 HashSetImplementation.prototype.iterator$0 = HashSetImplementation.prototype.ite rator; 1490 HashSetImplementation.prototype.iterator$0 = HashSetImplementation.prototype.ite rator;
1491 HashSetImplementation.prototype.some$1 = function($0) {
1492 return this.some(to$call$1($0));
1493 };
1469 // ********** Code for HashSetImplementation_E ************** 1494 // ********** Code for HashSetImplementation_E **************
1470 $inherits(HashSetImplementation_E, HashSetImplementation); 1495 $inherits(HashSetImplementation_E, HashSetImplementation);
1471 function HashSetImplementation_E() { 1496 function HashSetImplementation_E() {
1472 this._backingMap = new HashMapImplementation_E$E(); 1497 this._backingMap = new HashMapImplementation_E$E();
1473 } 1498 }
1474 // ********** Code for HashSetImplementation_Library ************** 1499 // ********** Code for HashSetImplementation_Library **************
1475 $inherits(HashSetImplementation_Library, HashSetImplementation); 1500 $inherits(HashSetImplementation_Library, HashSetImplementation);
1476 function HashSetImplementation_Library() {} 1501 function HashSetImplementation_Library() {}
1477 // ********** Code for HashSetImplementation_Member ************** 1502 // ********** Code for HashSetImplementation_Member **************
1478 $inherits(HashSetImplementation_Member, HashSetImplementation); 1503 $inherits(HashSetImplementation_Member, HashSetImplementation);
1479 function HashSetImplementation_Member() {} 1504 function HashSetImplementation_Member() {}
1480 // ********** Code for HashSetImplementation_dart_core_String ************** 1505 // ********** Code for HashSetImplementation_dart_core_String **************
1481 $inherits(HashSetImplementation_dart_core_String, HashSetImplementation); 1506 $inherits(HashSetImplementation_dart_core_String, HashSetImplementation);
1482 function HashSetImplementation_dart_core_String() {} 1507 function HashSetImplementation_dart_core_String() {}
1483 // ********** Code for HashSetImplementation_Type ************** 1508 // ********** Code for HashSetImplementation_Type **************
1484 $inherits(HashSetImplementation_Type, HashSetImplementation); 1509 $inherits(HashSetImplementation_Type, HashSetImplementation);
1485 function HashSetImplementation_Type() {} 1510 function HashSetImplementation_Type() {}
1486 // ********** Code for HashSetIterator ************** 1511 // ********** Code for HashSetIterator **************
1487 function HashSetIterator(set_) { 1512 function HashSetIterator(set_) {
1488 this._entries = set_._backingMap._keys; 1513 this._entries = set_._backingMap._keys;
1489 this._nextValidIndex = (-1); 1514 this._nextValidIndex = (-1);
1490 this._advance(); 1515 this._advance();
1491 } 1516 }
1492 HashSetIterator.prototype.hasNext = function() { 1517 HashSetIterator.prototype.hasNext = function() {
1493 if (this._nextValidIndex >= this._entries.get$length()) return false; 1518 if (this._nextValidIndex >= this._entries.get$length()) return false;
1494 if (this._entries[this._nextValidIndex] == const$0001) { 1519 if (this._entries.$index(this._nextValidIndex) == const$0001) {
1495 this._advance(); 1520 this._advance();
1496 } 1521 }
1497 return this._nextValidIndex < this._entries.get$length(); 1522 return this._nextValidIndex < this._entries.get$length();
1498 } 1523 }
1499 HashSetIterator.prototype.next = function() { 1524 HashSetIterator.prototype.next = function() {
1500 if (!this.hasNext()) { 1525 if (!this.hasNext()) {
1501 $throw(const$0005); 1526 $throw(const$0005);
1502 } 1527 }
1503 var res = this._entries[this._nextValidIndex]; 1528 var res = this._entries.$index(this._nextValidIndex);
1504 this._advance(); 1529 this._advance();
1505 return res; 1530 return res;
1506 } 1531 }
1507 HashSetIterator.prototype._advance = function() { 1532 HashSetIterator.prototype._advance = function() {
1508 var length = this._entries.get$length(); 1533 var length = this._entries.get$length();
1509 var entry; 1534 var entry;
1510 var deletedKey = const$0001; 1535 var deletedKey = const$0001;
1511 do { 1536 do {
1512 if (++this._nextValidIndex >= length) break; 1537 if (++this._nextValidIndex >= length) break;
1513 entry = this._entries[this._nextValidIndex]; 1538 entry = this._entries.$index(this._nextValidIndex);
1514 } 1539 }
1515 while ((entry == null) || (entry == deletedKey)) 1540 while ((entry == null) || (entry == deletedKey))
1516 } 1541 }
1517 HashSetIterator.prototype.hasNext$0 = HashSetIterator.prototype.hasNext; 1542 HashSetIterator.prototype.hasNext$0 = HashSetIterator.prototype.hasNext;
1518 HashSetIterator.prototype.next$0 = HashSetIterator.prototype.next; 1543 HashSetIterator.prototype.next$0 = HashSetIterator.prototype.next;
1519 // ********** Code for HashSetIterator_E ************** 1544 // ********** Code for HashSetIterator_E **************
1520 $inherits(HashSetIterator_E, HashSetIterator); 1545 $inherits(HashSetIterator_E, HashSetIterator);
1521 function HashSetIterator_E(set_) { 1546 function HashSetIterator_E(set_) {
1522 this._nextValidIndex = (-1); 1547 this._nextValidIndex = (-1);
1523 this._entries = set_._backingMap._keys; 1548 this._entries = set_._backingMap._keys;
1524 this._advance(); 1549 this._advance();
1525 } 1550 }
1526 HashSetIterator_E.prototype._advance = function() { 1551 HashSetIterator_E.prototype._advance = function() {
1527 var length = this._entries.get$length(); 1552 var length = this._entries.get$length();
1528 var entry; 1553 var entry;
1529 var deletedKey = const$0001; 1554 var deletedKey = const$0001;
1530 do { 1555 do {
1531 if (++this._nextValidIndex >= length) break; 1556 if (++this._nextValidIndex >= length) break;
1532 entry = this._entries[this._nextValidIndex]; 1557 entry = this._entries.$index(this._nextValidIndex);
1533 } 1558 }
1534 while ((entry == null) || (entry == deletedKey)) 1559 while ((entry == null) || (entry == deletedKey))
1535 } 1560 }
1536 // ********** Code for _DeletedKeySentinel ************** 1561 // ********** Code for _DeletedKeySentinel **************
1537 function _DeletedKeySentinel() { 1562 function _DeletedKeySentinel() {
1538 1563
1539 } 1564 }
1540 // ********** Code for KeyValuePair ************** 1565 // ********** Code for KeyValuePair **************
1541 function KeyValuePair(key, value) { 1566 function KeyValuePair(key, value) {
1542 this.value = value; 1567 this.value = value;
1543 this.key = key; 1568 this.key = key;
1544 } 1569 }
1545 KeyValuePair.prototype.get$value = function() { return this.value; }; 1570 KeyValuePair.prototype.get$value = function() { return this.value; };
1546 KeyValuePair.prototype.set$value = function(value) { return this.value = value; }; 1571 KeyValuePair.prototype.set$value = function(value) { return this.value = value; };
1547 // ********** Code for KeyValuePair_K$V ************** 1572 // ********** Code for KeyValuePair_K$V **************
1548 $inherits(KeyValuePair_K$V, KeyValuePair); 1573 $inherits(KeyValuePair_K$V, KeyValuePair);
1549 function KeyValuePair_K$V(key, value) { 1574 function KeyValuePair_K$V(key, value) {
1550 this.key = key; 1575 this.key = key;
1551 this.value = value; 1576 this.value = value;
1552 } 1577 }
1553 // ********** Code for LinkedHashMapImplementation ************** 1578 // ********** Code for LinkedHashMapImplementation **************
1554 function LinkedHashMapImplementation() { 1579 function LinkedHashMapImplementation() {
1555 this._map = new HashMapImplementation(); 1580 this._dart_coreimpl_map = new HashMapImplementation();
1556 this._list = new DoubleLinkedQueue_KeyValuePair_K$V(); 1581 this._dart_coreimpl_list = new DoubleLinkedQueue_KeyValuePair_K$V();
1557 } 1582 }
1558 LinkedHashMapImplementation.prototype.$setindex = function(key, value) { 1583 LinkedHashMapImplementation.prototype.$setindex = function(key, value) {
1559 if (this._map.containsKey(key)) { 1584 if (this._dart_coreimpl_map.containsKey(key)) {
1560 this._map.$index(key).get$element().set$value(value); 1585 this._dart_coreimpl_map.$index(key).get$element().set$value(value);
1561 } 1586 }
1562 else { 1587 else {
1563 this._list.addLast(new KeyValuePair_K$V(key, value)); 1588 this._dart_coreimpl_list.addLast(new KeyValuePair_K$V(key, value));
1564 this._map.$setindex(key, this._list.lastEntry()); 1589 this._dart_coreimpl_map.$setindex(key, this._dart_coreimpl_list.lastEntry()) ;
1565 } 1590 }
1566 } 1591 }
1567 LinkedHashMapImplementation.prototype.$index = function(key) { 1592 LinkedHashMapImplementation.prototype.$index = function(key) {
1568 var entry = this._map.$index(key); 1593 var entry = this._dart_coreimpl_map.$index(key);
1569 if (entry == null) return null; 1594 if (entry == null) return null;
1570 return entry.get$element().get$value(); 1595 return entry.get$element().get$value();
1571 } 1596 }
1572 LinkedHashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) { 1597 LinkedHashMapImplementation.prototype.putIfAbsent = function(key, ifAbsent) {
1573 var value = this.$index(key); 1598 var value = this.$index(key);
1574 if ((this.$index(key) == null) && !(this.containsKey(key))) { 1599 if ((this.$index(key) == null) && !(this.containsKey(key))) {
1575 value = ifAbsent.call$0(); 1600 value = ifAbsent.call$0();
1576 this.$setindex(key, value); 1601 this.$setindex(key, value);
1577 } 1602 }
1578 return value; 1603 return value;
1579 } 1604 }
1580 LinkedHashMapImplementation.prototype.getKeys = function() { 1605 LinkedHashMapImplementation.prototype.getKeys = function() {
1581 var list = new Array(this.get$length()); 1606 var list = new Array(this.get$length());
1582 var index = (0); 1607 var index = (0);
1583 this._list.forEach(function _(entry) { 1608 this._dart_coreimpl_list.forEach(function _(entry) {
1584 list.$setindex(index++, entry.key); 1609 list.$setindex(index++, entry.key);
1585 } 1610 }
1586 ); 1611 );
1587 return list; 1612 return list;
1588 } 1613 }
1589 LinkedHashMapImplementation.prototype.getValues = function() { 1614 LinkedHashMapImplementation.prototype.getValues = function() {
1590 var list = new Array(this.get$length()); 1615 var list = new Array(this.get$length());
1591 var index = (0); 1616 var index = (0);
1592 this._list.forEach(function _(entry) { 1617 this._dart_coreimpl_list.forEach(function _(entry) {
1593 list.$setindex(index++, entry.value); 1618 list.$setindex(index++, entry.value);
1594 } 1619 }
1595 ); 1620 );
1596 return list; 1621 return list;
1597 } 1622 }
1598 LinkedHashMapImplementation.prototype.forEach = function(f) { 1623 LinkedHashMapImplementation.prototype.forEach = function(f) {
1599 this._list.forEach(function _(entry) { 1624 this._dart_coreimpl_list.forEach(function _(entry) {
1600 f.call$2(entry.key, entry.value); 1625 f.call$2(entry.key, entry.value);
1601 } 1626 }
1602 ); 1627 );
1603 } 1628 }
1604 LinkedHashMapImplementation.prototype.containsKey = function(key) { 1629 LinkedHashMapImplementation.prototype.containsKey = function(key) {
1605 return this._map.containsKey(key); 1630 return this._dart_coreimpl_map.containsKey(key);
1606 } 1631 }
1607 LinkedHashMapImplementation.prototype.get$length = function() { 1632 LinkedHashMapImplementation.prototype.get$length = function() {
1608 return this._map.get$length(); 1633 return this._dart_coreimpl_map.get$length();
1609 } 1634 }
1610 LinkedHashMapImplementation.prototype.isEmpty = function() { 1635 LinkedHashMapImplementation.prototype.isEmpty = function() {
1611 return this.get$length() == (0); 1636 return this.get$length() == (0);
1612 } 1637 }
1613 LinkedHashMapImplementation.prototype.containsKey$1 = LinkedHashMapImplementatio n.prototype.containsKey; 1638 LinkedHashMapImplementation.prototype.containsKey$1 = LinkedHashMapImplementatio n.prototype.containsKey;
1614 LinkedHashMapImplementation.prototype.forEach$1 = function($0) { 1639 LinkedHashMapImplementation.prototype.forEach$1 = function($0) {
1615 return this.forEach(to$call$2($0)); 1640 return this.forEach(to$call$2($0));
1616 }; 1641 };
1617 LinkedHashMapImplementation.prototype.getKeys$0 = LinkedHashMapImplementation.pr ototype.getKeys; 1642 LinkedHashMapImplementation.prototype.getKeys$0 = LinkedHashMapImplementation.pr ototype.getKeys;
1618 LinkedHashMapImplementation.prototype.getValues$0 = LinkedHashMapImplementation. prototype.getValues; 1643 LinkedHashMapImplementation.prototype.getValues$0 = LinkedHashMapImplementation. prototype.getValues;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 ); 1791 );
1767 return counter; 1792 return counter;
1768 } 1793 }
1769 DoubleLinkedQueue.prototype.isEmpty = function() { 1794 DoubleLinkedQueue.prototype.isEmpty = function() {
1770 return (this._sentinel._next == this._sentinel); 1795 return (this._sentinel._next == this._sentinel);
1771 } 1796 }
1772 DoubleLinkedQueue.prototype.forEach = function(f) { 1797 DoubleLinkedQueue.prototype.forEach = function(f) {
1773 var entry = this._sentinel._next; 1798 var entry = this._sentinel._next;
1774 while (entry != this._sentinel) { 1799 while (entry != this._sentinel) {
1775 var nextEntry = entry._next; 1800 var nextEntry = entry._next;
1776 f.call$1(entry._element); 1801 f(entry._element);
1777 entry = nextEntry; 1802 entry = nextEntry;
1778 } 1803 }
1779 } 1804 }
1780 DoubleLinkedQueue.prototype.every = function(f) { 1805 DoubleLinkedQueue.prototype.every = function(f) {
1781 var entry = this._sentinel._next; 1806 var entry = this._sentinel._next;
1782 while (entry != this._sentinel) { 1807 while (entry != this._sentinel) {
1783 var nextEntry = entry._next; 1808 var nextEntry = entry._next;
1784 if (!f.call$1(entry._element)) return false; 1809 if (!f(entry._element)) return false;
1785 entry = nextEntry; 1810 entry = nextEntry;
1786 } 1811 }
1787 return true; 1812 return true;
1788 } 1813 }
1789 DoubleLinkedQueue.prototype.some = function(f) { 1814 DoubleLinkedQueue.prototype.some = function(f) {
1790 var entry = this._sentinel._next; 1815 var entry = this._sentinel._next;
1791 while (entry != this._sentinel) { 1816 while (entry != this._sentinel) {
1792 var nextEntry = entry._next; 1817 var nextEntry = entry._next;
1793 if (f.call$1(entry._element)) return true; 1818 if (f(entry._element)) return true;
1794 entry = nextEntry; 1819 entry = nextEntry;
1795 } 1820 }
1796 return false; 1821 return false;
1797 } 1822 }
1798 DoubleLinkedQueue.prototype.filter = function(f) { 1823 DoubleLinkedQueue.prototype.filter = function(f) {
1799 var other = new DoubleLinkedQueue(); 1824 var other = new DoubleLinkedQueue();
1800 var entry = this._sentinel._next; 1825 var entry = this._sentinel._next;
1801 while (entry != this._sentinel) { 1826 while (entry != this._sentinel) {
1802 var nextEntry = entry._next; 1827 var nextEntry = entry._next;
1803 if (f.call$1(entry._element)) other.addLast(entry._element); 1828 if (f(entry._element)) other.addLast(entry._element);
1804 entry = nextEntry; 1829 entry = nextEntry;
1805 } 1830 }
1806 return other; 1831 return other;
1807 } 1832 }
1808 DoubleLinkedQueue.prototype.iterator = function() { 1833 DoubleLinkedQueue.prototype.iterator = function() {
1809 return new _DoubleLinkedQueueIterator_E(this._sentinel); 1834 return new _DoubleLinkedQueueIterator_E(this._sentinel);
1810 } 1835 }
1811 DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add; 1836 DoubleLinkedQueue.prototype.add$1 = DoubleLinkedQueue.prototype.add;
1812 DoubleLinkedQueue.prototype.addAll$1 = DoubleLinkedQueue.prototype.addAll; 1837 DoubleLinkedQueue.prototype.addAll$1 = DoubleLinkedQueue.prototype.addAll;
1813 DoubleLinkedQueue.prototype.addLast$1 = DoubleLinkedQueue.prototype.addLast; 1838 DoubleLinkedQueue.prototype.addLast$1 = DoubleLinkedQueue.prototype.addLast;
1839 DoubleLinkedQueue.prototype.every$1 = function($0) {
1840 return this.every(to$call$1($0));
1841 };
1814 DoubleLinkedQueue.prototype.filter$1 = function($0) { 1842 DoubleLinkedQueue.prototype.filter$1 = function($0) {
1815 return this.filter(to$call$1($0)); 1843 return this.filter(to$call$1($0));
1816 }; 1844 };
1817 DoubleLinkedQueue.prototype.forEach$1 = function($0) { 1845 DoubleLinkedQueue.prototype.forEach$1 = function($0) {
1818 return this.forEach(to$call$1($0)); 1846 return this.forEach(to$call$1($0));
1819 }; 1847 };
1820 DoubleLinkedQueue.prototype.isEmpty$0 = DoubleLinkedQueue.prototype.isEmpty; 1848 DoubleLinkedQueue.prototype.isEmpty$0 = DoubleLinkedQueue.prototype.isEmpty;
1821 DoubleLinkedQueue.prototype.iterator$0 = DoubleLinkedQueue.prototype.iterator; 1849 DoubleLinkedQueue.prototype.iterator$0 = DoubleLinkedQueue.prototype.iterator;
1822 DoubleLinkedQueue.prototype.last$0 = DoubleLinkedQueue.prototype.last; 1850 DoubleLinkedQueue.prototype.last$0 = DoubleLinkedQueue.prototype.last;
1823 DoubleLinkedQueue.prototype.removeLast$0 = DoubleLinkedQueue.prototype.removeLas t; 1851 DoubleLinkedQueue.prototype.removeLast$0 = DoubleLinkedQueue.prototype.removeLas t;
1852 DoubleLinkedQueue.prototype.some$1 = function($0) {
1853 return this.some(to$call$1($0));
1854 };
1824 // ********** Code for DoubleLinkedQueue_E ************** 1855 // ********** Code for DoubleLinkedQueue_E **************
1825 $inherits(DoubleLinkedQueue_E, DoubleLinkedQueue); 1856 $inherits(DoubleLinkedQueue_E, DoubleLinkedQueue);
1826 function DoubleLinkedQueue_E() {} 1857 function DoubleLinkedQueue_E() {}
1827 // ********** Code for DoubleLinkedQueue_KeyValuePair_K$V ************** 1858 // ********** Code for DoubleLinkedQueue_KeyValuePair_K$V **************
1828 $inherits(DoubleLinkedQueue_KeyValuePair_K$V, DoubleLinkedQueue); 1859 $inherits(DoubleLinkedQueue_KeyValuePair_K$V, DoubleLinkedQueue);
1829 function DoubleLinkedQueue_KeyValuePair_K$V() { 1860 function DoubleLinkedQueue_KeyValuePair_K$V() {
1830 this._sentinel = new _DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V(); 1861 this._sentinel = new _DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V();
1831 } 1862 }
1832 DoubleLinkedQueue_KeyValuePair_K$V.prototype.addLast = function(value) { 1863 DoubleLinkedQueue_KeyValuePair_K$V.prototype.addLast = function(value) {
1833 this._sentinel.prepend(value); 1864 this._sentinel.prepend(value);
1834 } 1865 }
1835 DoubleLinkedQueue_KeyValuePair_K$V.prototype.lastEntry = function() { 1866 DoubleLinkedQueue_KeyValuePair_K$V.prototype.lastEntry = function() {
1836 return this._sentinel.previousEntry(); 1867 return this._sentinel.previousEntry();
1837 } 1868 }
1838 DoubleLinkedQueue_KeyValuePair_K$V.prototype.forEach = function(f) { 1869 DoubleLinkedQueue_KeyValuePair_K$V.prototype.forEach = function(f) {
1839 var entry = this._sentinel._next; 1870 var entry = this._sentinel._next;
1840 while (entry != this._sentinel) { 1871 while (entry != this._sentinel) {
1841 var nextEntry = entry._next; 1872 var nextEntry = entry._next;
1842 f.call$1(entry._element); 1873 f(entry._element);
1843 entry = nextEntry; 1874 entry = nextEntry;
1844 } 1875 }
1845 } 1876 }
1846 // ********** Code for _DoubleLinkedQueueIterator ************** 1877 // ********** Code for _DoubleLinkedQueueIterator **************
1847 function _DoubleLinkedQueueIterator(_sentinel) { 1878 function _DoubleLinkedQueueIterator(_sentinel) {
1848 this._sentinel = _sentinel; 1879 this._sentinel = _sentinel;
1849 this._currentEntry = this._sentinel; 1880 this._currentEntry = this._sentinel;
1850 } 1881 }
1851 _DoubleLinkedQueueIterator.prototype.hasNext = function() { 1882 _DoubleLinkedQueueIterator.prototype.hasNext = function() {
1852 return this._currentEntry._next != this._sentinel; 1883 return this._currentEntry._next != this._sentinel;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 } 1936 }
1906 StopwatchImplementation.prototype.elapsedInMs$0 = StopwatchImplementation.protot ype.elapsedInMs; 1937 StopwatchImplementation.prototype.elapsedInMs$0 = StopwatchImplementation.protot ype.elapsedInMs;
1907 StopwatchImplementation.prototype.start$0 = StopwatchImplementation.prototype.st art; 1938 StopwatchImplementation.prototype.start$0 = StopwatchImplementation.prototype.st art;
1908 StopwatchImplementation.prototype.stop$0 = StopwatchImplementation.prototype.sto p; 1939 StopwatchImplementation.prototype.stop$0 = StopwatchImplementation.prototype.sto p;
1909 // ********** Code for StringBufferImpl ************** 1940 // ********** Code for StringBufferImpl **************
1910 function StringBufferImpl(content) { 1941 function StringBufferImpl(content) {
1911 this.clear(); 1942 this.clear();
1912 this.add(content); 1943 this.add(content);
1913 } 1944 }
1914 StringBufferImpl.prototype.get$length = function() { 1945 StringBufferImpl.prototype.get$length = function() {
1915 return this._length; 1946 return this._dart_coreimpl_length;
1916 } 1947 }
1917 StringBufferImpl.prototype.isEmpty = function() { 1948 StringBufferImpl.prototype.isEmpty = function() {
1918 return this._length == (0); 1949 return this._dart_coreimpl_length == (0);
1919 } 1950 }
1920 StringBufferImpl.prototype.add = function(obj) { 1951 StringBufferImpl.prototype.add = function(obj) {
1921 var str = obj.toString$0(); 1952 var str = obj.toString$0();
1922 if (str == null || str.isEmpty()) return this; 1953 if (str == null || str.isEmpty()) return this;
1923 this._buffer.add(str); 1954 this._buffer.add(str);
1924 this._length = this._length + str.length; 1955 this._dart_coreimpl_length = this._dart_coreimpl_length + str.length;
1925 return this; 1956 return this;
1926 } 1957 }
1927 StringBufferImpl.prototype.addAll = function(objects) { 1958 StringBufferImpl.prototype.addAll = function(objects) {
1928 for (var $$i = objects.iterator$0(); $$i.hasNext$0(); ) { 1959 for (var $$i = objects.iterator$0(); $$i.hasNext$0(); ) {
1929 var obj = $$i.next$0(); 1960 var obj = $$i.next$0();
1930 this.add(obj); 1961 this.add(obj);
1931 } 1962 }
1932 return this; 1963 return this;
1933 } 1964 }
1934 StringBufferImpl.prototype.clear = function() { 1965 StringBufferImpl.prototype.clear = function() {
1935 this._buffer = new Array(); 1966 this._buffer = new Array();
1936 this._length = (0); 1967 this._dart_coreimpl_length = (0);
1937 return this; 1968 return this;
1938 } 1969 }
1939 StringBufferImpl.prototype.toString = function() { 1970 StringBufferImpl.prototype.toString = function() {
1940 if (this._buffer.get$length() == (0)) return ""; 1971 if (this._buffer.get$length() == (0)) return "";
1941 if (this._buffer.get$length() == (1)) return this._buffer[(0)]; 1972 if (this._buffer.get$length() == (1)) return this._buffer.$index((0));
1942 var result = StringBase.concatAll(this._buffer); 1973 var result = StringBase.concatAll(this._buffer);
1943 this._buffer.clear(); 1974 this._buffer.clear();
1944 this._buffer.add(result); 1975 this._buffer.add(result);
1945 return result; 1976 return result;
1946 } 1977 }
1947 StringBufferImpl.prototype.add$1 = StringBufferImpl.prototype.add; 1978 StringBufferImpl.prototype.add$1 = StringBufferImpl.prototype.add;
1948 StringBufferImpl.prototype.addAll$1 = StringBufferImpl.prototype.addAll; 1979 StringBufferImpl.prototype.addAll$1 = StringBufferImpl.prototype.addAll;
1949 StringBufferImpl.prototype.isEmpty$0 = StringBufferImpl.prototype.isEmpty; 1980 StringBufferImpl.prototype.isEmpty$0 = StringBufferImpl.prototype.isEmpty;
1950 StringBufferImpl.prototype.toString$0 = StringBufferImpl.prototype.toString; 1981 StringBufferImpl.prototype.toString$0 = StringBufferImpl.prototype.toString;
1951 // ********** Code for StringBase ************** 1982 // ********** Code for StringBase **************
1952 function StringBase() {} 1983 function StringBase() {}
1953 StringBase.createFromCharCodes = function(charCodes) { 1984 StringBase.createFromCharCodes = function(charCodes) {
1954 if (Object.getPrototypeOf(charCodes) !== Array.prototype) { 1985 if (Object.getPrototypeOf(charCodes) !== Array.prototype) {
1955 charCodes = new ListFactory.ListFactory$from$factory(charCodes); 1986 charCodes = new ListFactory.ListFactory$from$factory(charCodes);
1956 } 1987 }
1957 return String.fromCharCode.apply(null, charCodes); 1988 return String.fromCharCode.apply(null, charCodes);
1958 } 1989 }
1959 StringBase.join = function(strings, separator) { 1990 StringBase.join = function(strings, separator) {
1960 if (strings.get$length() == (0)) return ""; 1991 if (strings.get$length() == (0)) return "";
1961 var s = strings[(0)]; 1992 var s = strings.$index((0));
1962 for (var i = (1); 1993 for (var i = (1);
1963 i < strings.get$length(); i++) { 1994 i < strings.get$length(); i++) {
1964 s = s + separator + strings[i]; 1995 s = s + separator + strings.$index(i);
1965 } 1996 }
1966 return s; 1997 return s;
1967 } 1998 }
1968 StringBase.concatAll = function(strings) { 1999 StringBase.concatAll = function(strings) {
1969 return StringBase.join(strings, ""); 2000 return StringBase.join(strings, "");
1970 } 2001 }
1971 // ********** Code for StringImplementation ************** 2002 // ********** Code for StringImplementation **************
1972 StringImplementation = String; 2003 StringImplementation = String;
1973 StringImplementation.prototype.get$length = function() { return this.length; }; 2004 StringImplementation.prototype.get$length = function() { return this.length; };
1974 StringImplementation.prototype.endsWith = function(other) { 2005 StringImplementation.prototype.endsWith = function(other) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 StringImplementation.prototype.isEmpty$0 = StringImplementation.prototype.isEmpt y; 2077 StringImplementation.prototype.isEmpty$0 = StringImplementation.prototype.isEmpt y;
2047 StringImplementation.prototype.replaceFirst$2 = StringImplementation.prototype.r eplaceFirst; 2078 StringImplementation.prototype.replaceFirst$2 = StringImplementation.prototype.r eplaceFirst;
2048 StringImplementation.prototype.startsWith$1 = StringImplementation.prototype.sta rtsWith; 2079 StringImplementation.prototype.startsWith$1 = StringImplementation.prototype.sta rtsWith;
2049 StringImplementation.prototype.substring$1 = StringImplementation.prototype.subs tring; 2080 StringImplementation.prototype.substring$1 = StringImplementation.prototype.subs tring;
2050 StringImplementation.prototype.substring$2 = StringImplementation.prototype.subs tring; 2081 StringImplementation.prototype.substring$2 = StringImplementation.prototype.subs tring;
2051 // ********** Code for Collections ************** 2082 // ********** Code for Collections **************
2052 function Collections() {} 2083 function Collections() {}
2053 Collections.forEach = function(iterable, f) { 2084 Collections.forEach = function(iterable, f) {
2054 for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) { 2085 for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) {
2055 var e = $$i.next$0(); 2086 var e = $$i.next$0();
2056 f.call$1(e); 2087 f(e);
2057 } 2088 }
2058 } 2089 }
2059 Collections.some = function(iterable, f) { 2090 Collections.some = function(iterable, f) {
2060 for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) { 2091 for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) {
2061 var e = $$i.next$0(); 2092 var e = $$i.next$0();
2062 if (f.call$1(e)) return true; 2093 if (f(e)) return true;
2063 } 2094 }
2064 return false; 2095 return false;
2065 } 2096 }
2066 Collections.every = function(iterable, f) { 2097 Collections.every = function(iterable, f) {
2067 for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) { 2098 for (var $$i = iterable.iterator$0(); $$i.hasNext$0(); ) {
2068 var e = $$i.next$0(); 2099 var e = $$i.next$0();
2069 if (!f.call$1(e)) return false; 2100 if (!f(e)) return false;
2070 } 2101 }
2071 return true; 2102 return true;
2072 } 2103 }
2073 Collections.filter = function(source, destination, f) { 2104 Collections.filter = function(source, destination, f) {
2074 for (var $$i = source.iterator$0(); $$i.hasNext$0(); ) { 2105 for (var $$i = source.iterator$0(); $$i.hasNext$0(); ) {
2075 var e = $$i.next$0(); 2106 var e = $$i.next$0();
2076 if (f.call$1(e)) destination.add(e); 2107 if (f(e)) destination.add(e);
2077 } 2108 }
2078 return destination; 2109 return destination;
2079 } 2110 }
2080 // ********** Code for _Worker ************** 2111 // ********** Code for _Worker **************
2081 // ********** Code for _ArgumentMismatchException ************** 2112 // ********** Code for _ArgumentMismatchException **************
2082 $inherits(_ArgumentMismatchException, ClosureArgumentMismatchException); 2113 $inherits(_ArgumentMismatchException, ClosureArgumentMismatchException);
2083 function _ArgumentMismatchException(_message) { 2114 function _ArgumentMismatchException(_message) {
2084 this._dart_coreimpl_message = _message; 2115 this._dart_coreimpl_message = _message;
2085 ClosureArgumentMismatchException.call(this); 2116 ClosureArgumentMismatchException.call(this);
2086 } 2117 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 } 2187 }
2157 // ********** Code for top level ************** 2188 // ********** Code for top level **************
2158 function _constList(other) { 2189 function _constList(other) {
2159 other.__proto__ = ImmutableList.prototype; 2190 other.__proto__ = ImmutableList.prototype;
2160 return other; 2191 return other;
2161 } 2192 }
2162 function _map(itemsAndKeys) { 2193 function _map(itemsAndKeys) {
2163 var ret = new LinkedHashMapImplementation(); 2194 var ret = new LinkedHashMapImplementation();
2164 for (var i = (0); 2195 for (var i = (0);
2165 i < itemsAndKeys.get$length(); ) { 2196 i < itemsAndKeys.get$length(); ) {
2166 ret.$setindex(itemsAndKeys[i++], itemsAndKeys[i++]); 2197 ret.$setindex(itemsAndKeys.$index(i++), itemsAndKeys.$index(i++));
2167 } 2198 }
2168 return ret; 2199 return ret;
2169 } 2200 }
2170 // ********** Library node ************** 2201 // ********** Library nodeimpl **************
2171 // ********** Code for Process ************** 2202 // ********** Code for NativeMapBase **************
2172 function Process(_process) { 2203 function NativeMapBase(_map) {
2173 this.SIGSYS = "SIGSYS"; 2204 this._map = _map;
2174 this.SIGALRM = "SIGALRM";
2175 this.SIGXCPU = "SIGXCPU";
2176 this.SIGTSTP = "SIGTSTP";
2177 this.SIGSEGV = "SIGSEGV";
2178 this.SIGQUIT = "SIGQUIT";
2179 this.SIGABRT = "SIGABRT";
2180 this.SIGKILL = "SIGKILL";
2181 this.SIGHUP = "SIGHUP";
2182 this.SIGUSR2 = "SIGUSR2";
2183 this.SIGXFSZ = "SIGXFSZ";
2184 this.SIGCONT = "SIGCONT";
2185 this.SIGTTOU = "SIGTTOU";
2186 this.SIGINT = "SIGINT";
2187 this.SIGURG = "SIGURG";
2188 this.SIGFPE = "SIGFPE";
2189 this.SIGUSR1 = "SIGUSR1";
2190 this.SIGEMT = "SIGEMT";
2191 this.SIGPIPE = "SIGPIPE";
2192 this.SIGTTIN = "SIGTTIN";
2193 this.SIGTERM = "SIGTERM";
2194 this._process = _process;
2195 this.SIGBUS = "SIGBUS";
2196 this.SIGPROF = "SIGPROF";
2197 this.SIGSTOP = "SIGSTOP";
2198 this.SIGCHLD = "SIGCHLD";
2199 this.SIGILL = "SIGILL";
2200 this.SIGTRAP = "SIGTRAP";
2201 this.SIGINFO = "SIGINFO";
2202 this.SIGIO = "SIGIO";
2203 this.SIGVTALRM = "SIGVTALRM";
2204 this.SIGWINCH = "SIGWINCH";
2205 } 2205 }
2206 Process.prototype.get$argv = function() { 2206 NativeMapBase.prototype.get$length = function() {
2207 return this._process.argv; 2207 return this._length(this._map);
2208 } 2208 }
2209 Process.prototype.set$argv = function(value) { 2209 NativeMapBase.prototype._length = function(map) {
2210 this._process.argv = value; 2210 return map.length;
2211 } 2211 }
2212 Process.prototype.get$env = function() { 2212 NativeMapBase.prototype.isEmpty = function() {
2213 return new EnvMap(this._process); 2213 return this.get$length() == (0);
2214 } 2214 }
2215 Process.prototype.exit = function(code) { 2215 NativeMapBase.prototype.getKeys = function() {
2216 this._process.exit(code); 2216 var keys = new Array();
2217 this._forEachKey$2(this._map, (function (key) {
2218 return keys.add(key);
2219 })
2220 );
2221 return keys;
2217 } 2222 }
2218 // ********** Code for EnvMap ************** 2223 NativeMapBase.prototype.getValues = function() {
2219 function EnvMap(_process) { 2224 var $this = this; // closure support
2220 this._process = _process; 2225 var values = new Array();
2226 this._forEachKey$2(this._map, (function (key) {
2227 return values.add($this.$index(key));
2228 })
2229 );
2230 return values;
2221 } 2231 }
2222 EnvMap.prototype.$index = function(key) { 2232 NativeMapBase.prototype.forEach = function(f) {
2223 return this._process.env[key]; 2233 var $this = this; // closure support
2234 return this._forEachKey$2(this._map, (function (k) {
2235 return f.call$2(k, $this.$index(k));
2236 })
2237 );
2224 } 2238 }
2225 // ********** Code for ReadableStream ************** 2239 NativeMapBase.prototype._forEachKey = function(map, f) {
2226 // ********** Code for WritableStream ************** 2240 for (var i in map) {
2241 if (map.hasOwnProperty(i)) {
2242 f(i);
2243 }
2244 }
2245
2246 }
2247 NativeMapBase.prototype._forEachKey$2 = function($0, $1) {
2248 return this._forEachKey($0, to$call$1($1));
2249 };
2250 NativeMapBase.prototype.forEach$1 = function($0) {
2251 return this.forEach(to$call$2($0));
2252 };
2253 NativeMapBase.prototype.getKeys$0 = NativeMapBase.prototype.getKeys;
2254 NativeMapBase.prototype.getValues$0 = NativeMapBase.prototype.getValues;
2255 NativeMapBase.prototype.isEmpty$0 = NativeMapBase.prototype.isEmpty;
2256 // ********** Code for NativeMapBase_dart_core_String **************
2257 $inherits(NativeMapBase_dart_core_String, NativeMapBase);
2258 function NativeMapBase_dart_core_String(_map) {
2259 this._map = _map;
2260 }
2261 NativeMapBase_dart_core_String.prototype.getKeys = function() {
2262 var keys = new Array();
2263 this._forEachKey$2(this._map, (function (key) {
2264 return keys.add(key);
2265 })
2266 );
2267 return keys;
2268 }
2269 NativeMapBase_dart_core_String.prototype.getValues = function() {
2270 var $this = this; // closure support
2271 var values = new Array();
2272 this._forEachKey$2(this._map, (function (key) {
2273 return values.add($this.$index(key));
2274 })
2275 );
2276 return values;
2277 }
2278 NativeMapBase_dart_core_String.prototype.forEach = function(f) {
2279 var $this = this; // closure support
2280 return this._forEachKey$2(this._map, (function (k) {
2281 return f.call$2(k, $this.$index(k));
2282 })
2283 );
2284 }
2285 NativeMapBase_dart_core_String.prototype._forEachKey = function(map, f) {
2286 for (var i in map) {
2287 if (map.hasOwnProperty(i)) {
2288 f(i);
2289 }
2290 }
2291
2292 }
2293 // ********** Code for NativeMapBase_V **************
2294 $inherits(NativeMapBase_V, NativeMapBase);
2295 function NativeMapBase_V(_map) {
2296 this._map = _map;
2297 }
2298 NativeMapBase_V.prototype.getKeys = function() {
2299 var keys = new Array();
2300 this._forEachKey$2(this._map, (function (key) {
2301 return keys.add(key);
2302 })
2303 );
2304 return keys;
2305 }
2306 NativeMapBase_V.prototype.getValues = function() {
2307 var $this = this; // closure support
2308 var values = new Array();
2309 this._forEachKey$2(this._map, (function (key) {
2310 return values.add($this.$index(key));
2311 })
2312 );
2313 return values;
2314 }
2315 NativeMapBase_V.prototype.forEach = function(f) {
2316 var $this = this; // closure support
2317 return this._forEachKey$2(this._map, (function (k) {
2318 return f.call$2(k, $this.$index(k));
2319 })
2320 );
2321 }
2322 NativeMapBase_V.prototype._forEachKey = function(map, f) {
2323 for (var i in map) {
2324 if (map.hasOwnProperty(i)) {
2325 f(i);
2326 }
2327 }
2328
2329 }
2330 // ********** Code for NativeMapPrimitiveValue **************
2331 $inherits(NativeMapPrimitiveValue, NativeMapBase_V);
2332 function NativeMapPrimitiveValue(map) {
2333 NativeMapBase_V.call(this, map);
2334 }
2335 NativeMapPrimitiveValue.prototype.$index = function(key) {
2336 return this._at(this._map, key);
2337 }
2338 NativeMapPrimitiveValue.prototype._at = function(map, key) {
2339 return map[key];
2340 }
2341 // ********** Code for NativeMapPrimitiveValue_dart_core_String **************
2342 $inherits(NativeMapPrimitiveValue_dart_core_String, NativeMapPrimitiveValue);
2343 function NativeMapPrimitiveValue_dart_core_String(map) {
2344 NativeMapBase_dart_core_String.call(this, map);
2345 }
2346 NativeMapPrimitiveValue_dart_core_String.prototype.$index = function(key) {
2347 return this._at(this._map, key);
2348 }
2349 NativeMapPrimitiveValue_dart_core_String.prototype._at = function(map, key) {
2350 return map[key];
2351 }
2352 // ********** Code for top level **************
2353 // ********** Library fs **************
2354 // ********** Code for fs_ReadStream **************
2355 // ********** Code for fs_WriteStream **************
2227 Object.defineProperty(Object.prototype, '$typeNameOf', { value: function() { 2356 Object.defineProperty(Object.prototype, '$typeNameOf', { value: function() {
2228 if ((typeof(window) != 'undefined' && window.constructor.name == 'DOMWindow') 2357 if ((typeof(window) != 'undefined' && window.constructor.name == 'DOMWindow')
2229 || typeof(process) != 'undefined') { // fast-path for Chrome and Node 2358 || typeof(process) != 'undefined') { // fast-path for Chrome and Node
2230 return this.constructor.name; 2359 return this.constructor.name;
2231 } 2360 }
2232 var str = Object.prototype.toString.call(this); 2361 var str = Object.prototype.toString.call(this);
2233 str = str.substring(8, str.length - 1); 2362 str = str.substring(8, str.length - 1);
2234 if (str == 'Window') { 2363 if (str == 'Window') {
2235 str = 'DOMWindow'; 2364 str = 'DOMWindow';
2236 } else if (str == 'Document') { 2365 } else if (str == 'Document') {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2288 map[tagNames[j]] = true; 2417 map[tagNames[j]] = true;
2289 } 2418 }
2290 table.push({tag: tag, tags: tags, map: map}); 2419 table.push({tag: tag, tags: tags, map: map});
2291 } 2420 }
2292 $dynamicMetadata = table; 2421 $dynamicMetadata = table;
2293 } 2422 }
2294 $dynamic("get$end").WriteStream = function() { 2423 $dynamic("get$end").WriteStream = function() {
2295 return this.end.bind(this); 2424 return this.end.bind(this);
2296 } 2425 }
2297 $dynamic("end$0").WriteStream = function() { 2426 $dynamic("end$0").WriteStream = function() {
2298 return this.end(null, "utf8"); 2427 return this.end();
2299 }; 2428 };
2300 $dynamic("write$1").WriteStream = function($0) { 2429 $dynamic("write$1").WriteStream = function($0) {
2301 return this.write($0, "utf8"); 2430 return this.write($0, "utf8");
2302 }; 2431 };
2303 // ********** Code for vm ************** 2432 // ********** Code for fs_FSWatcher **************
2304 vm = require('vm'); 2433 // ********** Code for top level **************
2305 // ********** Code for fs ************** 2434 function get$fs() {
2306 fs = require('fs'); 2435 return require("fs");
2307 // ********** Code for path ************** 2436 }
2308 path = require('path'); 2437 // ********** Library node **************
2438 // ********** Code for Process **************
2439 function Process(_process) {
2440 this.SIGSYS = "SIGSYS";
2441 this.SIGALRM = "SIGALRM";
2442 this.SIGXCPU = "SIGXCPU";
2443 this.SIGTSTP = "SIGTSTP";
2444 this.SIGSEGV = "SIGSEGV";
2445 this.SIGQUIT = "SIGQUIT";
2446 this.SIGABRT = "SIGABRT";
2447 this.SIGKILL = "SIGKILL";
2448 this.SIGHUP = "SIGHUP";
2449 this.SIGUSR2 = "SIGUSR2";
2450 this.SIGXFSZ = "SIGXFSZ";
2451 this.SIGCONT = "SIGCONT";
2452 this.SIGTTOU = "SIGTTOU";
2453 this.SIGINT = "SIGINT";
2454 this.SIGURG = "SIGURG";
2455 this.SIGFPE = "SIGFPE";
2456 this.SIGUSR1 = "SIGUSR1";
2457 this.SIGEMT = "SIGEMT";
2458 this.SIGPIPE = "SIGPIPE";
2459 this.SIGTTIN = "SIGTTIN";
2460 this.SIGTERM = "SIGTERM";
2461 this._process = _process;
2462 this.SIGBUS = "SIGBUS";
2463 this.SIGPROF = "SIGPROF";
2464 this.SIGSTOP = "SIGSTOP";
2465 this.SIGCHLD = "SIGCHLD";
2466 this.SIGILL = "SIGILL";
2467 this.SIGTRAP = "SIGTRAP";
2468 this.SIGINFO = "SIGINFO";
2469 this.SIGIO = "SIGIO";
2470 this.SIGVTALRM = "SIGVTALRM";
2471 this.SIGWINCH = "SIGWINCH";
2472 }
2473 Process.prototype.get$argv = function() {
2474 return this._process.argv;
2475 }
2476 Process.prototype.set$argv = function(value) {
2477 this._process.argv = value;
2478 }
2479 Process.prototype.get$env = function() {
2480 return new _EnvMap(this._env());
2481 }
2482 Process.prototype._env = function() {
2483 return this._process.env;
2484 }
2485 Process.prototype.exit = function(code) {
2486 this._process.exit(code);
2487 }
2488 // ********** Code for _EnvMap **************
2489 $inherits(_EnvMap, NativeMapPrimitiveValue_dart_core_String);
2490 function _EnvMap(env) {
2491 NativeMapPrimitiveValue_dart_core_String.call(this, env);
2492 }
2493 _EnvMap.prototype._node_forEachKey = function(map, f) {
2494 for (var i in map) {
2495 f(i);
2496 }
2497
2498 }
2309 // ********** Code for top level ************** 2499 // ********** Code for top level **************
2310 function createSandbox() { 2500 function createSandbox() {
2311 return {'require': require, 'process': process, 'console': console, 2501 return {
2502 'require': require,
2503 'process': process,
2504 'console': console,
2312 'Buffer' : Buffer, 2505 'Buffer' : Buffer,
2313 'setTimeout': setTimeout, 'clearTimeout': clearTimeout}; 2506 'setTimeout': setTimeout,
2507 'clearTimeout': clearTimeout,
2508 'setInterval': setInterval,
2509 'clearInterval': clearInterval,
2510 'module' : module,
2511 'ArrayBuffer': ArrayBuffer,
2512 'Int8Array': Int8Array,
2513 'Uint8Array': Uint8Array,
2514 'Int16Array': Int16Array,
2515 'Uint16Array': Uint16Array,
2516 'Int32Array': Int32Array,
2517 'Uint32Array': Uint32Array,
2518 'Float32Array': Float32Array,
2519 'Float64Array': Float64Array,
2520 'DataView': DataView
2521 };
2314 } 2522 }
2315 function get$_process() { 2523 function get$_process() {
2316 return process; 2524 return process;
2317 } 2525 }
2318 function get$process() { 2526 function get$process() {
2319 return new Process(get$_process()); 2527 return new Process(get$_process());
2320 } 2528 }
2529 // ********** Library path **************
2530 // ********** Code for path **************
2531 path = require('path');
2532 // ********** Code for top level **************
2533 // ********** Library vm **************
2534 // ********** Code for vm **************
2535 vm = require('vm');
2536 // ********** Code for top level **************
2321 // ********** Library file_system ************** 2537 // ********** Library file_system **************
2322 // ********** Code for top level ************** 2538 // ********** Code for top level **************
2323 function canonicalizePath(path) { 2539 function canonicalizePath(path) {
2324 return path.replaceAll("\\", "/"); 2540 return path.replaceAll("\\", "/");
2325 } 2541 }
2326 function joinPaths(path1, path2) { 2542 function joinPaths(path1, path2) {
2327 path1 = canonicalizePath(path1); 2543 path1 = canonicalizePath(path1);
2328 path2 = canonicalizePath(path2); 2544 path2 = canonicalizePath(path2);
2329 var pieces = path1.split("/"); 2545 var pieces = path1.split("/");
2330 var $$list = path2.split("/"); 2546 var $$list = path2.split("/");
2331 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 2547 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
2332 var piece = $$list[$$i]; 2548 var piece = $$list.$index($$i);
2333 if ($eq(piece, "..") && pieces.get$length() > (0) && $ne(pieces.last$0(), ". ") && $ne(pieces.last$0(), "..")) { 2549 if ($eq(piece, "..") && pieces.get$length() > (0) && $ne(pieces.last$0(), ". ") && $ne(pieces.last$0(), "..")) {
2334 pieces.removeLast$0(); 2550 pieces.removeLast$0();
2335 } 2551 }
2336 else if ($ne(piece, "")) { 2552 else if ($ne(piece, "")) {
2337 if (pieces.get$length() > (0) && $eq(pieces.last$0(), ".")) { 2553 if (pieces.get$length() > (0) && $eq(pieces.last$0(), ".")) {
2338 pieces.removeLast$0(); 2554 pieces.removeLast$0();
2339 } 2555 }
2340 pieces.add$1(piece); 2556 pieces.add$1(piece);
2341 } 2557 }
2342 } 2558 }
(...skipping 18 matching lines...) Expand all
2361 else { 2577 else {
2362 return path.substring(lastSlash + (1)); 2578 return path.substring(lastSlash + (1));
2363 } 2579 }
2364 } 2580 }
2365 // ********** Library file_system_node ************** 2581 // ********** Library file_system_node **************
2366 // ********** Code for NodeFileSystem ************** 2582 // ********** Code for NodeFileSystem **************
2367 function NodeFileSystem() { 2583 function NodeFileSystem() {
2368 2584
2369 } 2585 }
2370 NodeFileSystem.prototype.writeString = function(outfile, text) { 2586 NodeFileSystem.prototype.writeString = function(outfile, text) {
2371 fs.writeFileSync(outfile, text); 2587 get$fs().writeFileSync(outfile, text, "utf8");
2372 } 2588 }
2373 NodeFileSystem.prototype.readAll = function(filename) { 2589 NodeFileSystem.prototype.readAll = function(filename) {
2374 return fs.readFileSync(filename, "utf8"); 2590 return get$fs().readFileSync(filename, "utf8");
2375 } 2591 }
2376 NodeFileSystem.prototype.fileExists = function(filename) { 2592 NodeFileSystem.prototype.fileExists = function(filename) {
2377 return path.existsSync(filename); 2593 return path.existsSync(filename);
2378 } 2594 }
2379 // ********** Code for top level ************** 2595 // ********** Code for top level **************
2380 // ********** Library lang ************** 2596 // ********** Library lang **************
2381 // ********** Code for BlockScope ************** 2597 // ********** Code for BlockScope **************
2382 function BlockScope(enclosingMethod, parent, node, reentrant) { 2598 function BlockScope(enclosingMethod, parent, node, reentrant) {
2383 this.enclosingMethod = enclosingMethod; 2599 this.enclosingMethod = enclosingMethod;
2384 this._vars = new CopyOnWriteMap_dart_core_String$VariableValue(); 2600 this._vars = new CopyOnWriteMap_dart_core_String$VariableValue();
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 else { 2914 else {
2699 if (this.useWrap0) { 2915 if (this.useWrap0) {
2700 w.writeln("function $wrap_call$0(fn) { return fn; }"); 2916 w.writeln("function $wrap_call$0(fn) { return fn; }");
2701 } 2917 }
2702 if (this.useWrap1) { 2918 if (this.useWrap1) {
2703 w.writeln("function $wrap_call$1(fn) { return fn; }"); 2919 w.writeln("function $wrap_call$1(fn) { return fn; }");
2704 } 2920 }
2705 } 2921 }
2706 var $$list = orderValuesByKeys(this._usedOperators); 2922 var $$list = orderValuesByKeys(this._usedOperators);
2707 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 2923 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
2708 var opImpl = $$list[$$i]; 2924 var opImpl = $$list.$index($$i);
2709 w.writeln(opImpl); 2925 w.writeln(opImpl);
2710 } 2926 }
2711 if ($globals.world.dom != null) { 2927 if ($globals.world.dom != null) {
2712 this.ensureTypeNameOf(); 2928 this.ensureTypeNameOf();
2713 w.writeln("Object.defineProperty(Object.prototype, \"get$typeName\", { value : Object.prototype.$typeNameOf, enumerable: false, writable: true, configurable: true});"); 2929 w.writeln("Object.defineProperty(Object.prototype, \"get$typeName\", { value : Object.prototype.$typeNameOf, enumerable: false, writable: true, configurable: true});");
2714 } 2930 }
2715 } 2931 }
2716 CoreJs.prototype.generate$1 = CoreJs.prototype.generate; 2932 CoreJs.prototype.generate$1 = CoreJs.prototype.generate;
2717 // ********** Code for Element ************** 2933 // ********** Code for Element **************
2718 function Element(name, _enclosingElement) { 2934 function Element(name, _enclosingElement) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 var $0; 2977 var $0;
2762 return (this._enclosingElement = ($0 = e), $0); 2978 return (this._enclosingElement = ($0 = e), $0);
2763 } 2979 }
2764 Element.prototype.resolveType = function(node, typeErrors) { 2980 Element.prototype.resolveType = function(node, typeErrors) {
2765 if (node == null) return $globals.world.varType; 2981 if (node == null) return $globals.world.varType;
2766 if (node.type != null) return node.type; 2982 if (node.type != null) return node.type;
2767 if ((node instanceof NameTypeReference)) { 2983 if ((node instanceof NameTypeReference)) {
2768 var typeRef = node; 2984 var typeRef = node;
2769 var name; 2985 var name;
2770 if (typeRef.names != null) { 2986 if (typeRef.names != null) {
2771 name = typeRef.names.last().get$name(); 2987 name = typeRef.names.last$0().get$name();
2772 } 2988 }
2773 else { 2989 else {
2774 name = typeRef.name.name; 2990 name = typeRef.name.name;
2775 } 2991 }
2776 if (this.get$typeParameters() != null) { 2992 if (this.get$typeParameters() != null) {
2777 var $$list = this.get$typeParameters(); 2993 var $$list = this.get$typeParameters();
2778 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 2994 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
2779 var tp = $$list[$$i]; 2995 var tp = $$list.$index($$i);
2780 if ($eq(tp.get$name(), name)) { 2996 if ($eq(tp.get$name(), name)) {
2781 typeRef.type = tp; 2997 typeRef.type = tp;
2782 } 2998 }
2783 } 2999 }
2784 } 3000 }
2785 if (typeRef.type != null) { 3001 if (typeRef.type != null) {
2786 return typeRef.type; 3002 return typeRef.type;
2787 } 3003 }
2788 return this.get$enclosingElement().resolveType$2(node, typeErrors); 3004 return this.get$enclosingElement().resolveType$2(node, typeErrors);
2789 } 3005 }
2790 else if ((node instanceof GenericTypeReference)) { 3006 else if ((node instanceof GenericTypeReference)) {
2791 var typeRef = node; 3007 var typeRef = node;
2792 var baseType = this.resolveType$2(typeRef.baseType, typeErrors); 3008 var baseType = this.resolveType$2(typeRef.baseType, typeErrors);
2793 if (!baseType.get$isGeneric()) { 3009 if (!baseType.get$isGeneric()) {
2794 $globals.world.error(("" + baseType.get$name() + " is not generic"), typeR ef.span); 3010 $globals.world.error(("" + baseType.get$name() + " is not generic"), typeR ef.span);
2795 return null; 3011 return null;
2796 } 3012 }
2797 if (typeRef.typeArguments.get$length() != baseType.get$typeParameters().get$ length()) { 3013 if (typeRef.typeArguments.get$length() != baseType.get$typeParameters().get$ length()) {
2798 $globals.world.error("wrong number of type arguments", typeRef.span); 3014 $globals.world.error("wrong number of type arguments", typeRef.span);
2799 return null; 3015 return null;
2800 } 3016 }
2801 var typeArgs = []; 3017 var typeArgs = [];
2802 for (var i = (0); 3018 for (var i = (0);
2803 i < typeRef.typeArguments.get$length(); i++) { 3019 i < typeRef.typeArguments.get$length(); i++) {
2804 typeArgs.add$1(this.resolveType$2(typeRef.typeArguments[i], typeErrors)); 3020 typeArgs.add$1(this.resolveType$2(typeRef.typeArguments.$index(i), typeErr ors));
2805 } 3021 }
2806 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs); 3022 typeRef.type = baseType.getOrMakeConcreteType$1(typeArgs);
2807 } 3023 }
2808 else if ((node instanceof FunctionTypeReference)) { 3024 else if ((node instanceof FunctionTypeReference)) {
2809 var typeRef = node; 3025 var typeRef = node;
2810 var name = ""; 3026 var name = "";
2811 if (typeRef.func.name != null) { 3027 if (typeRef.func.name != null) {
2812 name = typeRef.func.name.name; 3028 name = typeRef.func.name.name;
2813 } 3029 }
2814 typeRef.type = this.get$library().getOrAddFunctionType(this, name, typeRef.f unc); 3030 typeRef.type = this.get$library().getOrAddFunctionType(this, name, typeRef.f unc);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2875 this.writeGlobals(); 3091 this.writeGlobals();
2876 this.writer.writeln(("" + mainCall.get$code() + ";")); 3092 this.writer.writeln(("" + mainCall.get$code() + ";"));
2877 } 3093 }
2878 WorldGenerator.prototype.markLibrariesUsed = function(libs) { 3094 WorldGenerator.prototype.markLibrariesUsed = function(libs) {
2879 return this.getAllTypes(libs).forEach(this.get$markTypeUsed()); 3095 return this.getAllTypes(libs).forEach(this.get$markTypeUsed());
2880 } 3096 }
2881 WorldGenerator.prototype.markTypeUsed = function(type) { 3097 WorldGenerator.prototype.markTypeUsed = function(type) {
2882 if (!type.get$isClass()) return; 3098 if (!type.get$isClass()) return;
2883 type.markUsed(); 3099 type.markUsed();
2884 type.isTested = true; 3100 type.isTested = true;
2885 type.isTested = !type.get$isTop() && !(type.get$isNative() && type.get$members ().getValues().every((function (m) { 3101 type.isTested = !type.get$isTop() && !(type.get$isNative() && type.get$members ().getValues$0().every$1((function (m) {
2886 return m.get$isStatic() && !m.get$isFactory(); 3102 return m.get$isStatic() && !m.get$isFactory();
2887 }) 3103 })
2888 )); 3104 ));
2889 var members = ListFactory.ListFactory$from$factory(type.get$members().getValue s()); 3105 var members = ListFactory.ListFactory$from$factory(type.get$members().getValue s$0());
2890 members.addAll$1(type.get$constructors().getValues()); 3106 members.addAll$1(type.get$constructors().getValues$0());
2891 type.get$factories().forEach((function (f) { 3107 type.get$factories().forEach((function (f) {
2892 return members.add$1(f); 3108 return members.add$1(f);
2893 }) 3109 })
2894 ); 3110 );
2895 for (var $$i = members.iterator$0(); $$i.hasNext$0(); ) { 3111 for (var $$i = members.iterator$0(); $$i.hasNext$0(); ) {
2896 var member = $$i.next$0(); 3112 var member = $$i.next$0();
2897 if ((member instanceof PropertyMember)) { 3113 if ((member instanceof PropertyMember)) {
2898 if (member.get$getter() != null) this.genMethod(member.get$getter()); 3114 if (member.get$getter() != null) this.genMethod(member.get$getter());
2899 if (member.get$setter() != null) this.genMethod(member.get$setter()); 3115 if (member.get$setter() != null) this.genMethod(member.get$setter());
2900 } 3116 }
2901 if ((member instanceof MethodMember)) this.genMethod(member); 3117 if ((member instanceof MethodMember)) this.genMethod(member);
2902 } 3118 }
2903 } 3119 }
2904 WorldGenerator.prototype.get$markTypeUsed = function() { 3120 WorldGenerator.prototype.get$markTypeUsed = function() {
2905 return this.markTypeUsed.bind(this); 3121 return this.markTypeUsed.bind(this);
2906 } 3122 }
2907 WorldGenerator.prototype.getAllTypes = function(libs) { 3123 WorldGenerator.prototype.getAllTypes = function(libs) {
2908 var types = []; 3124 var types = [];
2909 var seen = new HashSetImplementation(); 3125 var seen = new HashSetImplementation();
2910 for (var $$i = 0;$$i < libs.get$length(); $$i++) { 3126 for (var $$i = 0;$$i < libs.get$length(); $$i++) {
2911 var mainLib = libs[$$i]; 3127 var mainLib = libs.$index($$i);
2912 var toCheck = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([mainLib]); 3128 var toCheck = DoubleLinkedQueue.DoubleLinkedQueue$from$factory([mainLib]);
2913 while (!toCheck.isEmpty()) { 3129 while (!toCheck.isEmpty()) {
2914 var lib = toCheck.removeFirst(); 3130 var lib = toCheck.removeFirst();
2915 if (seen.contains(lib)) continue; 3131 if (seen.contains(lib)) continue;
2916 seen.add(lib); 3132 seen.add(lib);
2917 lib.get$imports().forEach$1((function (lib, toCheck, i) { 3133 lib.get$imports().forEach$1((function (lib, toCheck, i) {
2918 return toCheck.addLast(lib); 3134 return toCheck.addLast(lib);
2919 }).bind(null, lib, toCheck) 3135 }).bind(null, lib, toCheck)
2920 ); 3136 );
2921 lib.get$types().getValues$0().forEach$1((function (t) { 3137 lib.get$types().getValues$0().forEach$1((function (t) {
(...skipping 24 matching lines...) Expand all
2946 ret = new GlobalValue(exp.get$type(), name, true, null, name, exp, exp.span, dependencies); 3162 ret = new GlobalValue(exp.get$type(), name, true, null, name, exp, exp.span, dependencies);
2947 this.globals.$setindex(key, ret); 3163 this.globals.$setindex(key, ret);
2948 } 3164 }
2949 return ret; 3165 return ret;
2950 } 3166 }
2951 WorldGenerator.prototype.writeTypes = function(lib) { 3167 WorldGenerator.prototype.writeTypes = function(lib) {
2952 if (lib.isWritten) return; 3168 if (lib.isWritten) return;
2953 lib.isWritten = true; 3169 lib.isWritten = true;
2954 var $$list = lib.imports; 3170 var $$list = lib.imports;
2955 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3171 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
2956 var import_ = $$list[$$i]; 3172 var import_ = $$list.$index($$i);
2957 this.writeTypes(import_.get$library()); 3173 this.writeTypes(import_.get$library());
2958 } 3174 }
2959 for (var i = (0); 3175 for (var i = (0);
2960 i < lib.sources.get$length(); i++) { 3176 i < lib.sources.get$length(); i++) {
2961 lib.sources[i].set$orderInLibrary(i); 3177 lib.sources.$index(i).set$orderInLibrary(i);
2962 } 3178 }
2963 this.writer.comment(("// ********** Library " + lib.name + " **************") ); 3179 this.writer.comment(("// ********** Library " + lib.name + " **************") );
2964 if (lib.get$isCore()) { 3180 if (lib.get$isCore()) {
2965 this.writer.comment("// ********** Natives dart:core **************"); 3181 this.writer.comment("// ********** Natives dart:core **************");
2966 this.corejs.generate(this.writer); 3182 this.corejs.generate(this.writer);
2967 } 3183 }
2968 var $$list = lib.natives; 3184 var $$list = lib.natives;
2969 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3185 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
2970 var file = $$list[$$i]; 3186 var file = $$list.$index($$i);
2971 var filename = basename(file.get$filename()); 3187 var filename = basename(file.get$filename());
2972 this.writer.comment(("// ********** Natives " + filename + " ************** ")); 3188 this.writer.comment(("// ********** Natives " + filename + " ************** "));
2973 this.writer.writeln(file.get$text()); 3189 this.writer.writeln(file.get$text());
2974 } 3190 }
2975 lib.topType.markUsed(); 3191 lib.topType.markUsed();
2976 var orderedTypes = this._orderValues(lib.types); 3192 var orderedTypes = this._orderValues(lib.types);
2977 for (var $$i = orderedTypes.iterator$0(); $$i.hasNext$0(); ) { 3193 for (var $$i = orderedTypes.iterator$0(); $$i.hasNext$0(); ) {
2978 var type = $$i.next$0(); 3194 var type = $$i.next$0();
2979 if ((type.get$library().get$isDom() || type.get$isHiddenNativeType()) && typ e.get$isClass()) { 3195 if ((type.get$library().get$isDom() || type.get$isHiddenNativeType()) && typ e.get$isClass()) {
2980 type.markUsed$0(); 3196 type.markUsed$0();
2981 } 3197 }
2982 } 3198 }
2983 for (var $$i = orderedTypes.iterator$0(); $$i.hasNext$0(); ) { 3199 for (var $$i = orderedTypes.iterator$0(); $$i.hasNext$0(); ) {
2984 var type = $$i.next$0(); 3200 var type = $$i.next$0();
2985 if (type.get$isUsed() && type.get$isClass()) { 3201 if (type.get$isUsed() && type.get$isClass()) {
2986 this.writeType(type); 3202 this.writeType(type);
2987 if (type.get$isGeneric()) { 3203 if (type.get$isGeneric()) {
2988 var $$list = this._orderValues(type.get$_concreteTypes()); 3204 var $$list = this._orderValues(type.get$_concreteTypes());
2989 for (var $i0 = 0;$i0 < $$list.get$length(); $i0++) { 3205 for (var $i0 = 0;$i0 < $$list.get$length(); $i0++) {
2990 var ct = $$list[$i0]; 3206 var ct = $$list.$index($i0);
2991 this.writeType(ct); 3207 this.writeType(ct);
2992 } 3208 }
2993 } 3209 }
2994 } 3210 }
2995 else if (type.get$isFunction() && type.get$varStubs().get$length() > (0)) { 3211 else if (type.get$isFunction() && type.get$varStubs().get$length() > (0)) {
2996 this.writer.comment(("// ********** Code for " + type.get$jsname() + " *** ***********")); 3212 this.writer.comment(("// ********** Code for " + type.get$jsname() + " *** ***********"));
2997 this._writeDynamicStubs(type); 3213 this._writeDynamicStubs(type);
2998 } 3214 }
2999 if (type.get$typeCheckCode() != null) { 3215 if (type.get$typeCheckCode() != null) {
3000 this.writer.writeln(type.get$typeCheckCode()); 3216 this.writer.writeln(type.get$typeCheckCode());
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 else { 3331 else {
3116 var standardConstructor = type.get$constructors().$index(""); 3332 var standardConstructor = type.get$constructors().$index("");
3117 if (standardConstructor == null || standardConstructor.generator == null) { 3333 if (standardConstructor == null || standardConstructor.generator == null) {
3118 if (!type.get$isNative()) { 3334 if (!type.get$isNative()) {
3119 this.writer.writeln(("function " + type.get$jsname() + "() {}")); 3335 this.writer.writeln(("function " + type.get$jsname() + "() {}"));
3120 } 3336 }
3121 } 3337 }
3122 else { 3338 else {
3123 standardConstructor.generator.writeDefinition(this.writer, null); 3339 standardConstructor.generator.writeDefinition(this.writer, null);
3124 } 3340 }
3125 var $$list = type.get$constructors().getValues(); 3341 var $$list = type.get$constructors().getValues$0();
3126 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 3342 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
3127 var c = $$i.next$0(); 3343 var c = $$i.next$0();
3128 if (c.get$generator() != null && $ne(c, standardConstructor)) { 3344 if (c.get$generator() != null && $ne(c, standardConstructor)) {
3129 c.get$generator().writeDefinition$2(this.writer); 3345 c.get$generator().writeDefinition$2(this.writer);
3130 } 3346 }
3131 } 3347 }
3132 } 3348 }
3133 if (!(type instanceof ConcreteType)) { 3349 if (!(type instanceof ConcreteType)) {
3134 this._maybeIsTest(type, type); 3350 this._maybeIsTest(type, type);
3135 } 3351 }
3136 if (type.get$genericType()._concreteTypes != null) { 3352 if (type.get$genericType()._concreteTypes != null) {
3137 var $$list = this._orderValues(type.get$genericType()._concreteTypes); 3353 var $$list = this._orderValues(type.get$genericType()._concreteTypes);
3138 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3354 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3139 var ct = $$list[$$i]; 3355 var ct = $$list.$index($$i);
3140 this._maybeIsTest(type, ct); 3356 this._maybeIsTest(type, ct);
3141 } 3357 }
3142 } 3358 }
3143 if (type.get$interfaces() != null) { 3359 if (type.get$interfaces() != null) {
3144 var seen = new HashSetImplementation(); 3360 var seen = new HashSetImplementation();
3145 var worklist = []; 3361 var worklist = [];
3146 worklist.addAll$1(type.get$interfaces()); 3362 worklist.addAll$1(type.get$interfaces());
3147 seen.addAll$1(type.get$interfaces()); 3363 seen.addAll$1(type.get$interfaces());
3148 while (!worklist.isEmpty$0()) { 3364 while (!worklist.isEmpty$0()) {
3149 var interface_ = worklist.removeLast$0(); 3365 var interface_ = worklist.removeLast$0();
3150 this._maybeIsTest(type, interface_.get$genericType()); 3366 this._maybeIsTest(type, interface_.get$genericType());
3151 if (interface_.get$genericType().get$_concreteTypes() != null) { 3367 if (interface_.get$genericType().get$_concreteTypes() != null) {
3152 var $$list = this._orderValues(interface_.get$genericType().get$_concret eTypes()); 3368 var $$list = this._orderValues(interface_.get$genericType().get$_concret eTypes());
3153 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3369 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3154 var ct = $$list[$$i]; 3370 var ct = $$list.$index($$i);
3155 this._maybeIsTest(type, ct); 3371 this._maybeIsTest(type, ct);
3156 } 3372 }
3157 } 3373 }
3158 var $$list = interface_.get$interfaces(); 3374 var $$list = interface_.get$interfaces();
3159 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 3375 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
3160 var other = $$i.next$0(); 3376 var other = $$i.next$0();
3161 if (!seen.contains$1(other)) { 3377 if (!seen.contains$1(other)) {
3162 worklist.addLast$1(other); 3378 worklist.addLast$1(other);
3163 seen.add$1(other); 3379 seen.add$1(other);
3164 } 3380 }
3165 } 3381 }
3166 } 3382 }
3167 } 3383 }
3168 type.get$factories().forEach(this.get$_writeMethod()); 3384 type.get$factories().forEach(this.get$_writeMethod());
3169 var $$list = this._orderValues(type.get$members()); 3385 var $$list = this._orderValues(type.get$members());
3170 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3386 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3171 var member = $$list[$$i]; 3387 var member = $$list.$index($$i);
3172 if ((member instanceof FieldMember)) { 3388 if ((member instanceof FieldMember)) {
3173 this._writeField(member); 3389 this._writeField(member);
3174 } 3390 }
3175 if ((member instanceof PropertyMember)) { 3391 if ((member instanceof PropertyMember)) {
3176 this._writeProperty(member); 3392 this._writeProperty(member);
3177 } 3393 }
3178 if (member.get$isMethod()) { 3394 if (member.get$isMethod()) {
3179 this._writeMethod(member); 3395 this._writeMethod(member);
3180 } 3396 }
3181 } 3397 }
3182 this._writeDynamicStubs(type); 3398 this._writeDynamicStubs(type);
3183 } 3399 }
3184 WorldGenerator.prototype._typeNeedsHolderForStaticMethods = function(type) { 3400 WorldGenerator.prototype._typeNeedsHolderForStaticMethods = function(type) {
3185 var $$list = type.get$members().getValues(); 3401 var $$list = type.get$members().getValues$0();
3186 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 3402 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
3187 var member = $$i.next$0(); 3403 var member = $$i.next$0();
3188 if (member.get$isMethod()) { 3404 if (member.get$isMethod()) {
3189 if (member.get$isConstructor() || member.get$isStatic()) { 3405 if (member.get$isConstructor() || member.get$isStatic()) {
3190 if (member.get$isGenerated()) { 3406 if (member.get$isGenerated()) {
3191 return true; 3407 return true;
3192 } 3408 }
3193 } 3409 }
3194 } 3410 }
3195 } 3411 }
3196 return false; 3412 return false;
3197 } 3413 }
3198 WorldGenerator.prototype._ensureInheritMembersHelper = function() { 3414 WorldGenerator.prototype._ensureInheritMembersHelper = function() {
3199 if (this._mixins != null) return; 3415 if (this._mixins != null) return;
3200 this._mixins = new CodeWriter(); 3416 this._mixins = new CodeWriter();
3201 this._mixins.comment("// ********** Generic Type Inheritance **************"); 3417 this._mixins.comment("// ********** Generic Type Inheritance **************");
3202 this._mixins.writeln("/** Implements extends for generic types. */\nfunction $ inheritsMembers(child, parent) {\n child = child.prototype;\n parent = parent. prototype;\n Object.getOwnPropertyNames(parent).forEach(function(name) {\n i f (typeof(child[name]) == 'undefined') child[name] = parent[name];\n });\n}"); 3418 this._mixins.writeln("/** Implements extends for generic types. */\nfunction $ inheritsMembers(child, parent) {\n child = child.prototype;\n parent = parent. prototype;\n Object.getOwnPropertyNames(parent).forEach(function(name) {\n i f (typeof(child[name]) == 'undefined') child[name] = parent[name];\n });\n}");
3203 } 3419 }
3204 WorldGenerator.prototype._writeDynamicStubs = function(type) { 3420 WorldGenerator.prototype._writeDynamicStubs = function(type) {
3205 var $$list = orderValuesByKeys(type.varStubs); 3421 var $$list = orderValuesByKeys(type.varStubs);
3206 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3422 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3207 var stub = $$list[$$i]; 3423 var stub = $$list.$index($$i);
3208 if (!stub.get$isGenerated()) stub.generate$1(this.writer); 3424 if (!stub.get$isGenerated()) stub.generate$1(this.writer);
3209 } 3425 }
3210 } 3426 }
3211 WorldGenerator.prototype._writeStaticField = function(field) { 3427 WorldGenerator.prototype._writeStaticField = function(field) {
3212 if (field.isFinal) return; 3428 if (field.isFinal) return;
3213 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname ()); 3429 var fullname = ("" + field.declaringType.get$jsname() + "." + field.get$jsname ());
3214 if (this.globals.containsKey(fullname)) { 3430 if (this.globals.containsKey(fullname)) {
3215 var value = this.globals.$index(fullname); 3431 var value = this.globals.$index(fullname);
3216 if (field.declaringType.get$isTop() && !field.isNative) { 3432 if (field.declaringType.get$isTop() && !field.isNative) {
3217 this.writer.writeln(("$globals." + field.get$jsname() + " = " + value.get$ exp().get$code() + ";")); 3433 this.writer.writeln(("$globals." + field.get$jsname() + " = " + value.get$ exp().get$code() + ";"));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3254 else if ((m instanceof MethodMember) && m.get$isNative() && m._provideProperty Syntax && !m._provideFieldSyntax) { 3470 else if ((m instanceof MethodMember) && m.get$isNative() && m._provideProperty Syntax && !m._provideFieldSyntax) {
3255 MethodGenerator._maybeGenerateBoundGetter(m, this.writer); 3471 MethodGenerator._maybeGenerateBoundGetter(m, this.writer);
3256 } 3472 }
3257 } 3473 }
3258 WorldGenerator.prototype.get$_writeMethod = function() { 3474 WorldGenerator.prototype.get$_writeMethod = function() {
3259 return this._writeMethod.bind(this); 3475 return this._writeMethod.bind(this);
3260 } 3476 }
3261 WorldGenerator.prototype.writeGlobals = function() { 3477 WorldGenerator.prototype.writeGlobals = function() {
3262 if (this.globals.get$length() > (0)) { 3478 if (this.globals.get$length() > (0)) {
3263 this.writer.comment("// ********** Globals **************"); 3479 this.writer.comment("// ********** Globals **************");
3264 var list = this.globals.getValues(); 3480 var list = this.globals.getValues$0();
3265 list.sort$1((function (a, b) { 3481 list.sort$1((function (a, b) {
3266 return a.compareTo$1(b); 3482 return a.compareTo$1(b);
3267 }) 3483 })
3268 ); 3484 );
3269 this.writer.enterBlock("function $static_init(){"); 3485 this.writer.enterBlock("function $static_init(){");
3270 for (var $$i = list.iterator$0(); $$i.hasNext$0(); ) { 3486 for (var $$i = list.iterator$0(); $$i.hasNext$0(); ) {
3271 var global = $$i.next$0(); 3487 var global = $$i.next$0();
3272 if (global.get$field() != null) { 3488 if (global.get$field() != null) {
3273 this._writeStaticField(global.get$field()); 3489 this._writeStaticField(global.get$field());
3274 } 3490 }
(...skipping 23 matching lines...) Expand all
3298 var $this = this; // closure support 3514 var $this = this; // closure support
3299 if (this.typesWithDynamicDispatch == null) return; 3515 if (this.typesWithDynamicDispatch == null) return;
3300 this.writer.comment(("// " + this.typesWithDynamicDispatch.get$length() + " dy namic types.")); 3516 this.writer.comment(("// " + this.typesWithDynamicDispatch.get$length() + " dy namic types."));
3301 var seen = new HashSetImplementation(); 3517 var seen = new HashSetImplementation();
3302 var types = []; 3518 var types = [];
3303 function visit(type) { 3519 function visit(type) {
3304 if (seen.contains$1(type)) return; 3520 if (seen.contains$1(type)) return;
3305 seen.add$1(type); 3521 seen.add$1(type);
3306 var $$list = $this._orderCollectionValues(type.get$directSubtypes()); 3522 var $$list = $this._orderCollectionValues(type.get$directSubtypes());
3307 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3523 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3308 var subtype = $$list[$$i]; 3524 var subtype = $$list.$index($$i);
3309 visit.call$1(subtype); 3525 visit(subtype);
3310 } 3526 }
3311 types.add$1(type); 3527 types.add$1(type);
3312 } 3528 }
3313 var $$list = this._orderCollectionValues(this.typesWithDynamicDispatch); 3529 var $$list = this._orderCollectionValues(this.typesWithDynamicDispatch);
3314 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3530 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3315 var type = $$list[$$i]; 3531 var type = $$list.$index($$i);
3316 visit.call$1(type); 3532 visit(type);
3317 } 3533 }
3318 var dispatchTypes = types.filter$1((function (type) { 3534 var dispatchTypes = types.filter$1((function (type) {
3319 return !type.get$directSubtypes().isEmpty$0() && $this.typesWithDynamicDispa tch.contains(type); 3535 return !type.get$directSubtypes().isEmpty$0() && $this.typesWithDynamicDispa tch.contains(type);
3320 }) 3536 })
3321 ); 3537 );
3322 this.writer.comment(("// " + types.get$length() + " types")); 3538 this.writer.comment(("// " + types.get$length() + " types"));
3323 this.writer.comment(("// " + types.filter$1((function (t) { 3539 this.writer.comment(("// " + types.filter$1((function (t) {
3324 return !t.get$directSubtypes().isEmpty$0(); 3540 return !t.get$directSubtypes().isEmpty$0();
3325 }) 3541 })
3326 ).get$length() + " !leaf")); 3542 ).get$length() + " !leaf"));
3327 var varNames = []; 3543 var varNames = [];
3328 var varDefns = new HashMapImplementation(); 3544 var varDefns = new HashMapImplementation();
3329 var tagDefns = new HashMapImplementation(); 3545 var tagDefns = new HashMapImplementation();
3330 function makeExpression(type) { 3546 function makeExpression(type) {
3331 var expressions = []; 3547 var expressions = [];
3332 var subtags = [type.get$nativeName()]; 3548 var subtags = [type.get$nativeName()];
3333 function walk(type) { 3549 function walk(type) {
3334 var $$list = $this._orderCollectionValues(type.get$directSubtypes()); 3550 var $$list = $this._orderCollectionValues(type.get$directSubtypes());
3335 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3551 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3336 var subtype = $$list[$$i]; 3552 var subtype = $$list.$index($$i);
3337 var tag = subtype.get$nativeName(); 3553 var tag = subtype.get$nativeName();
3338 var existing = tagDefns.$index(tag); 3554 var existing = tagDefns.$index(tag);
3339 if (existing == null) { 3555 if (existing == null) {
3340 subtags.add$1(tag); 3556 subtags.add$1(tag);
3341 walk.call$1(subtype); 3557 walk(subtype);
3342 } 3558 }
3343 else { 3559 else {
3344 if (varDefns.containsKey$1(existing)) { 3560 if (varDefns.containsKey$1(existing)) {
3345 expressions.add$1(existing); 3561 expressions.add$1(existing);
3346 } 3562 }
3347 else { 3563 else {
3348 var varName = ("v" + varNames.get$length() + "/*" + tag + "*/"); 3564 var varName = ("v" + varNames.get$length() + "/*" + tag + "*/");
3349 varNames.add$1(varName); 3565 varNames.add$1(varName);
3350 varDefns.$setindex(varName, existing); 3566 varDefns.$setindex(varName, existing);
3351 tagDefns.$setindex(tag, varName); 3567 tagDefns.$setindex(tag, varName);
3352 expressions.add$1(varName); 3568 expressions.add$1(varName);
3353 } 3569 }
3354 } 3570 }
3355 } 3571 }
3356 } 3572 }
3357 walk.call$1(type); 3573 walk(type);
3358 var constantPart = ("'" + Strings.join(subtags, "|") + "'"); 3574 var constantPart = ("'" + Strings.join(subtags, "|") + "'");
3359 if ($ne(constantPart, "''")) expressions.add$1(constantPart); 3575 if ($ne(constantPart, "''")) expressions.add$1(constantPart);
3360 var expression; 3576 var expression;
3361 if ($eq(expressions.get$length(), (1))) { 3577 if ($eq(expressions.get$length(), (1))) {
3362 expression = expressions.$index((0)); 3578 expression = expressions.$index((0));
3363 } 3579 }
3364 else { 3580 else {
3365 expression = ("[" + Strings.join(expressions, ",") + "].join('|')"); 3581 expression = ("[" + Strings.join(expressions, ",") + "].join('|')");
3366 } 3582 }
3367 return expression; 3583 return expression;
3368 } 3584 }
3369 for (var $$i = dispatchTypes.iterator$0(); $$i.hasNext$0(); ) { 3585 for (var $$i = dispatchTypes.iterator$0(); $$i.hasNext$0(); ) {
3370 var type = $$i.next$0(); 3586 var type = $$i.next$0();
3371 tagDefns.$setindex(type.get$nativeName(), makeExpression.call$1(type)); 3587 tagDefns.$setindex(type.get$nativeName(), makeExpression(type));
3372 } 3588 }
3373 if (!tagDefns.isEmpty$0()) { 3589 if (!tagDefns.isEmpty$0()) {
3374 this.writer.enterBlock("(function(){"); 3590 this.writer.enterBlock("(function(){");
3375 for (var $$i = varNames.iterator$0(); $$i.hasNext$0(); ) { 3591 for (var $$i = varNames.iterator$0(); $$i.hasNext$0(); ) {
3376 var varName = $$i.next$0(); 3592 var varName = $$i.next$0();
3377 this.writer.writeln(("var " + varName + " = " + varDefns.$index(varName) + ";")); 3593 this.writer.writeln(("var " + varName + " = " + varDefns.$index(varName) + ";"));
3378 } 3594 }
3379 this.writer.enterBlock("var table = ["); 3595 this.writer.enterBlock("var table = [");
3380 this.writer.comment("// [dynamic-dispatch-tag, tags of classes implementing dynamic-dispatch-tag]"); 3596 this.writer.comment("// [dynamic-dispatch-tag, tags of classes implementing dynamic-dispatch-tag]");
3381 for (var $$i = dispatchTypes.iterator$0(); $$i.hasNext$0(); ) { 3597 for (var $$i = dispatchTypes.iterator$0(); $$i.hasNext$0(); ) {
3382 var type = $$i.next$0(); 3598 var type = $$i.next$0();
3383 this.writer.writeln(("['" + type.get$nativeName() + "', " + tagDefns.$inde x(type.get$nativeName()) + "],")); 3599 this.writer.writeln(("['" + type.get$nativeName() + "', " + tagDefns.$inde x(type.get$nativeName()) + "],"));
3384 } 3600 }
3385 this.writer.exitBlock("];"); 3601 this.writer.exitBlock("];");
3386 this.writer.writeln("$dynamicSetMetadata(table);"); 3602 this.writer.writeln("$dynamicSetMetadata(table);");
3387 this.writer.exitBlock("})();"); 3603 this.writer.exitBlock("})();");
3388 } 3604 }
3389 } 3605 }
3390 WorldGenerator.prototype._orderValues = function(map) { 3606 WorldGenerator.prototype._orderValues = function(map) {
3391 var values = map.getValues(); 3607 var values = map.getValues$0();
3392 values.sort(this.get$_compareMembers()); 3608 values.sort(this.get$_compareMembers());
3393 return values; 3609 return values;
3394 } 3610 }
3395 WorldGenerator.prototype._orderCollectionValues = function(collection) { 3611 WorldGenerator.prototype._orderCollectionValues = function(collection) {
3396 var values = ListFactory.ListFactory$from$factory(collection); 3612 var values = ListFactory.ListFactory$from$factory(collection);
3397 values.sort(this.get$_compareMembers()); 3613 values.sort(this.get$_compareMembers());
3398 return values; 3614 return values;
3399 } 3615 }
3400 WorldGenerator.prototype._compareMembers = function(x, y) { 3616 WorldGenerator.prototype._compareMembers = function(x, y) {
3401 if (x.get$span() != null && y.get$span() != null) { 3617 if (x.get$span() != null && y.get$span() != null) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3446 } 3662 }
3447 MethodGenerator.prototype.get$isStatic = function() { 3663 MethodGenerator.prototype.get$isStatic = function() {
3448 return this.method.get$isStatic(); 3664 return this.method.get$isStatic();
3449 } 3665 }
3450 MethodGenerator.prototype.getTemp = function(value) { 3666 MethodGenerator.prototype.getTemp = function(value) {
3451 return value.get$needsTemp() ? this.forceTemp(value) : value; 3667 return value.get$needsTemp() ? this.forceTemp(value) : value;
3452 } 3668 }
3453 MethodGenerator.prototype.forceTemp = function(value) { 3669 MethodGenerator.prototype.forceTemp = function(value) {
3454 var name; 3670 var name;
3455 if (this._freeTemps.get$length() > (0)) { 3671 if (this._freeTemps.get$length() > (0)) {
3456 name = this._freeTemps.removeLast(); 3672 name = this._freeTemps.removeLast$0();
3457 } 3673 }
3458 else { 3674 else {
3459 name = "$" + this._usedTemps.get$length(); 3675 name = "$" + this._usedTemps.get$length();
3460 } 3676 }
3461 this._usedTemps.add(name); 3677 this._usedTemps.add(name);
3462 return new VariableValue(value.get$staticType(), name, value.span, false, valu e); 3678 return new VariableValue(value.get$staticType(), name, value.span, false, valu e);
3463 } 3679 }
3464 MethodGenerator.prototype.assignTemp = function(tmp, v) { 3680 MethodGenerator.prototype.assignTemp = function(tmp, v) {
3465 if ($eq(tmp, v)) { 3681 if ($eq(tmp, v)) {
3466 return v; 3682 return v;
(...skipping 13 matching lines...) Expand all
3480 if (this.method.get$isConstructor()) { 3696 if (this.method.get$isConstructor()) {
3481 thisObject = new ObjectValue(false, this.method.declaringType, this.method.g et$span()); 3697 thisObject = new ObjectValue(false, this.method.declaringType, this.method.g et$span());
3482 thisObject.initFields$0(); 3698 thisObject.initFields$0();
3483 } 3699 }
3484 else { 3700 else {
3485 thisObject = new Value(this.method.declaringType, "this", null); 3701 thisObject = new Value(this.method.declaringType, "this", null);
3486 } 3702 }
3487 var values = []; 3703 var values = [];
3488 var $$list = this.method.get$parameters(); 3704 var $$list = this.method.get$parameters();
3489 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3705 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3490 var p = $$list[$$i]; 3706 var p = $$list.$index($$i);
3491 values.add$1(new Value(p.get$type(), p.get$name(), null)); 3707 values.add$1(new Value(p.get$type(), p.get$name(), null));
3492 } 3708 }
3493 var args = new Arguments(null, values); 3709 var args = new Arguments(null, values);
3494 this.evalBody(thisObject, args); 3710 this.evalBody(thisObject, args);
3495 if (this.method.get$definition().get$nativeBody() != null) { 3711 if (this.method.get$definition().get$nativeBody() != null) {
3496 this.writer = new CodeWriter(); 3712 this.writer = new CodeWriter();
3497 if ($eq(this.method.get$definition().get$nativeBody(), "")) { 3713 if ($eq(this.method.get$definition().get$nativeBody(), "")) {
3498 this.method.generator = null; 3714 this.method.generator = null;
3499 } 3715 }
3500 else { 3716 else {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
3598 } 3814 }
3599 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) { 3815 MethodGenerator.prototype._provideOptionalParamInfo = function(defWriter) {
3600 if ((this.method instanceof MethodMember)) { 3816 if ((this.method instanceof MethodMember)) {
3601 var meth = this.method; 3817 var meth = this.method;
3602 if (meth._provideOptionalParamInfo) { 3818 if (meth._provideOptionalParamInfo) {
3603 var optNames = []; 3819 var optNames = [];
3604 var optValues = []; 3820 var optValues = [];
3605 meth.genParameterValues(); 3821 meth.genParameterValues();
3606 var $$list = meth.parameters; 3822 var $$list = meth.parameters;
3607 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 3823 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3608 var param = $$list[$$i]; 3824 var param = $$list.$index($$i);
3609 if (param.get$isOptional()) { 3825 if (param.get$isOptional()) {
3610 optNames.add$1(param.get$name()); 3826 optNames.add$1(param.get$name());
3611 optValues.add$1(MethodGenerator._escapeString(param.get$value().get$co de())); 3827 optValues.add$1(MethodGenerator._escapeString(param.get$value().get$co de()));
3612 } 3828 }
3613 } 3829 }
3614 if (optNames.get$length() > (0)) { 3830 if (optNames.get$length() > (0)) {
3615 var start = ""; 3831 var start = "";
3616 if (meth.isStatic) { 3832 if (meth.isStatic) {
3617 if (!meth.declaringType.get$isTop()) { 3833 if (!meth.declaringType.get$isTop()) {
3618 start = meth.declaringType.get$jsname() + "."; 3834 start = meth.declaringType.get$jsname() + ".";
(...skipping 20 matching lines...) Expand all
3639 return newObject.setField(field, value, true); 3855 return newObject.setField(field, value, true);
3640 } 3856 }
3641 MethodGenerator.prototype.evalBody = function(newObject, args) { 3857 MethodGenerator.prototype.evalBody = function(newObject, args) {
3642 var fieldsSet = false; 3858 var fieldsSet = false;
3643 if (this.method.get$isNative() && this.method.get$isConstructor() && (newObjec t instanceof ObjectValue)) { 3859 if (this.method.get$isNative() && this.method.get$isConstructor() && (newObjec t instanceof ObjectValue)) {
3644 newObject.get$dynamic().set$seenNativeInitializer(true); 3860 newObject.get$dynamic().set$seenNativeInitializer(true);
3645 } 3861 }
3646 this._paramCode = []; 3862 this._paramCode = [];
3647 for (var i = (0); 3863 for (var i = (0);
3648 i < this.method.get$parameters().get$length(); i++) { 3864 i < this.method.get$parameters().get$length(); i++) {
3649 var p = this.method.get$parameters()[i]; 3865 var p = this.method.get$parameters().$index(i);
3650 var currentArg = null; 3866 var currentArg = null;
3651 if (i < args.get$bareCount()) { 3867 if (i < args.get$bareCount()) {
3652 currentArg = args.values[i]; 3868 currentArg = args.values.$index(i);
3653 } 3869 }
3654 else { 3870 else {
3655 currentArg = args.getValue(p.get$name()); 3871 currentArg = args.getValue(p.get$name());
3656 if (currentArg == null) { 3872 if (currentArg == null) {
3657 p.genValue$2(this.method, this.method.generator); 3873 p.genValue$2(this.method, this.method.generator);
3658 currentArg = p.get$value(); 3874 currentArg = p.get$value();
3659 } 3875 }
3660 } 3876 }
3661 if (p.get$isInitializer()) { 3877 if (p.get$isInitializer()) {
3662 this._paramCode.add(p.get$name()); 3878 this._paramCode.add(p.get$name());
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3785 var value = m.invoke$4(this, node, target, newArgs); 4001 var value = m.invoke$4(this, node, target, newArgs);
3786 if ($ne(target.get$type(), $globals.world.objectType)) { 4002 if ($ne(target.get$type(), $globals.world.objectType)) {
3787 this.writer.writeln(("" + value.get$code() + ";")); 4003 this.writer.writeln(("" + value.get$code() + ";"));
3788 } 4004 }
3789 } 4005 }
3790 } 4006 }
3791 MethodGenerator.prototype._makeArgs = function(arguments) { 4007 MethodGenerator.prototype._makeArgs = function(arguments) {
3792 var args = []; 4008 var args = [];
3793 var seenLabel = false; 4009 var seenLabel = false;
3794 for (var $$i = 0;$$i < arguments.get$length(); $$i++) { 4010 for (var $$i = 0;$$i < arguments.get$length(); $$i++) {
3795 var arg = arguments[$$i]; 4011 var arg = arguments.$index($$i);
3796 if (arg.get$label() != null) { 4012 if (arg.get$label() != null) {
3797 seenLabel = true; 4013 seenLabel = true;
3798 } 4014 }
3799 else if (seenLabel) { 4015 else if (seenLabel) {
3800 $globals.world.error("bare argument can not follow named arguments", arg.g et$span()); 4016 $globals.world.error("bare argument can not follow named arguments", arg.g et$span());
3801 } 4017 }
3802 args.add$1(this.visitValue(arg.get$value())); 4018 args.add$1(this.visitValue(arg.get$value()));
3803 } 4019 }
3804 return new Arguments(arguments, args); 4020 return new Arguments(arguments, args);
3805 } 4021 }
3806 MethodGenerator.prototype._invokeNative = function(name, arguments) { 4022 MethodGenerator.prototype._invokeNative = function(name, arguments) {
3807 var args = Arguments.get$EMPTY(); 4023 var args = Arguments.get$EMPTY();
3808 if (arguments.get$length() > (0)) { 4024 if (arguments.get$length() > (0)) {
3809 args = new Arguments(null, arguments); 4025 args = new Arguments(null, arguments);
3810 } 4026 }
3811 var method = $globals.world.corelib.topType.members.$index(name); 4027 var method = $globals.world.corelib.topType.members.$index(name);
3812 return method.invoke$4(this, method.get$definition(), new Value($globals.world .corelib.topType, null, null), args); 4028 return method.invoke$4(this, method.get$definition(), new Value($globals.world .corelib.topType, null, null), args);
3813 } 4029 }
3814 MethodGenerator._escapeString = function(text) { 4030 MethodGenerator._escapeString = function(text) {
3815 return text.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n").replaceAll("\r", "\\r"); 4031 return text.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n").replaceAll("\r", "\\r");
3816 } 4032 }
3817 MethodGenerator.prototype.visitStatementsInBlock = function(body) { 4033 MethodGenerator.prototype.visitStatementsInBlock = function(body) {
3818 if ((body instanceof BlockStatement)) { 4034 if ((body instanceof BlockStatement)) {
3819 var block = body; 4035 var block = body;
3820 var $$list = block.body; 4036 var $$list = block.body;
3821 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 4037 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
3822 var stmt = $$list[$$i]; 4038 var stmt = $$list.$index($$i);
3823 stmt.visit$1(this); 4039 stmt.visit$1(this);
3824 } 4040 }
3825 } 4041 }
3826 else { 4042 else {
3827 if (body != null) body.visit(this); 4043 if (body != null) body.visit(this);
3828 } 4044 }
3829 return false; 4045 return false;
3830 } 4046 }
3831 MethodGenerator.prototype._pushBlock = function(node, reentrant) { 4047 MethodGenerator.prototype._pushBlock = function(node, reentrant) {
3832 this._scope = new BlockScope(this, this._scope, node, reentrant); 4048 this._scope = new BlockScope(this, this._scope, node, reentrant);
3833 } 4049 }
3834 MethodGenerator.prototype._popBlock = function(node) { 4050 MethodGenerator.prototype._popBlock = function(node) {
3835 if (this._scope.node != node) { 4051 if (this._scope.node != node) {
3836 function spanOf(n) { 4052 function spanOf(n) {
3837 return n != null ? n.get$span() : null; 4053 return n != null ? n.get$span() : null;
3838 } 4054 }
3839 $globals.world.internalError(("scope mismatch. Trying to pop \"" + node + "\ " but found ") + (" \"" + this._scope.node + "\""), spanOf.call$1(node), spanOf. call$1(this._scope.node)); 4055 $globals.world.internalError(("scope mismatch. Trying to pop \"" + node + "\ " but found ") + (" \"" + this._scope.node + "\""), spanOf(node), spanOf(this._s cope.node));
3840 } 4056 }
3841 this._scope = this._scope.parent; 4057 this._scope = this._scope.parent;
3842 } 4058 }
3843 MethodGenerator.prototype._visitLoop = function(node, visitBody) { 4059 MethodGenerator.prototype._visitLoop = function(node, visitBody) {
3844 if (this._scope.inferTypes) { 4060 if (this._scope.inferTypes) {
3845 this._loopFixedPoint(node, visitBody); 4061 this._loopFixedPoint(node, visitBody);
3846 } 4062 }
3847 else { 4063 else {
3848 this._pushBlock(node, true); 4064 this._pushBlock(node, true);
3849 visitBody.call$0(); 4065 visitBody.call$0();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 } 4124 }
3909 return this.visitValue(node); 4125 return this.visitValue(node);
3910 } 4126 }
3911 MethodGenerator.prototype.visitDietStatement = function(node) { 4127 MethodGenerator.prototype.visitDietStatement = function(node) {
3912 var parser = new Parser(node.span.file, false, false, false, node.span.start); 4128 var parser = new Parser(node.span.file, false, false, false, node.span.start);
3913 this.visitStatementsInBlock(parser.block$0()); 4129 this.visitStatementsInBlock(parser.block$0());
3914 return false; 4130 return false;
3915 } 4131 }
3916 MethodGenerator.prototype.visitVariableDefinition = function(node) { 4132 MethodGenerator.prototype.visitVariableDefinition = function(node) {
3917 var isFinal = false; 4133 var isFinal = false;
3918 if (node.modifiers != null && $eq(node.modifiers[(0)].get$kind(), (99))) { 4134 if (node.modifiers != null && $eq(node.modifiers.$index((0)).get$kind(), (99)) ) {
3919 isFinal = true; 4135 isFinal = true;
3920 } 4136 }
3921 this.writer.write("var "); 4137 this.writer.write("var ");
3922 var type = this.method.resolveType$2(node.type, false); 4138 var type = this.method.resolveType$2(node.type, false);
3923 for (var i = (0); 4139 for (var i = (0);
3924 i < node.names.get$length(); i++) { 4140 i < node.names.get$length(); i++) {
3925 if (i > (0)) { 4141 if (i > (0)) {
3926 this.writer.write(", "); 4142 this.writer.write(", ");
3927 } 4143 }
3928 var name = node.names[i].get$name(); 4144 var name = node.names.$index(i).get$name();
3929 var value = this.visitValue(node.values[i]); 4145 var value = this.visitValue(node.values.$index(i));
3930 if (isFinal && value == null) { 4146 if (isFinal && value == null) {
3931 $globals.world.error("no value specified for final variable", node.span); 4147 $globals.world.error("no value specified for final variable", node.span);
3932 } 4148 }
3933 var val = this._scope.create(name, type, node.names[i].get$span(), isFinal, false); 4149 var val = this._scope.create(name, type, node.names.$index(i).get$span(), is Final, false);
3934 if (value == null) { 4150 if (value == null) {
3935 if (this._scope.reentrant) { 4151 if (this._scope.reentrant) {
3936 this.writer.write(("" + val.get$code() + " = null")); 4152 this.writer.write(("" + val.get$code() + " = null"));
3937 } 4153 }
3938 else { 4154 else {
3939 this.writer.write(("" + val.get$code())); 4155 this.writer.write(("" + val.get$code()));
3940 } 4156 }
3941 } 4157 }
3942 else { 4158 else {
3943 value = value.convertTo$2(this, type); 4159 value = value.convertTo$2(this, type);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
4065 if (node.test != null) { 4281 if (node.test != null) {
4066 var test = $this.visitBool(node.test); 4282 var test = $this.visitBool(node.test);
4067 $this.writer.write((" " + test.get$code() + "; ")); 4283 $this.writer.write((" " + test.get$code() + "; "));
4068 } 4284 }
4069 else { 4285 else {
4070 $this.writer.write("; "); 4286 $this.writer.write("; ");
4071 } 4287 }
4072 var needsComma = false; 4288 var needsComma = false;
4073 var $$list = node.step; 4289 var $$list = node.step;
4074 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 4290 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
4075 var s = $$list[$$i]; 4291 var s = $$list.$index($$i);
4076 if (needsComma) $this.writer.write(", "); 4292 if (needsComma) $this.writer.write(", ");
4077 var sv = $this.visitVoid(s); 4293 var sv = $this.visitVoid(s);
4078 $this.writer.write(sv.get$code()); 4294 $this.writer.write(sv.get$code());
4079 needsComma = true; 4295 needsComma = true;
4080 } 4296 }
4081 $this.writer.write(") "); 4297 $this.writer.write(") ");
4082 $this._pushBlock(node.body, false); 4298 $this._pushBlock(node.body, false);
4083 node.body.visit($this); 4299 node.body.visit($this);
4084 $this._popBlock(node.body); 4300 $this._popBlock(node.body);
4085 }) 4301 })
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4137 MethodGenerator.prototype._genStackTraceOf = function(trace, ex) { 4353 MethodGenerator.prototype._genStackTraceOf = function(trace, ex) {
4138 var result = this._invokeNative("_stackTraceOf", [ex]); 4354 var result = this._invokeNative("_stackTraceOf", [ex]);
4139 this.writer.writeln(("var " + trace.get$code() + " = " + result.get$code() + " ;")); 4355 this.writer.writeln(("var " + trace.get$code() + " = " + result.get$code() + " ;"));
4140 } 4356 }
4141 MethodGenerator.prototype.visitTryStatement = function(node) { 4357 MethodGenerator.prototype.visitTryStatement = function(node) {
4142 this.writer.enterBlock("try {"); 4358 this.writer.enterBlock("try {");
4143 this._pushBlock(node.body, false); 4359 this._pushBlock(node.body, false);
4144 this.visitStatementsInBlock(node.body); 4360 this.visitStatementsInBlock(node.body);
4145 this._popBlock(node.body); 4361 this._popBlock(node.body);
4146 if (node.catches.get$length() == (1)) { 4362 if (node.catches.get$length() == (1)) {
4147 var catch_ = node.catches[(0)]; 4363 var catch_ = node.catches.$index((0));
4148 this._pushBlock(catch_, false); 4364 this._pushBlock(catch_, false);
4149 var exType = this.method.resolveType$2(catch_.get$exception().get$type(), fa lse); 4365 var exType = this.method.resolveType$2(catch_.get$exception().get$type(), fa lse);
4150 var ex = this._scope.declare(catch_.get$exception()); 4366 var ex = this._scope.declare(catch_.get$exception());
4151 this._scope.rethrow = ex.get$code(); 4367 this._scope.rethrow = ex.get$code();
4152 this.writer.nextBlock(("} catch (" + ex.get$code() + ") {")); 4368 this.writer.nextBlock(("} catch (" + ex.get$code() + ") {"));
4153 if (catch_.get$trace() != null) { 4369 if (catch_.get$trace() != null) {
4154 var trace = this._scope.declare(catch_.get$trace()); 4370 var trace = this._scope.declare(catch_.get$trace());
4155 this._genStackTraceOf(trace, ex); 4371 this._genStackTraceOf(trace, ex);
4156 } 4372 }
4157 this._genToDartException(ex); 4373 this._genToDartException(ex);
4158 if (!exType.get$isVarOrObject()) { 4374 if (!exType.get$isVarOrObject()) {
4159 var test = ex.instanceOf$3$isTrue$forceCheck(this, exType, catch_.get$exce ption().get$span(), false, true); 4375 var test = ex.instanceOf$3$isTrue$forceCheck(this, exType, catch_.get$exce ption().get$span(), false, true);
4160 this.writer.writeln(("if (" + test.get$code() + ") throw " + ex.get$code() + ";")); 4376 this.writer.writeln(("if (" + test.get$code() + ") throw " + ex.get$code() + ";"));
4161 } 4377 }
4162 this.visitStatementsInBlock(node.catches[(0)].get$body()); 4378 this.visitStatementsInBlock(node.catches.$index((0)).get$body());
4163 this._popBlock(catch_); 4379 this._popBlock(catch_);
4164 } 4380 }
4165 else if (node.catches.get$length() > (0)) { 4381 else if (node.catches.get$length() > (0)) {
4166 this._pushBlock(node, false); 4382 this._pushBlock(node, false);
4167 var ex = this._scope.create("$ex", $globals.world.varType, null, false, fals e); 4383 var ex = this._scope.create("$ex", $globals.world.varType, null, false, fals e);
4168 this._scope.rethrow = ex.get$code(); 4384 this._scope.rethrow = ex.get$code();
4169 this.writer.nextBlock(("} catch (" + ex.get$code() + ") {")); 4385 this.writer.nextBlock(("} catch (" + ex.get$code() + ") {"));
4170 var trace = null; 4386 var trace = null;
4171 if (node.catches.some((function (c) { 4387 if (node.catches.some((function (c) {
4172 return c.get$trace() != null; 4388 return c.get$trace() != null;
4173 }) 4389 })
4174 )) { 4390 )) {
4175 trace = this._scope.create("$trace", $globals.world.varType, null, false, false); 4391 trace = this._scope.create("$trace", $globals.world.varType, null, false, false);
4176 this._genStackTraceOf(trace, ex); 4392 this._genStackTraceOf(trace, ex);
4177 } 4393 }
4178 this._genToDartException(ex); 4394 this._genToDartException(ex);
4179 var needsRethrow = true; 4395 var needsRethrow = true;
4180 for (var i = (0); 4396 for (var i = (0);
4181 i < node.catches.get$length(); i++) { 4397 i < node.catches.get$length(); i++) {
4182 var catch_ = node.catches[i]; 4398 var catch_ = node.catches.$index(i);
4183 this._pushBlock(catch_, false); 4399 this._pushBlock(catch_, false);
4184 var tmpType = this.method.resolveType$2(catch_.get$exception().get$type(), false); 4400 var tmpType = this.method.resolveType$2(catch_.get$exception().get$type(), false);
4185 var tmp = this._scope.declare(catch_.get$exception()); 4401 var tmp = this._scope.declare(catch_.get$exception());
4186 if (!tmpType.get$isVarOrObject()) { 4402 if (!tmpType.get$isVarOrObject()) {
4187 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmpType, catch_.get$e xception().get$span(), true, true); 4403 var test = ex.instanceOf$3$isTrue$forceCheck(this, tmpType, catch_.get$e xception().get$span(), true, true);
4188 if (i == (0)) { 4404 if (i == (0)) {
4189 this.writer.enterBlock(("if (" + test.get$code() + ") {")); 4405 this.writer.enterBlock(("if (" + test.get$code() + ") {"));
4190 } 4406 }
4191 else { 4407 else {
4192 this.writer.nextBlock(("} else if (" + test.get$code() + ") {")); 4408 this.writer.nextBlock(("} else if (" + test.get$code() + ") {"));
4193 } 4409 }
4194 } 4410 }
4195 else if (i > (0)) { 4411 else if (i > (0)) {
4196 this.writer.nextBlock("} else {"); 4412 this.writer.nextBlock("} else {");
4197 } 4413 }
4198 this.writer.writeln(("var " + tmp.get$code() + " = " + ex.get$code() + ";" )); 4414 this.writer.writeln(("var " + tmp.get$code() + " = " + ex.get$code() + ";" ));
4199 if (catch_.get$trace() != null) { 4415 if (catch_.get$trace() != null) {
4200 var tmptrace = this._scope.declare(catch_.get$trace()); 4416 var tmptrace = this._scope.declare(catch_.get$trace());
4201 this.writer.writeln(("var " + tmptrace.get$code() + " = " + trace.get$co de() + ";")); 4417 this.writer.writeln(("var " + tmptrace.get$code() + " = " + trace.get$co de() + ";"));
4202 } 4418 }
4203 this.visitStatementsInBlock(catch_.get$body()); 4419 this.visitStatementsInBlock(catch_.get$body());
4204 this._popBlock(catch_); 4420 this._popBlock(catch_);
4205 if (tmpType.get$isVarOrObject()) { 4421 if (tmpType.get$isVarOrObject()) {
4206 if (i + (1) < node.catches.get$length()) { 4422 if (i + (1) < node.catches.get$length()) {
4207 $globals.world.error("Unreachable catch clause", node.catches[i + (1)] .get$span()); 4423 $globals.world.error("Unreachable catch clause", node.catches.$index(i + (1)).get$span());
4208 } 4424 }
4209 if (i > (0)) { 4425 if (i > (0)) {
4210 this.writer.exitBlock("}"); 4426 this.writer.exitBlock("}");
4211 } 4427 }
4212 needsRethrow = false; 4428 needsRethrow = false;
4213 break; 4429 break;
4214 } 4430 }
4215 } 4431 }
4216 if (needsRethrow) { 4432 if (needsRethrow) {
4217 this.writer.nextBlock("} else {"); 4433 this.writer.nextBlock("} else {");
4218 this.writer.writeln(("throw " + ex.get$code() + ";")); 4434 this.writer.writeln(("throw " + ex.get$code() + ";"));
4219 this.writer.exitBlock("}"); 4435 this.writer.exitBlock("}");
4220 } 4436 }
4221 this._popBlock(node); 4437 this._popBlock(node);
4222 } 4438 }
4223 if (node.finallyBlock != null) { 4439 if (node.finallyBlock != null) {
4224 this.writer.nextBlock("} finally {"); 4440 this.writer.nextBlock("} finally {");
4225 this._pushBlock(node.finallyBlock, false); 4441 this._pushBlock(node.finallyBlock, false);
4226 this.visitStatementsInBlock(node.finallyBlock); 4442 this.visitStatementsInBlock(node.finallyBlock);
4227 this._popBlock(node.finallyBlock); 4443 this._popBlock(node.finallyBlock);
4228 } 4444 }
4229 this.writer.exitBlock("}"); 4445 this.writer.exitBlock("}");
4230 return false; 4446 return false;
4231 } 4447 }
4232 MethodGenerator.prototype.visitSwitchStatement = function(node) { 4448 MethodGenerator.prototype.visitSwitchStatement = function(node) {
4233 var test = this.visitValue(node.test); 4449 var test = this.visitValue(node.test);
4234 this.writer.enterBlock(("switch (" + test.get$code() + ") {")); 4450 this.writer.enterBlock(("switch (" + test.get$code() + ") {"));
4235 var $$list = node.cases; 4451 var $$list = node.cases;
4236 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 4452 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
4237 var case_ = $$list[$$i]; 4453 var case_ = $$list.$index($$i);
4238 if (case_.get$label() != null) { 4454 if (case_.get$label() != null) {
4239 $globals.world.error("unimplemented: labeled case statement", case_.get$sp an()); 4455 $globals.world.error("unimplemented: labeled case statement", case_.get$sp an());
4240 } 4456 }
4241 this._pushBlock(case_, false); 4457 this._pushBlock(case_, false);
4242 for (var i = (0); 4458 for (var i = (0);
4243 i < case_.get$cases().get$length(); i++) { 4459 i < case_.get$cases().get$length(); i++) {
4244 var expr = case_.get$cases().$index(i); 4460 var expr = case_.get$cases().$index(i);
4245 if (expr == null) { 4461 if (expr == null) {
4246 if (i < case_.get$cases().get$length() - (1)) { 4462 if (i < case_.get$cases().get$length() - (1)) {
4247 $globals.world.error("default clause must be the last case", case_.get $span()); 4463 $globals.world.error("default clause must be the last case", case_.get $span());
4248 } 4464 }
4249 this.writer.writeln("default:"); 4465 this.writer.writeln("default:");
4250 } 4466 }
4251 else { 4467 else {
4252 var value = this.visitValue(expr); 4468 var value = this.visitValue(expr);
4253 this.writer.writeln(("case " + value.get$code() + ":")); 4469 this.writer.writeln(("case " + value.get$code() + ":"));
4254 } 4470 }
4255 } 4471 }
4256 this.writer.enterBlock(""); 4472 this.writer.enterBlock("");
4257 var caseExits = this._visitAllStatements(case_.get$statements(), false); 4473 var caseExits = this._visitAllStatements(case_.get$statements(), false);
4258 if ($ne(case_, node.cases[node.cases.get$length() - (1)]) && !caseExits) { 4474 if ($ne(case_, node.cases.$index(node.cases.get$length() - (1))) && !caseExi ts) {
4259 var span = case_.get$statements().$index(case_.get$statements().get$length () - (1)).get$span(); 4475 var span = case_.get$statements().$index(case_.get$statements().get$length () - (1)).get$span();
4260 this.writer.writeln("$throw(new FallThroughError());"); 4476 this.writer.writeln("$throw(new FallThroughError());");
4261 $globals.world.gen.corejs.useThrow = true; 4477 $globals.world.gen.corejs.useThrow = true;
4262 } 4478 }
4263 this.writer.exitBlock(""); 4479 this.writer.exitBlock("");
4264 this._popBlock(case_); 4480 this._popBlock(case_);
4265 } 4481 }
4266 this.writer.exitBlock("}"); 4482 this.writer.exitBlock("}");
4267 return false; 4483 return false;
4268 } 4484 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
4542 } 4758 }
4543 $globals.world.error(("no matching constructor for " + name), node.span); 4759 $globals.world.error(("no matching constructor for " + name), node.span);
4544 return this._makeMissingValue(name); 4760 return this._makeMissingValue(name);
4545 } 4761 }
4546 if (node.isConst) { 4762 if (node.isConst) {
4547 if (!m.get$isConst()) { 4763 if (!m.get$isConst()) {
4548 $globals.world.error("can't use const on a non-const constructor", node.sp an); 4764 $globals.world.error("can't use const on a non-const constructor", node.sp an);
4549 } 4765 }
4550 var $$list = node.arguments; 4766 var $$list = node.arguments;
4551 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 4767 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
4552 var arg = $$list[$$i]; 4768 var arg = $$list.$index($$i);
4553 if (!this.visitValue(arg.get$value()).get$isConst()) { 4769 if (!this.visitValue(arg.get$value()).get$isConst()) {
4554 $globals.world.error("const constructor expects const arguments", arg.ge t$span()); 4770 $globals.world.error("const constructor expects const arguments", arg.ge t$span());
4555 } 4771 }
4556 } 4772 }
4557 } 4773 }
4558 var target = new TypeValue(type, typeRef.get$span()); 4774 var target = new TypeValue(type, typeRef.get$span());
4559 return m.invoke$4(this, node, target, this._makeArgs(node.arguments)); 4775 return m.invoke$4(this, node, target, this._makeArgs(node.arguments));
4560 } 4776 }
4561 MethodGenerator.prototype.visitListExpression = function(node) { 4777 MethodGenerator.prototype.visitListExpression = function(node) {
4562 var argValues = []; 4778 var argValues = [];
4563 var listType = $globals.world.listType; 4779 var listType = $globals.world.listType;
4564 var type = $globals.world.varType; 4780 var type = $globals.world.varType;
4565 if (node.itemType != null) { 4781 if (node.itemType != null) {
4566 type = this.method.resolveType$2(node.itemType, true); 4782 type = this.method.resolveType$2(node.itemType, true);
4567 if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypePara ms())) { 4783 if (node.isConst && ((type instanceof ParameterType) || type.get$hasTypePara ms())) {
4568 $globals.world.error("type parameter cannot be used in const list literals "); 4784 $globals.world.error("type parameter cannot be used in const list literals ");
4569 } 4785 }
4570 listType = listType.getOrMakeConcreteType$1([type]); 4786 listType = listType.getOrMakeConcreteType$1([type]);
4571 } 4787 }
4572 var $$list = node.values; 4788 var $$list = node.values;
4573 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 4789 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
4574 var item = $$list[$$i]; 4790 var item = $$list.$index($$i);
4575 var arg = this.visitTypedValue(item, type); 4791 var arg = this.visitTypedValue(item, type);
4576 argValues.add$1(arg); 4792 argValues.add$1(arg);
4577 if (node.isConst && !arg.get$isConst()) { 4793 if (node.isConst && !arg.get$isConst()) {
4578 $globals.world.error("const list can only contain const values", arg.get$s pan()); 4794 $globals.world.error("const list can only contain const values", arg.get$s pan());
4579 } 4795 }
4580 } 4796 }
4581 $globals.world.listFactoryType.markUsed(); 4797 $globals.world.listFactoryType.markUsed();
4582 var ret = new ListValue(argValues, node.isConst, listType, node.span); 4798 var ret = new ListValue(argValues, node.isConst, listType, node.span);
4583 if (ret.get$isConst()) return ret.getGlobalValue$0(); 4799 if (ret.get$isConst()) return ret.getGlobalValue$0();
4584 return ret; 4800 return ret;
(...skipping 16 matching lines...) Expand all
4601 } 4817 }
4602 } 4818 }
4603 valueType = this.method.resolveType$2(node.valueType, true); 4819 valueType = this.method.resolveType$2(node.valueType, true);
4604 if (node.isConst && ((valueType instanceof ParameterType) || valueType.get$h asTypeParams())) { 4820 if (node.isConst && ((valueType instanceof ParameterType) || valueType.get$h asTypeParams())) {
4605 $globals.world.error("type parameter cannot be used in const map literals" ); 4821 $globals.world.error("type parameter cannot be used in const map literals" );
4606 } 4822 }
4607 mapType = mapType.getOrMakeConcreteType$1([keyType, valueType]); 4823 mapType = mapType.getOrMakeConcreteType$1([keyType, valueType]);
4608 } 4824 }
4609 for (var i = (0); 4825 for (var i = (0);
4610 i < node.items.get$length(); i += (2)) { 4826 i < node.items.get$length(); i += (2)) {
4611 var key = this.visitTypedValue(node.items[i], keyType); 4827 var key = this.visitTypedValue(node.items.$index(i), keyType);
4612 if (node.isConst && !key.get$isConst()) { 4828 if (node.isConst && !key.get$isConst()) {
4613 $globals.world.error("const map can only contain const keys", key.get$span ()); 4829 $globals.world.error("const map can only contain const keys", key.get$span ());
4614 } 4830 }
4615 values.add$1(key); 4831 values.add$1(key);
4616 var value = this.visitTypedValue(node.items[i + (1)], valueType); 4832 var value = this.visitTypedValue(node.items.$index(i + (1)), valueType);
4617 if (node.isConst && !value.get$isConst()) { 4833 if (node.isConst && !value.get$isConst()) {
4618 $globals.world.error("const map can only contain const values", value.get$ span()); 4834 $globals.world.error("const map can only contain const values", value.get$ span());
4619 } 4835 }
4620 values.add$1(value); 4836 values.add$1(value);
4621 } 4837 }
4622 var ret = new MapValue(values, node.isConst, mapType, node.span); 4838 var ret = new MapValue(values, node.isConst, mapType, node.span);
4623 if (ret.get$isConst()) return ret.getGlobalValue$0(); 4839 if (ret.get$isConst()) return ret.getGlobalValue$0();
4624 return ret; 4840 return ret;
4625 } 4841 }
4626 MethodGenerator.prototype.visitConditionalExpression = function(node) { 4842 MethodGenerator.prototype.visitConditionalExpression = function(node) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4670 return u.op.kind == (16) || u.op.kind == (17); 4886 return u.op.kind == (16) || u.op.kind == (17);
4671 } 4887 }
4672 else { 4888 else {
4673 return false; 4889 return false;
4674 } 4890 }
4675 } 4891 }
4676 MethodGenerator.prototype.visitStringInterpExpression = function(node) { 4892 MethodGenerator.prototype.visitStringInterpExpression = function(node) {
4677 var items = []; 4893 var items = [];
4678 var $$list = node.pieces; 4894 var $$list = node.pieces;
4679 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 4895 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
4680 var item = $$list[$$i]; 4896 var item = $$list.$index($$i);
4681 var val = this.visitValue(item); 4897 var val = this.visitValue(item);
4682 val.invoke$4(this, "toString", item, Arguments.get$EMPTY()); 4898 val.invoke$4(this, "toString", item, Arguments.get$EMPTY());
4683 var code = val.get$code(); 4899 var code = val.get$code();
4684 if (this._expressionNeedsParens(item)) { 4900 if (this._expressionNeedsParens(item)) {
4685 code = ("(" + code + ")"); 4901 code = ("(" + code + ")");
4686 } 4902 }
4687 if ($eq(items.get$length(), (0)) || ($ne(code, "''") && $ne(code, "\"\""))) { 4903 if ($eq(items.get$length(), (0)) || ($ne(code, "''") && $ne(code, "\"\""))) {
4688 items.add$1(code); 4904 items.add$1(code);
4689 } 4905 }
4690 } 4906 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 Arguments.prototype.get$nameCount = function() { 4966 Arguments.prototype.get$nameCount = function() {
4751 return this.get$length() - this.get$bareCount(); 4967 return this.get$length() - this.get$bareCount();
4752 } 4968 }
4753 Arguments.prototype.get$hasNames = function() { 4969 Arguments.prototype.get$hasNames = function() {
4754 return this.get$bareCount() < this.get$length(); 4970 return this.get$bareCount() < this.get$length();
4755 } 4971 }
4756 Arguments.prototype.get$length = function() { 4972 Arguments.prototype.get$length = function() {
4757 return this.values.get$length(); 4973 return this.values.get$length();
4758 } 4974 }
4759 Arguments.prototype.getName = function(i) { 4975 Arguments.prototype.getName = function(i) {
4760 return this.nodes[i].get$label().get$name(); 4976 return this.nodes.$index(i).get$label().get$name();
4761 } 4977 }
4762 Arguments.prototype.getIndexOfName = function(name) { 4978 Arguments.prototype.getIndexOfName = function(name) {
4763 for (var i = this.get$bareCount(); 4979 for (var i = this.get$bareCount();
4764 i < this.get$length(); i++) { 4980 i < this.get$length(); i++) {
4765 if (this.getName(i) == name) { 4981 if (this.getName(i) == name) {
4766 return i; 4982 return i;
4767 } 4983 }
4768 } 4984 }
4769 return (-1); 4985 return (-1);
4770 } 4986 }
4771 Arguments.prototype.getValue = function(name) { 4987 Arguments.prototype.getValue = function(name) {
4772 var i = this.getIndexOfName(name); 4988 var i = this.getIndexOfName(name);
4773 return i >= (0) ? this.values[i] : null; 4989 return i >= (0) ? this.values.$index(i) : null;
4774 } 4990 }
4775 Arguments.prototype.get$bareCount = function() { 4991 Arguments.prototype.get$bareCount = function() {
4776 if (this._bareCount == null) { 4992 if (this._bareCount == null) {
4777 this._bareCount = this.get$length(); 4993 this._bareCount = this.get$length();
4778 if (this.nodes != null) { 4994 if (this.nodes != null) {
4779 for (var i = (0); 4995 for (var i = (0);
4780 i < this.nodes.get$length(); i++) { 4996 i < this.nodes.get$length(); i++) {
4781 if (this.nodes[i].get$label() != null) { 4997 if (this.nodes.$index(i).get$label() != null) {
4782 this._bareCount = i; 4998 this._bareCount = i;
4783 break; 4999 break;
4784 } 5000 }
4785 } 5001 }
4786 } 5002 }
4787 } 5003 }
4788 return this._bareCount; 5004 return this._bareCount;
4789 } 5005 }
4790 Arguments.prototype.getCode = function() { 5006 Arguments.prototype.getCode = function() {
4791 var argsCode = []; 5007 var argsCode = [];
4792 for (var i = (0); 5008 for (var i = (0);
4793 i < this.get$length(); i++) { 5009 i < this.get$length(); i++) {
4794 argsCode.add$1(this.values[i].get$code()); 5010 argsCode.add$1(this.values.$index(i).get$code());
4795 } 5011 }
4796 Arguments.removeTrailingNulls(argsCode); 5012 Arguments.removeTrailingNulls(argsCode);
4797 return Strings.join(argsCode, ", "); 5013 return Strings.join(argsCode, ", ");
4798 } 5014 }
4799 Arguments.removeTrailingNulls = function(argsCode) { 5015 Arguments.removeTrailingNulls = function(argsCode) {
4800 while (argsCode.get$length() > (0) && $eq(argsCode.last(), "null")) { 5016 while (argsCode.get$length() > (0) && $eq(argsCode.last$0(), "null")) {
4801 argsCode.removeLast(); 5017 argsCode.removeLast$0();
4802 } 5018 }
4803 } 5019 }
4804 Arguments.prototype.getNames = function() { 5020 Arguments.prototype.getNames = function() {
4805 var names = []; 5021 var names = [];
4806 for (var i = this.get$bareCount(); 5022 for (var i = this.get$bareCount();
4807 i < this.get$length(); i++) { 5023 i < this.get$length(); i++) {
4808 names.add$1(this.getName(i)); 5024 names.add$1(this.getName(i));
4809 } 5025 }
4810 return names; 5026 return names;
4811 } 5027 }
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
5096 Library.prototype._addMember = function(member) { 5312 Library.prototype._addMember = function(member) {
5097 if (member.get$isPrivate()) { 5313 if (member.get$isPrivate()) {
5098 if (member.get$isStatic()) { 5314 if (member.get$isStatic()) {
5099 if (member.declaringType.get$isTop()) { 5315 if (member.declaringType.get$isTop()) {
5100 $globals.world._addTopName(member); 5316 $globals.world._addTopName(member);
5101 } 5317 }
5102 return; 5318 return;
5103 } 5319 }
5104 var mset = this._privateMembers.$index(member.name); 5320 var mset = this._privateMembers.$index(member.name);
5105 if (mset == null) { 5321 if (mset == null) {
5106 var $$list = $globals.world.libraries.getValues(); 5322 var $$list = $globals.world.libraries.getValues$0();
5107 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 5323 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
5108 var lib = $$i.next$0(); 5324 var lib = $$i.next$0();
5109 if (lib.get$_privateMembers().containsKey$1(member.get$jsname())) { 5325 if (lib.get$_privateMembers().containsKey$1(member.get$jsname())) {
5110 member._jsname = ("_" + this.get$jsname() + member.get$jsname()); 5326 member._jsname = ("_" + this.get$jsname() + member.get$jsname());
5111 break; 5327 break;
5112 } 5328 }
5113 } 5329 }
5114 mset = new MemberSet(member, true); 5330 mset = new MemberSet(member, true);
5115 this._privateMembers.$setindex(member.name, mset); 5331 this._privateMembers.$setindex(member.name, mset);
5116 } 5332 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5150 Library.prototype.findType = function(type) { 5366 Library.prototype.findType = function(type) {
5151 var result = this.findTypeByName(type.name.name); 5367 var result = this.findTypeByName(type.name.name);
5152 if (result == null) return null; 5368 if (result == null) return null;
5153 if (type.names != null) { 5369 if (type.names != null) {
5154 if (type.names.get$length() > (1)) { 5370 if (type.names.get$length() > (1)) {
5155 return null; 5371 return null;
5156 } 5372 }
5157 if (!result.get$isTop()) { 5373 if (!result.get$isTop()) {
5158 return null; 5374 return null;
5159 } 5375 }
5160 return result.get$library().findTypeByName(type.names[(0)].get$name()); 5376 return result.get$library().findTypeByName(type.names.$index((0)).get$name() );
5161 } 5377 }
5162 return result; 5378 return result;
5163 } 5379 }
5164 Library.prototype.findTypeByName = function(name) { 5380 Library.prototype.findTypeByName = function(name) {
5165 var ret = this.types.$index(name); 5381 var ret = this.types.$index(name);
5166 var $$list = this.imports; 5382 var $$list = this.imports;
5167 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 5383 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
5168 var imported = $$list[$$i]; 5384 var imported = $$list.$index($$i);
5169 var newRet = null; 5385 var newRet = null;
5170 if (imported.get$prefix() == null) { 5386 if (imported.get$prefix() == null) {
5171 newRet = imported.get$library().get$types().$index(name); 5387 newRet = imported.get$library().get$types().$index(name);
5172 } 5388 }
5173 else if ($eq(imported.get$prefix(), name)) { 5389 else if ($eq(imported.get$prefix(), name)) {
5174 newRet = imported.get$library().get$topType(); 5390 newRet = imported.get$library().get$topType();
5175 } 5391 }
5176 if (newRet != null) { 5392 if (newRet != null) {
5177 if (ret != null && $ne(ret, newRet)) { 5393 if (ret != null && $ne(ret, newRet)) {
5178 $globals.world.error(("conflicting types for \"" + name + "\""), ret.get $span(), newRet.get$span()); 5394 $globals.world.error(("conflicting types for \"" + name + "\""), ret.get $span(), newRet.get$span());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5222 var index = this.name.lastIndexOf("/", this.name.length); 5438 var index = this.name.lastIndexOf("/", this.name.length);
5223 if (index >= (0)) { 5439 if (index >= (0)) {
5224 this.name = this.name.substring($add(index, (1))); 5440 this.name = this.name.substring($add(index, (1)));
5225 } 5441 }
5226 index = this.name.indexOf("."); 5442 index = this.name.indexOf(".");
5227 if (index > (0)) { 5443 if (index > (0)) {
5228 this.name = this.name.substring((0), index); 5444 this.name = this.name.substring((0), index);
5229 } 5445 }
5230 } 5446 }
5231 this._jsname = this.name.replaceAll(".", "_").replaceAll(":", "_").replaceAll( " ", "_"); 5447 this._jsname = this.name.replaceAll(".", "_").replaceAll(":", "_").replaceAll( " ", "_");
5232 var $$list = this.types.getValues(); 5448 var $$list = this.types.getValues$0();
5233 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 5449 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
5234 var type = $$i.next$0(); 5450 var type = $$i.next$0();
5235 type.resolve$0(); 5451 type.resolve$0();
5236 } 5452 }
5237 } 5453 }
5238 Library.prototype._addTopName = function(name, member, localSpan) { 5454 Library.prototype._addTopName = function(name, member, localSpan) {
5239 var existing = this._topNames.$index(name); 5455 var existing = this._topNames.$index(name);
5240 if (existing == null) { 5456 if (existing == null) {
5241 this._topNames.$setindex(name, member); 5457 this._topNames.$setindex(name, member);
5242 } 5458 }
5243 else { 5459 else {
5244 if ((existing instanceof AmbiguousMember)) { 5460 if ((existing instanceof AmbiguousMember)) {
5245 existing.get$members().add$1(member); 5461 existing.get$members().add$1(member);
5246 } 5462 }
5247 else { 5463 else {
5248 var newMember = new AmbiguousMember(name, [existing, member]); 5464 var newMember = new AmbiguousMember(name, [existing, member]);
5249 $globals.world.error(("conflicting members for \"" + name + "\""), existin g.get$span(), member.get$span(), localSpan); 5465 $globals.world.error(("conflicting members for \"" + name + "\""), existin g.get$span(), member.get$span(), localSpan);
5250 this._topNames.$setindex(name, newMember); 5466 this._topNames.$setindex(name, newMember);
5251 } 5467 }
5252 } 5468 }
5253 } 5469 }
5254 Library.prototype._addTopNames = function(lib) { 5470 Library.prototype._addTopNames = function(lib) {
5255 var $$list = lib.topType.members.getValues(); 5471 var $$list = lib.topType.members.getValues$0();
5256 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 5472 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
5257 var member = $$i.next$0(); 5473 var member = $$i.next$0();
5258 if (member.get$isPrivate() && $ne(lib, this)) continue; 5474 if (member.get$isPrivate() && $ne(lib, this)) continue;
5259 this._addTopName(member.get$name(), member); 5475 this._addTopName(member.get$name(), member);
5260 } 5476 }
5261 var $$list = lib.types.getValues(); 5477 var $$list = lib.types.getValues$0();
5262 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 5478 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
5263 var type = $$i.next$0(); 5479 var type = $$i.next$0();
5264 if (!type.get$isTop()) { 5480 if (!type.get$isTop()) {
5265 if ($ne(lib, this) && type.get$typeMember().get$isPrivate()) continue; 5481 if ($ne(lib, this) && type.get$typeMember().get$isPrivate()) continue;
5266 this._addTopName(type.get$name(), type.get$typeMember()); 5482 this._addTopName(type.get$name(), type.get$typeMember());
5267 } 5483 }
5268 } 5484 }
5269 } 5485 }
5270 Library.prototype.postResolveChecks = function() { 5486 Library.prototype.postResolveChecks = function() {
5271 this._topNames = new HashMapImplementation(); 5487 this._topNames = new HashMapImplementation();
5272 this._addTopNames(this); 5488 this._addTopNames(this);
5273 var $$list = this.imports; 5489 var $$list = this.imports;
5274 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 5490 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
5275 var imported = $$list[$$i]; 5491 var imported = $$list.$index($$i);
5276 if (imported.get$prefix() == null) { 5492 if (imported.get$prefix() == null) {
5277 this._addTopNames(imported.get$library()); 5493 this._addTopNames(imported.get$library());
5278 } 5494 }
5279 else { 5495 else {
5280 this._addTopName(imported.get$prefix(), imported.get$library().get$topType ().get$typeMember(), imported.get$span()); 5496 this._addTopName(imported.get$prefix(), imported.get$library().get$topType ().get$typeMember(), imported.get$span());
5281 } 5497 }
5282 } 5498 }
5283 } 5499 }
5284 Library.prototype.visitSources = function() { 5500 Library.prototype.visitSources = function() {
5285 var visitor = new _LibraryVisitor(this); 5501 var visitor = new _LibraryVisitor(this);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
5436 _LibraryVisitor.prototype.getSingleStringArg = function(node) { 5652 _LibraryVisitor.prototype.getSingleStringArg = function(node) {
5437 if (node.arguments.get$length() != (1)) { 5653 if (node.arguments.get$length() != (1)) {
5438 $globals.world.error(("expected exactly one argument but found " + node.argu ments.get$length()), node.span); 5654 $globals.world.error(("expected exactly one argument but found " + node.argu ments.get$length()), node.span);
5439 } 5655 }
5440 return this.getFirstStringArg(node); 5656 return this.getFirstStringArg(node);
5441 } 5657 }
5442 _LibraryVisitor.prototype.getFirstStringArg = function(node) { 5658 _LibraryVisitor.prototype.getFirstStringArg = function(node) {
5443 if (node.arguments.get$length() < (1)) { 5659 if (node.arguments.get$length() < (1)) {
5444 $globals.world.error(("expected at least one argument but found " + node.arg uments.get$length()), node.span); 5660 $globals.world.error(("expected at least one argument but found " + node.arg uments.get$length()), node.span);
5445 } 5661 }
5446 var arg = node.arguments[(0)]; 5662 var arg = node.arguments.$index((0));
5447 if (arg.get$label() != null) { 5663 if (arg.get$label() != null) {
5448 $globals.world.error("label not allowed for directive", node.span); 5664 $globals.world.error("label not allowed for directive", node.span);
5449 } 5665 }
5450 return this._parseStringArgument(arg); 5666 return this._parseStringArgument(arg);
5451 } 5667 }
5452 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) { 5668 _LibraryVisitor.prototype.tryGetNamedStringArg = function(node, argName) {
5453 var args = node.arguments.filter$1((function (a) { 5669 var args = node.arguments.filter$1((function (a) {
5454 return a.get$label() != null && $eq(a.get$label().get$name(), argName); 5670 return a.get$label() != null && $eq(a.get$label().get$name(), argName);
5455 }) 5671 })
5456 ); 5672 );
(...skipping 13 matching lines...) Expand all
5470 if (!(expr instanceof LiteralExpression) || !expr.get$value().get$type().get$i sString()) { 5686 if (!(expr instanceof LiteralExpression) || !expr.get$value().get$type().get$i sString()) {
5471 $globals.world.error("expected string literal", expr.get$span()); 5687 $globals.world.error("expected string literal", expr.get$span());
5472 } 5688 }
5473 return expr.get$value().get$actualValue(); 5689 return expr.get$value().get$actualValue();
5474 } 5690 }
5475 _LibraryVisitor.prototype.visitTypeDefinition = function(node) { 5691 _LibraryVisitor.prototype.visitTypeDefinition = function(node) {
5476 var oldType = this.currentType; 5692 var oldType = this.currentType;
5477 this.currentType = this.library.addType(node.name.name, node, node.isClass); 5693 this.currentType = this.library.addType(node.name.name, node, node.isClass);
5478 var $$list = node.body; 5694 var $$list = node.body;
5479 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 5695 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
5480 var member = $$list[$$i]; 5696 var member = $$list.$index($$i);
5481 member.visit$1(this); 5697 member.visit$1(this);
5482 } 5698 }
5483 this.currentType = oldType; 5699 this.currentType = oldType;
5484 } 5700 }
5485 _LibraryVisitor.prototype.visitVariableDefinition = function(node) { 5701 _LibraryVisitor.prototype.visitVariableDefinition = function(node) {
5486 this.currentType.addField(node); 5702 this.currentType.addField(node);
5487 } 5703 }
5488 _LibraryVisitor.prototype.visitFunctionDefinition = function(node) { 5704 _LibraryVisitor.prototype.visitFunctionDefinition = function(node) {
5489 this.currentType.addMethod(node.name.name, node); 5705 this.currentType.addMethod(node.name.name, node);
5490 } 5706 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
5662 } 5878 }
5663 FieldMember.prototype.get$isField = function() { 5879 FieldMember.prototype.get$isField = function() {
5664 return true; 5880 return true;
5665 } 5881 }
5666 FieldMember.prototype.resolve = function() { 5882 FieldMember.prototype.resolve = function() {
5667 this.isStatic = this.declaringType.get$isTop(); 5883 this.isStatic = this.declaringType.get$isTop();
5668 this.isFinal = false; 5884 this.isFinal = false;
5669 if (this.definition.modifiers != null) { 5885 if (this.definition.modifiers != null) {
5670 var $$list = this.definition.modifiers; 5886 var $$list = this.definition.modifiers;
5671 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 5887 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
5672 var mod = $$list[$$i]; 5888 var mod = $$list.$index($$i);
5673 if ($eq(mod.get$kind(), (85))) { 5889 if ($eq(mod.get$kind(), (85))) {
5674 if (this.isStatic) { 5890 if (this.isStatic) {
5675 $globals.world.error("duplicate static modifier", mod.get$span()); 5891 $globals.world.error("duplicate static modifier", mod.get$span());
5676 } 5892 }
5677 this.isStatic = true; 5893 this.isStatic = true;
5678 } 5894 }
5679 else if ($eq(mod.get$kind(), (99))) { 5895 else if ($eq(mod.get$kind(), (99))) {
5680 if (this.isFinal) { 5896 if (this.isFinal) {
5681 $globals.world.error("duplicate final modifier", mod.get$span()); 5897 $globals.world.error("duplicate final modifier", mod.get$span());
5682 } 5898 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
5894 PropertyMember.prototype.resolve$0 = PropertyMember.prototype.resolve; 6110 PropertyMember.prototype.resolve$0 = PropertyMember.prototype.resolve;
5895 // ********** Code for ConcreteMember ************** 6111 // ********** Code for ConcreteMember **************
5896 $inherits(ConcreteMember, Member); 6112 $inherits(ConcreteMember, Member);
5897 function ConcreteMember(name, declaringType, baseMember) { 6113 function ConcreteMember(name, declaringType, baseMember) {
5898 this.baseMember = baseMember; 6114 this.baseMember = baseMember;
5899 Member.call(this, name, declaringType); 6115 Member.call(this, name, declaringType);
5900 this.parameters = []; 6116 this.parameters = [];
5901 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring Type); 6117 this.returnType = this.baseMember.get$returnType().resolveTypeParams(declaring Type);
5902 var $$list = this.baseMember.get$parameters(); 6118 var $$list = this.baseMember.get$parameters();
5903 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 6119 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
5904 var p = $$list[$$i]; 6120 var p = $$list.$index($$i);
5905 var newType = p.get$type().resolveTypeParams$1(declaringType); 6121 var newType = p.get$type().resolveTypeParams$1(declaringType);
5906 if ($ne(newType, p.get$type())) { 6122 if ($ne(newType, p.get$type())) {
5907 this.parameters.add(p.copyWithNewType$2(this, newType)); 6123 this.parameters.add(p.copyWithNewType$2(this, newType));
5908 } 6124 }
5909 else { 6125 else {
5910 this.parameters.add(p); 6126 this.parameters.add(p);
5911 } 6127 }
5912 } 6128 }
5913 } 6129 }
5914 ConcreteMember.prototype.get$returnType = function() { return this.returnType; } ; 6130 ConcreteMember.prototype.get$returnType = function() { return this.returnType; } ;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
6118 return false; 6334 return false;
6119 } 6335 }
6120 } 6336 }
6121 MethodMember.prototype.canInvoke = function(context, args) { 6337 MethodMember.prototype.canInvoke = function(context, args) {
6122 var bareCount = args.get$bareCount(); 6338 var bareCount = args.get$bareCount();
6123 if (bareCount > this.parameters.get$length()) return false; 6339 if (bareCount > this.parameters.get$length()) return false;
6124 if (bareCount == this.parameters.get$length()) { 6340 if (bareCount == this.parameters.get$length()) {
6125 if (bareCount != args.get$length()) return false; 6341 if (bareCount != args.get$length()) return false;
6126 } 6342 }
6127 else { 6343 else {
6128 if (!this.parameters[bareCount].get$isOptional()) return false; 6344 if (!this.parameters.$index(bareCount).get$isOptional()) return false;
6129 for (var i = bareCount; 6345 for (var i = bareCount;
6130 i < args.get$length(); i++) { 6346 i < args.get$length(); i++) {
6131 if (this.indexOfParameter(args.getName(i)) < (0)) { 6347 if (this.indexOfParameter(args.getName(i)) < (0)) {
6132 return false; 6348 return false;
6133 } 6349 }
6134 } 6350 }
6135 } 6351 }
6136 return true; 6352 return true;
6137 } 6353 }
6138 MethodMember.prototype.indexOfParameter = function(name) { 6354 MethodMember.prototype.indexOfParameter = function(name) {
6139 for (var i = (0); 6355 for (var i = (0);
6140 i < this.parameters.get$length(); i++) { 6356 i < this.parameters.get$length(); i++) {
6141 var p = this.parameters[i]; 6357 var p = this.parameters.$index(i);
6142 if (p.get$isOptional() && $eq(p.get$name(), name)) { 6358 if (p.get$isOptional() && $eq(p.get$name(), name)) {
6143 return i; 6359 return i;
6144 } 6360 }
6145 } 6361 }
6146 return (-1); 6362 return (-1);
6147 } 6363 }
6148 MethodMember.prototype.provideFieldSyntax = function() { 6364 MethodMember.prototype.provideFieldSyntax = function() {
6149 this._provideFieldSyntax = true; 6365 this._provideFieldSyntax = true;
6150 } 6366 }
6151 MethodMember.prototype.providePropertySyntax = function() { 6367 MethodMember.prototype.providePropertySyntax = function() {
(...skipping 13 matching lines...) Expand all
6165 this._providePropertySyntax = true; 6381 this._providePropertySyntax = true;
6166 return new Value(this.get$functionType(), ("" + target.get$code() + ".get$" + this.get$jsname() + "()"), node.span); 6382 return new Value(this.get$functionType(), ("" + target.get$code() + ".get$" + this.get$jsname() + "()"), node.span);
6167 } 6383 }
6168 MethodMember.prototype.namesInHomePositions = function(args) { 6384 MethodMember.prototype.namesInHomePositions = function(args) {
6169 if (!args.get$hasNames()) return true; 6385 if (!args.get$hasNames()) return true;
6170 for (var i = args.get$bareCount(); 6386 for (var i = args.get$bareCount();
6171 i < args.values.get$length(); i++) { 6387 i < args.values.get$length(); i++) {
6172 if (i >= this.parameters.get$length()) { 6388 if (i >= this.parameters.get$length()) {
6173 return false; 6389 return false;
6174 } 6390 }
6175 if (args.getName(i) != this.parameters[i].get$name()) { 6391 if (args.getName(i) != this.parameters.$index(i).get$name()) {
6176 return false; 6392 return false;
6177 } 6393 }
6178 } 6394 }
6179 return true; 6395 return true;
6180 } 6396 }
6181 MethodMember.prototype.namesInOrder = function(args) { 6397 MethodMember.prototype.namesInOrder = function(args) {
6182 if (!args.get$hasNames()) return true; 6398 if (!args.get$hasNames()) return true;
6183 var lastParameter = null; 6399 var lastParameter = null;
6184 for (var i = args.get$bareCount(); 6400 for (var i = args.get$bareCount();
6185 i < this.parameters.get$length(); i++) { 6401 i < this.parameters.get$length(); i++) {
6186 var p = args.getIndexOfName(this.parameters[i].get$name()); 6402 var p = args.getIndexOfName(this.parameters.$index(i).get$name());
6187 if (p >= (0) && args.values[p].get$needsTemp()) { 6403 if (p >= (0) && args.values.$index(p).get$needsTemp()) {
6188 if (lastParameter != null && lastParameter > p) { 6404 if (lastParameter != null && lastParameter > p) {
6189 return false; 6405 return false;
6190 } 6406 }
6191 lastParameter = p; 6407 lastParameter = p;
6192 } 6408 }
6193 } 6409 }
6194 return true; 6410 return true;
6195 } 6411 }
6196 MethodMember.prototype.needsArgumentConversion = function(args) { 6412 MethodMember.prototype.needsArgumentConversion = function(args) {
6197 var bareCount = args.get$bareCount(); 6413 var bareCount = args.get$bareCount();
6198 for (var i = (0); 6414 for (var i = (0);
6199 i < bareCount; i++) { 6415 i < bareCount; i++) {
6200 var arg = args.values[i]; 6416 var arg = args.values.$index(i);
6201 if (arg.needsConversion$1(this.parameters[i].get$type())) { 6417 if (arg.needsConversion$1(this.parameters.$index(i).get$type())) {
6202 return true; 6418 return true;
6203 } 6419 }
6204 } 6420 }
6205 if (bareCount < this.parameters.get$length()) { 6421 if (bareCount < this.parameters.get$length()) {
6206 this.genParameterValues(); 6422 this.genParameterValues();
6207 for (var i = bareCount; 6423 for (var i = bareCount;
6208 i < this.parameters.get$length(); i++) { 6424 i < this.parameters.get$length(); i++) {
6209 var arg = args.getValue(this.parameters[i].get$name()); 6425 var arg = args.getValue(this.parameters.$index(i).get$name());
6210 if (arg != null && arg.needsConversion$1(this.parameters[i].get$type())) { 6426 if (arg != null && arg.needsConversion$1(this.parameters.$index(i).get$typ e())) {
6211 return true; 6427 return true;
6212 } 6428 }
6213 } 6429 }
6214 } 6430 }
6215 return false; 6431 return false;
6216 } 6432 }
6217 MethodMember._argCountMsg = function(actual, expected, atLeast) { 6433 MethodMember._argCountMsg = function(actual, expected, atLeast) {
6218 return "wrong number of positional arguments, expected " + ("" + (atLeast ? "a t least " : "") + expected + " but found " + actual); 6434 return "wrong number of positional arguments, expected " + ("" + (atLeast ? "a t least " : "") + expected + " but found " + actual);
6219 } 6435 }
6220 MethodMember.prototype._argError = function(context, node, target, args, msg, ar gIndex) { 6436 MethodMember.prototype._argError = function(context, node, target, args, msg, ar gIndex) {
6221 var span; 6437 var span;
6222 if ((args.nodes == null) || (argIndex >= args.nodes.get$length())) { 6438 if ((args.nodes == null) || (argIndex >= args.nodes.get$length())) {
6223 span = node.span; 6439 span = node.span;
6224 } 6440 }
6225 else { 6441 else {
6226 span = args.nodes[argIndex].get$span(); 6442 span = args.nodes.$index(argIndex).get$span();
6227 } 6443 }
6228 if (this.isStatic || this.get$isConstructor()) { 6444 if (this.isStatic || this.get$isConstructor()) {
6229 $globals.world.error(msg, span); 6445 $globals.world.error(msg, span);
6230 } 6446 }
6231 else { 6447 else {
6232 $globals.world.warning(msg, span); 6448 $globals.world.warning(msg, span);
6233 } 6449 }
6234 return target.invokeNoSuchMethod(context, this.name, node, args); 6450 return target.invokeNoSuchMethod(context, this.name, node, args);
6235 } 6451 }
6236 MethodMember.prototype.genParameterValues = function() { 6452 MethodMember.prototype.genParameterValues = function() {
6237 var $$list = this.parameters; 6453 var $$list = this.parameters;
6238 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 6454 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
6239 var p = $$list[$$i]; 6455 var p = $$list.$index($$i);
6240 p.genValue$2(this, this.generator); 6456 p.genValue$2(this, this.generator);
6241 } 6457 }
6242 } 6458 }
6243 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) { 6459 MethodMember.prototype.invoke = function(context, node, target, args, isDynamic) {
6244 if (this.parameters == null) { 6460 if (this.parameters == null) {
6245 $globals.world.info(("surprised to need to resolve: " + this.declaringType.n ame + "." + this.name)); 6461 $globals.world.info(("surprised to need to resolve: " + this.declaringType.n ame + "." + this.name));
6246 this.resolve(); 6462 this.resolve();
6247 } 6463 }
6248 this.declaringType.genMethod(this); 6464 this.declaringType.genMethod(this);
6249 if (this.isStatic || this.isFactory) { 6465 if (this.isStatic || this.isFactory) {
6250 this.declaringType.markUsed(); 6466 this.declaringType.markUsed();
6251 } 6467 }
6252 if (this.get$isNative() && this.returnType != null) this.returnType.markUsed() ; 6468 if (this.get$isNative() && this.returnType != null) this.returnType.markUsed() ;
6253 if (!this.namesInOrder(args)) { 6469 if (!this.namesInOrder(args)) {
6254 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s); 6470 return context.findMembers(this.name).invokeOnVar(context, node, target, arg s);
6255 } 6471 }
6256 var argsCode = []; 6472 var argsCode = [];
6257 if (!target.get$isType() && (this.get$isConstructor() || target.get$isSuper()) ) { 6473 if (!target.get$isType() && (this.get$isConstructor() || target.get$isSuper()) ) {
6258 argsCode.add$1("this"); 6474 argsCode.add$1("this");
6259 } 6475 }
6260 var bareCount = args.get$bareCount(); 6476 var bareCount = args.get$bareCount();
6261 for (var i = (0); 6477 for (var i = (0);
6262 i < bareCount; i++) { 6478 i < bareCount; i++) {
6263 var arg = args.values[i]; 6479 var arg = args.values.$index(i);
6264 if (i >= this.parameters.get$length()) { 6480 if (i >= this.parameters.get$length()) {
6265 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.get $length(), false); 6481 var msg = MethodMember._argCountMsg(args.get$length(), this.parameters.get $length(), false);
6266 return this._argError(context, node, target, args, msg, i); 6482 return this._argError(context, node, target, args, msg, i);
6267 } 6483 }
6268 arg = arg.convertTo$3(context, this.parameters[i].get$type(), isDynamic); 6484 arg = arg.convertTo$3(context, this.parameters.$index(i).get$type(), isDynam ic);
6269 argsCode.add$1(arg.get$code()); 6485 argsCode.add$1(arg.get$code());
6270 } 6486 }
6271 var namedArgsUsed = (0); 6487 var namedArgsUsed = (0);
6272 if (bareCount < this.parameters.get$length()) { 6488 if (bareCount < this.parameters.get$length()) {
6273 this.genParameterValues(); 6489 this.genParameterValues();
6274 for (var i = bareCount; 6490 for (var i = bareCount;
6275 i < this.parameters.get$length(); i++) { 6491 i < this.parameters.get$length(); i++) {
6276 var arg = args.getValue(this.parameters[i].get$name()); 6492 var arg = args.getValue(this.parameters.$index(i).get$name());
6277 if (arg == null) { 6493 if (arg == null) {
6278 arg = this.parameters[i].get$value(); 6494 arg = this.parameters.$index(i).get$value();
6279 } 6495 }
6280 else { 6496 else {
6281 arg = arg.convertTo$3(context, this.parameters[i].get$type(), isDynamic) ; 6497 arg = arg.convertTo$3(context, this.parameters.$index(i).get$type(), isD ynamic);
6282 namedArgsUsed++; 6498 namedArgsUsed++;
6283 } 6499 }
6284 if (arg == null || !this.parameters[i].get$isOptional()) { 6500 if (arg == null || !this.parameters.$index(i).get$isOptional()) {
6285 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + (1), true); 6501 var msg = MethodMember._argCountMsg(Math.min(i, args.get$length()), i + (1), true);
6286 return this._argError(context, node, target, args, msg, i); 6502 return this._argError(context, node, target, args, msg, i);
6287 } 6503 }
6288 else { 6504 else {
6289 argsCode.add$1(arg.get$code()); 6505 argsCode.add$1(arg.get$code());
6290 } 6506 }
6291 } 6507 }
6292 Arguments.removeTrailingNulls(argsCode); 6508 Arguments.removeTrailingNulls(argsCode);
6293 } 6509 }
6294 if (namedArgsUsed < args.get$nameCount()) { 6510 if (namedArgsUsed < args.get$nameCount()) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
6430 return new Value(this.get$inferredResult(), ("" + target.get$code() + "." + th is.get$jsname() + "(" + argsString + ")"), node.span); 6646 return new Value(this.get$inferredResult(), ("" + target.get$code() + "." + th is.get$jsname() + "(" + argsString + ")"), node.span);
6431 } 6647 }
6432 MethodMember.prototype.resolve = function() { 6648 MethodMember.prototype.resolve = function() {
6433 this.isStatic = this.declaringType.get$isTop(); 6649 this.isStatic = this.declaringType.get$isTop();
6434 this.isConst = false; 6650 this.isConst = false;
6435 this.isFactory = false; 6651 this.isFactory = false;
6436 this.isAbstract = !this.declaringType.get$isClass(); 6652 this.isAbstract = !this.declaringType.get$isClass();
6437 if (this.definition.modifiers != null) { 6653 if (this.definition.modifiers != null) {
6438 var $$list = this.definition.modifiers; 6654 var $$list = this.definition.modifiers;
6439 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 6655 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
6440 var mod = $$list[$$i]; 6656 var mod = $$list.$index($$i);
6441 if ($eq(mod.get$kind(), (85))) { 6657 if ($eq(mod.get$kind(), (85))) {
6442 if (this.isStatic) { 6658 if (this.isStatic) {
6443 $globals.world.error("duplicate static modifier", mod.get$span()); 6659 $globals.world.error("duplicate static modifier", mod.get$span());
6444 } 6660 }
6445 this.isStatic = true; 6661 this.isStatic = true;
6446 } 6662 }
6447 else if (this.get$isConstructor() && $eq(mod.get$kind(), (92))) { 6663 else if (this.get$isConstructor() && $eq(mod.get$kind(), (92))) {
6448 if (this.isConst) { 6664 if (this.isConst) {
6449 $globals.world.error("duplicate const modifier", mod.get$span()); 6665 $globals.world.error("duplicate const modifier", mod.get$span());
6450 } 6666 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
6502 } 6718 }
6503 if (this.get$isConstructor() && !this.isFactory) { 6719 if (this.get$isConstructor() && !this.isFactory) {
6504 this.returnType = this.declaringType; 6720 this.returnType = this.declaringType;
6505 } 6721 }
6506 else { 6722 else {
6507 this.returnType = this.resolveType(this.definition.returnType, false, true); 6723 this.returnType = this.resolveType(this.definition.returnType, false, true);
6508 } 6724 }
6509 this.parameters = []; 6725 this.parameters = [];
6510 var $$list = this.definition.formals; 6726 var $$list = this.definition.formals;
6511 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 6727 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
6512 var formal = $$list[$$i]; 6728 var formal = $$list.$index($$i);
6513 var param = new Parameter(formal, this); 6729 var param = new Parameter(formal, this);
6514 param.resolve$0(); 6730 param.resolve$0();
6515 this.parameters.add(param); 6731 this.parameters.add(param);
6516 } 6732 }
6517 if (!this.isLambda) { 6733 if (!this.isLambda) {
6518 this.get$library()._addMember(this); 6734 this.get$library()._addMember(this);
6519 } 6735 }
6520 } 6736 }
6521 MethodMember.prototype.resolveType = function(node, typeErrors, allowVoid) { 6737 MethodMember.prototype.resolveType = function(node, typeErrors, allowVoid) {
6522 var t = Element.prototype.resolveType.call(this, node, typeErrors); 6738 var t = Element.prototype.resolveType.call(this, node, typeErrors);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
6560 MemberSet.prototype.get$members = function() { return this.members; }; 6776 MemberSet.prototype.get$members = function() { return this.members; };
6561 MemberSet.prototype.get$jsname = function() { return this.jsname; }; 6777 MemberSet.prototype.get$jsname = function() { return this.jsname; };
6562 MemberSet.prototype.get$isVar = function() { return this.isVar; }; 6778 MemberSet.prototype.get$isVar = function() { return this.isVar; };
6563 MemberSet.prototype.toString = function() { 6779 MemberSet.prototype.toString = function() {
6564 return ("" + this.name + ":" + this.members.get$length()); 6780 return ("" + this.name + ":" + this.members.get$length());
6565 } 6781 }
6566 MemberSet.prototype.add = function(member) { 6782 MemberSet.prototype.add = function(member) {
6567 return this.members.add(member); 6783 return this.members.add(member);
6568 } 6784 }
6569 MemberSet.prototype.get$isStatic = function() { 6785 MemberSet.prototype.get$isStatic = function() {
6570 return this.members.get$length() == (1) && this.members[(0)].get$isStatic(); 6786 return this.members.get$length() == (1) && this.members.$index((0)).get$isStat ic();
6571 } 6787 }
6572 MemberSet.prototype.get$isOperator = function() { 6788 MemberSet.prototype.get$isOperator = function() {
6573 return this.members[(0)].get$isOperator(); 6789 return this.members.$index((0)).get$isOperator();
6574 } 6790 }
6575 MemberSet.prototype.canInvoke = function(context, args) { 6791 MemberSet.prototype.canInvoke = function(context, args) {
6576 return this.members.some((function (m) { 6792 return this.members.some((function (m) {
6577 return m.canInvoke$2(context, args); 6793 return m.canInvoke$2(context, args);
6578 }) 6794 })
6579 ); 6795 );
6580 } 6796 }
6581 MemberSet.prototype._makeError = function(node, target, action) { 6797 MemberSet.prototype._makeError = function(node, target, action) {
6582 if (!target.get$type().get$isVar()) { 6798 if (!target.get$type().get$isVar()) {
6583 $globals.world.warning(("could not find applicable " + action + " for \"" + this.name + "\""), node.span); 6799 $globals.world.warning(("could not find applicable " + action + " for \"" + this.name + "\""), node.span);
6584 } 6800 }
6585 return new Value($globals.world.varType, ("" + target.get$code() + "." + this. jsname + "() /*no applicable " + action + "*/"), node.span); 6801 return new Value($globals.world.varType, ("" + target.get$code() + "." + this. jsname + "() /*no applicable " + action + "*/"), node.span);
6586 } 6802 }
6587 MemberSet.prototype.get$treatAsField = function() { 6803 MemberSet.prototype.get$treatAsField = function() {
6588 if (this._treatAsField == null) { 6804 if (this._treatAsField == null) {
6589 this._treatAsField = !this.isVar && (this.members.some((function (m) { 6805 this._treatAsField = !this.isVar && (this.members.some((function (m) {
6590 return m.get$requiresFieldSyntax(); 6806 return m.get$requiresFieldSyntax();
6591 }) 6807 })
6592 ) || this.members.every((function (m) { 6808 ) || this.members.every((function (m) {
6593 return !m.get$requiresPropertySyntax(); 6809 return !m.get$requiresPropertySyntax();
6594 }) 6810 })
6595 )); 6811 ));
6596 var $$list = this.members; 6812 var $$list = this.members;
6597 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 6813 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
6598 var member = $$list[$$i]; 6814 var member = $$list.$index($$i);
6599 if (this._treatAsField) { 6815 if (this._treatAsField) {
6600 member.provideFieldSyntax$0(); 6816 member.provideFieldSyntax$0();
6601 } 6817 }
6602 else { 6818 else {
6603 member.providePropertySyntax$0(); 6819 member.providePropertySyntax$0();
6604 } 6820 }
6605 } 6821 }
6606 } 6822 }
6607 return this._treatAsField; 6823 return this._treatAsField;
6608 } 6824 }
6609 MemberSet.prototype._get = function(context, node, target, isDynamic) { 6825 MemberSet.prototype._get = function(context, node, target, isDynamic) {
6610 var returnValue; 6826 var returnValue;
6611 if (this.members.get$length() == (1) && !this.isVar) { 6827 if (this.members.get$length() == (1) && !this.isVar) {
6612 return this.members[(0)]._get$4(context, node, target, isDynamic); 6828 return this.members.$index((0))._get$4(context, node, target, isDynamic);
6613 } 6829 }
6614 var targets = this.members.filter$1((function (m) { 6830 var targets = this.members.filter$1((function (m) {
6615 return m.get$canGet(); 6831 return m.get$canGet();
6616 }) 6832 })
6617 ); 6833 );
6618 if (this.isVar) { 6834 if (this.isVar) {
6619 targets.forEach$1((function (m) { 6835 targets.forEach$1((function (m) {
6620 return m._get$3$isDynamic(context, node, target, true); 6836 return m._get$3$isDynamic(context, node, target, true);
6621 }) 6837 })
6622 ); 6838 );
6623 returnValue = new Value(this._foldTypes(targets), null, node.span); 6839 returnValue = new Value(this._foldTypes(targets), null, node.span);
6624 } 6840 }
6625 else { 6841 else {
6626 if (this.members.get$length() == (1)) { 6842 if (this.members.get$length() == (1)) {
6627 return this.members[(0)]._get$4(context, node, target, isDynamic); 6843 return this.members.$index((0))._get$4(context, node, target, isDynamic);
6628 } 6844 }
6629 else if ($eq(targets.get$length(), (1))) { 6845 else if ($eq(targets.get$length(), (1))) {
6630 return targets.$index((0))._get$4(context, node, target, isDynamic); 6846 return targets.$index((0))._get$4(context, node, target, isDynamic);
6631 } 6847 }
6632 for (var $$i = targets.iterator$0(); $$i.hasNext$0(); ) { 6848 for (var $$i = targets.iterator$0(); $$i.hasNext$0(); ) {
6633 var member = $$i.next$0(); 6849 var member = $$i.next$0();
6634 var value = member._get$3$isDynamic(context, node, target, true); 6850 var value = member._get$3$isDynamic(context, node, target, true);
6635 returnValue = this._tryUnion(returnValue, value, node); 6851 returnValue = this._tryUnion(returnValue, value, node);
6636 } 6852 }
6637 if (returnValue == null) { 6853 if (returnValue == null) {
6638 return this._makeError(node, target, "getter"); 6854 return this._makeError(node, target, "getter");
6639 } 6855 }
6640 } 6856 }
6641 if (returnValue.get$code() == null) { 6857 if (returnValue.get$code() == null) {
6642 if (this.get$treatAsField()) { 6858 if (this.get$treatAsField()) {
6643 return new Value(returnValue.get$type(), ("" + target.get$code() + "." + t his.jsname), node.span); 6859 return new Value(returnValue.get$type(), ("" + target.get$code() + "." + t his.jsname), node.span);
6644 } 6860 }
6645 else { 6861 else {
6646 return new Value(returnValue.get$type(), ("" + target.get$code() + ".get$" + this.jsname + "()"), node.span); 6862 return new Value(returnValue.get$type(), ("" + target.get$code() + ".get$" + this.jsname + "()"), node.span);
6647 } 6863 }
6648 } 6864 }
6649 return returnValue; 6865 return returnValue;
6650 } 6866 }
6651 MemberSet.prototype._set = function(context, node, target, value, isDynamic) { 6867 MemberSet.prototype._set = function(context, node, target, value, isDynamic) {
6652 if (this.members.get$length() == (1) && !this.isVar) { 6868 if (this.members.get$length() == (1) && !this.isVar) {
6653 return this.members[(0)]._set$5(context, node, target, value, isDynamic); 6869 return this.members.$index((0))._set$5(context, node, target, value, isDynam ic);
6654 } 6870 }
6655 var returnValue; 6871 var returnValue;
6656 var targets = this.members.filter$1((function (m) { 6872 var targets = this.members.filter$1((function (m) {
6657 return m.get$canSet(); 6873 return m.get$canSet();
6658 }) 6874 })
6659 ); 6875 );
6660 if (this.isVar) { 6876 if (this.isVar) {
6661 targets.forEach$1((function (m) { 6877 targets.forEach$1((function (m) {
6662 return m._set$4$isDynamic(context, node, target, value, true); 6878 return m._set$4$isDynamic(context, node, target, value, true);
6663 }) 6879 })
6664 ); 6880 );
6665 returnValue = new Value(this._foldTypes(targets), null, node.span); 6881 returnValue = new Value(this._foldTypes(targets), null, node.span);
6666 } 6882 }
6667 else { 6883 else {
6668 if (this.members.get$length() == (1)) { 6884 if (this.members.get$length() == (1)) {
6669 return this.members[(0)]._set$5(context, node, target, value, isDynamic); 6885 return this.members.$index((0))._set$5(context, node, target, value, isDyn amic);
6670 } 6886 }
6671 else if ($eq(targets.get$length(), (1))) { 6887 else if ($eq(targets.get$length(), (1))) {
6672 return targets.$index((0))._set$5(context, node, target, value, isDynamic) ; 6888 return targets.$index((0))._set$5(context, node, target, value, isDynamic) ;
6673 } 6889 }
6674 for (var $$i = targets.iterator$0(); $$i.hasNext$0(); ) { 6890 for (var $$i = targets.iterator$0(); $$i.hasNext$0(); ) {
6675 var member = $$i.next$0(); 6891 var member = $$i.next$0();
6676 var res = member._set$4$isDynamic(context, node, target, value, true); 6892 var res = member._set$4$isDynamic(context, node, target, value, true);
6677 returnValue = this._tryUnion(returnValue, res, node); 6893 returnValue = this._tryUnion(returnValue, res, node);
6678 } 6894 }
6679 if (returnValue == null) { 6895 if (returnValue == null) {
6680 return this._makeError(node, target, "setter"); 6896 return this._makeError(node, target, "setter");
6681 } 6897 }
6682 } 6898 }
6683 if (returnValue.get$code() == null) { 6899 if (returnValue.get$code() == null) {
6684 if (this.get$treatAsField()) { 6900 if (this.get$treatAsField()) {
6685 return new Value(returnValue.get$type(), ("" + target.get$code() + "." + t his.jsname + " = " + value.get$code()), node.span); 6901 return new Value(returnValue.get$type(), ("" + target.get$code() + "." + t his.jsname + " = " + value.get$code()), node.span);
6686 } 6902 }
6687 else { 6903 else {
6688 return new Value(returnValue.get$type(), ("" + target.get$code() + ".set$" + this.jsname + "(" + value.get$code() + ")"), node.span); 6904 return new Value(returnValue.get$type(), ("" + target.get$code() + ".set$" + this.jsname + "(" + value.get$code() + ")"), node.span);
6689 } 6905 }
6690 } 6906 }
6691 return returnValue; 6907 return returnValue;
6692 } 6908 }
6693 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) { 6909 MemberSet.prototype.invoke = function(context, node, target, args, isDynamic) {
6694 if (this.isVar && !this.get$isOperator()) { 6910 if (this.isVar && !this.get$isOperator()) {
6695 return this.invokeOnVar(context, node, target, args); 6911 return this.invokeOnVar(context, node, target, args);
6696 } 6912 }
6697 if (this.members.get$length() == (1) && !this.isVar) { 6913 if (this.members.get$length() == (1) && !this.isVar) {
6698 return this.members[(0)].invoke$5(context, node, target, args, isDynamic); 6914 return this.members.$index((0)).invoke$5(context, node, target, args, isDyna mic);
6699 } 6915 }
6700 var targets = this.members.filter$1((function (m) { 6916 var targets = this.members.filter$1((function (m) {
6701 return m.canInvoke$2(context, args); 6917 return m.canInvoke$2(context, args);
6702 }) 6918 })
6703 ); 6919 );
6704 if ($eq(targets.get$length(), (1))) { 6920 if ($eq(targets.get$length(), (1))) {
6705 return targets.$index((0)).invoke$5(context, node, target, args, isDynamic); 6921 return targets.$index((0)).invoke$5(context, node, target, args, isDynamic);
6706 } 6922 }
6707 var returnValue = null; 6923 var returnValue = null;
6708 if (targets.get$length() < (1000)) { 6924 if (targets.get$length() < (1000)) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
6823 } 7039 }
6824 FactoryMap.prototype.addFactory = function(typeName, name, member) { 7040 FactoryMap.prototype.addFactory = function(typeName, name, member) {
6825 this.getFactoriesFor(typeName).$setindex(name, member); 7041 this.getFactoriesFor(typeName).$setindex(name, member);
6826 } 7042 }
6827 FactoryMap.prototype.getFactory = function(typeName, name) { 7043 FactoryMap.prototype.getFactory = function(typeName, name) {
6828 return this.getFactoriesFor(typeName).$index(name); 7044 return this.getFactoriesFor(typeName).$index(name);
6829 } 7045 }
6830 FactoryMap.prototype.forEach = function(f) { 7046 FactoryMap.prototype.forEach = function(f) {
6831 this.factories.forEach((function (_, constructors) { 7047 this.factories.forEach((function (_, constructors) {
6832 constructors.forEach((function (_, member) { 7048 constructors.forEach((function (_, member) {
6833 f.call$1(member); 7049 f(member);
6834 }) 7050 })
6835 ); 7051 );
6836 }) 7052 })
6837 ); 7053 );
6838 } 7054 }
6839 FactoryMap.prototype.forEach$1 = function($0) { 7055 FactoryMap.prototype.forEach$1 = function($0) {
6840 return this.forEach(to$call$1($0)); 7056 return this.forEach(to$call$1($0));
6841 }; 7057 };
6842 FactoryMap.prototype.getFactory$2 = FactoryMap.prototype.getFactory; 7058 FactoryMap.prototype.getFactory$2 = FactoryMap.prototype.getFactory;
6843 // ********** Code for Token ************** 7059 // ********** Code for Token **************
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
6919 } 7135 }
6920 SourceFile.prototype.getLine = function(position) { 7136 SourceFile.prototype.getLine = function(position) {
6921 var starts = this.get$lineStarts(); 7137 var starts = this.get$lineStarts();
6922 for (var i = (0); 7138 for (var i = (0);
6923 i < starts.get$length(); i++) { 7139 i < starts.get$length(); i++) {
6924 if (starts.$index(i) > position) return i - (1); 7140 if (starts.$index(i) > position) return i - (1);
6925 } 7141 }
6926 $globals.world.internalError("bad position"); 7142 $globals.world.internalError("bad position");
6927 } 7143 }
6928 SourceFile.prototype.getColumn = function(line, position) { 7144 SourceFile.prototype.getColumn = function(line, position) {
6929 return position - this.get$lineStarts()[line]; 7145 return position - this.get$lineStarts().$index(line);
6930 } 7146 }
6931 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) { 7147 SourceFile.prototype.getLocationMessage = function(message, start, end, includeT ext) {
6932 var line = this.getLine(start); 7148 var line = this.getLine(start);
6933 var column = this.getColumn(line, start); 7149 var column = this.getColumn(line, start);
6934 var buf = new StringBufferImpl(("" + this.filename + ":" + ($add(line, (1))) + ":" + ($add(column, (1))) + ": " + message)); 7150 var buf = new StringBufferImpl(("" + this.filename + ":" + ($add(line, (1))) + ":" + ($add(column, (1))) + ": " + message));
6935 if (includeText) { 7151 if (includeText) {
6936 buf.add$1("\n"); 7152 buf.add$1("\n");
6937 var textLine; 7153 var textLine;
6938 if (($add(line, (2))) < this._lineStarts.get$length()) { 7154 if (($add(line, (2))) < this._lineStarts.get$length()) {
6939 textLine = this.get$text().substring(this._lineStarts[line], this._lineSta rts[$add(line, (1))]); 7155 textLine = this.get$text().substring(this._lineStarts.$index(line), this._ lineStarts.$index($add(line, (1))));
6940 } 7156 }
6941 else { 7157 else {
6942 textLine = this.get$text().substring(this._lineStarts[line]) + "\n"; 7158 textLine = this.get$text().substring(this._lineStarts.$index(line)) + "\n" ;
6943 } 7159 }
6944 var toColumn = Math.min($add(column, (end - start)), textLine.get$length()); 7160 var toColumn = Math.min($add(column, (end - start)), textLine.get$length());
6945 if ($globals.options.useColors) { 7161 if ($globals.options.useColors) {
6946 buf.add$1(textLine.substring$2((0), column)); 7162 buf.add$1(textLine.substring$2((0), column));
6947 buf.add$1($globals._RED_COLOR); 7163 buf.add$1($globals._RED_COLOR);
6948 buf.add$1(textLine.substring$2(column, toColumn)); 7164 buf.add$1(textLine.substring$2(column, toColumn));
6949 buf.add$1($globals._NO_COLOR); 7165 buf.add$1($globals._NO_COLOR);
6950 buf.add$1(textLine.substring$1(toColumn)); 7166 buf.add$1(textLine.substring$1(toColumn));
6951 } 7167 }
6952 else { 7168 else {
(...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after
9916 if (this._inhibitLambda) return false; 10132 if (this._inhibitLambda) return false;
9917 var after = this._peekAfterCloseParen(); 10133 var after = this._peekAfterCloseParen();
9918 return after.kind == (9) || after.kind == (6); 10134 return after.kind == (9) || after.kind == (6);
9919 } 10135 }
9920 Parser.prototype._eatLeftParen = function() { 10136 Parser.prototype._eatLeftParen = function() {
9921 this._eat((2)); 10137 this._eat((2));
9922 this._afterParensIndex++; 10138 this._afterParensIndex++;
9923 } 10139 }
9924 Parser.prototype._peekAfterCloseParen = function() { 10140 Parser.prototype._peekAfterCloseParen = function() {
9925 if (this._afterParensIndex < this._afterParens.get$length()) { 10141 if (this._afterParensIndex < this._afterParens.get$length()) {
9926 return this._afterParens[this._afterParensIndex]; 10142 return this._afterParens.$index(this._afterParensIndex);
9927 } 10143 }
9928 this._afterParensIndex = (0); 10144 this._afterParensIndex = (0);
9929 this._afterParens.clear(); 10145 this._afterParens.clear();
9930 var tokens = [this._lang_next()]; 10146 var tokens = [this._lang_next()];
9931 this._lookaheadAfterParens(tokens); 10147 this._lookaheadAfterParens(tokens);
9932 var after = this._peekToken; 10148 var after = this._peekToken;
9933 tokens.add$1(after); 10149 tokens.add$1(after);
9934 this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer); 10150 this.tokenizer = new DivertedTokenSource(tokens, this, this.tokenizer);
9935 this._lang_next(); 10151 this._lang_next();
9936 return after; 10152 return after;
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
10387 } 10603 }
10388 IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.proto type.toString; 10604 IncompleteSourceException.prototype.toString$0 = IncompleteSourceException.proto type.toString;
10389 // ********** Code for DivertedTokenSource ************** 10605 // ********** Code for DivertedTokenSource **************
10390 function DivertedTokenSource(tokens, parser, previousTokenizer) { 10606 function DivertedTokenSource(tokens, parser, previousTokenizer) {
10391 this.parser = parser; 10607 this.parser = parser;
10392 this._lang_pos = (0); 10608 this._lang_pos = (0);
10393 this.tokens = tokens; 10609 this.tokens = tokens;
10394 this.previousTokenizer = previousTokenizer; 10610 this.previousTokenizer = previousTokenizer;
10395 } 10611 }
10396 DivertedTokenSource.prototype.next = function() { 10612 DivertedTokenSource.prototype.next = function() {
10397 var token = this.tokens[this._lang_pos]; 10613 var token = this.tokens.$index(this._lang_pos);
10398 ++this._lang_pos; 10614 ++this._lang_pos;
10399 if (this._lang_pos == this.tokens.get$length()) { 10615 if (this._lang_pos == this.tokens.get$length()) {
10400 this.parser.tokenizer = this.previousTokenizer; 10616 this.parser.tokenizer = this.previousTokenizer;
10401 } 10617 }
10402 return token; 10618 return token;
10403 } 10619 }
10404 DivertedTokenSource.prototype.next$0 = DivertedTokenSource.prototype.next; 10620 DivertedTokenSource.prototype.next$0 = DivertedTokenSource.prototype.next;
10405 // ********** Code for Node ************** 10621 // ********** Code for Node **************
10406 function Node(span) { 10622 function Node(span) {
10407 this.span = span; 10623 this.span = span;
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
11324 var typeParam = params.next$0(); 11540 var typeParam = params.next$0();
11325 var typeArg = args.next$0(); 11541 var typeArg = args.next$0();
11326 if (typeParam.get$extendsType() != null && typeArg != null) { 11542 if (typeParam.get$extendsType() != null && typeArg != null) {
11327 typeArg.ensureSubtypeOf$3(typeParam.get$extendsType(), typeParam.get$spa n(), true); 11543 typeArg.ensureSubtypeOf$3(typeParam.get$extendsType(), typeParam.get$spa n(), true);
11328 } 11544 }
11329 } 11545 }
11330 } 11546 }
11331 if (this.get$interfaces() != null) { 11547 if (this.get$interfaces() != null) {
11332 var $$list = this.get$interfaces(); 11548 var $$list = this.get$interfaces();
11333 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 11549 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
11334 var i = $$list[$$i]; 11550 var i = $$list.$index($$i);
11335 i._checkExtends$0(); 11551 i._checkExtends$0();
11336 } 11552 }
11337 } 11553 }
11338 } 11554 }
11339 Type.prototype._checkOverride = function(member) { 11555 Type.prototype._checkOverride = function(member) {
11340 var parentMember = this._getMemberInParents(member.name); 11556 var parentMember = this._getMemberInParents(member.name);
11341 if (parentMember != null) { 11557 if (parentMember != null) {
11342 if (!member.get$isPrivate() || $eq(member.get$library(), parentMember.get$li brary())) { 11558 if (!member.get$isPrivate() || $eq(member.get$library(), parentMember.get$li brary())) {
11343 member.override(parentMember); 11559 member.override(parentMember);
11344 } 11560 }
(...skipping 18 matching lines...) Expand all
11363 return this.get$parent().getMember(memberName); 11579 return this.get$parent().getMember(memberName);
11364 } 11580 }
11365 else { 11581 else {
11366 return null; 11582 return null;
11367 } 11583 }
11368 } 11584 }
11369 else { 11585 else {
11370 if (this.get$interfaces() != null && this.get$interfaces().get$length() > (0 )) { 11586 if (this.get$interfaces() != null && this.get$interfaces().get$length() > (0 )) {
11371 var $$list = this.get$interfaces(); 11587 var $$list = this.get$interfaces();
11372 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 11588 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
11373 var i = $$list[$$i]; 11589 var i = $$list.$index($$i);
11374 var ret = i.getMember$1(memberName); 11590 var ret = i.getMember$1(memberName);
11375 if (ret != null) { 11591 if (ret != null) {
11376 return ret; 11592 return ret;
11377 } 11593 }
11378 } 11594 }
11379 } 11595 }
11380 return $globals.world.objectType.getMember(memberName); 11596 return $globals.world.objectType.getMember(memberName);
11381 } 11597 }
11382 } 11598 }
11383 Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) { 11599 Type.prototype.ensureSubtypeOf = function(other, span, typeErrors) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
11688 ConcreteType.prototype.get$isClass = function() { 11904 ConcreteType.prototype.get$isClass = function() {
11689 return this.genericType.isClass; 11905 return this.genericType.isClass;
11690 } 11906 }
11691 ConcreteType.prototype.get$library = function() { 11907 ConcreteType.prototype.get$library = function() {
11692 return this.genericType.library; 11908 return this.genericType.library;
11693 } 11909 }
11694 ConcreteType.prototype.get$span = function() { 11910 ConcreteType.prototype.get$span = function() {
11695 return this.genericType.get$span(); 11911 return this.genericType.get$span();
11696 } 11912 }
11697 ConcreteType.prototype.get$hasTypeParams = function() { 11913 ConcreteType.prototype.get$hasTypeParams = function() {
11698 return this.typeArguments.getValues().some((function (e) { 11914 return this.typeArguments.getValues$0().some$1((function (e) {
11699 return (e instanceof ParameterType); 11915 return (e instanceof ParameterType);
11700 }) 11916 })
11701 ); 11917 );
11702 } 11918 }
11703 ConcreteType.prototype.get$isUsed = function() { return this.isUsed; }; 11919 ConcreteType.prototype.get$isUsed = function() { return this.isUsed; };
11704 ConcreteType.prototype.set$isUsed = function(value) { return this.isUsed = value ; }; 11920 ConcreteType.prototype.set$isUsed = function(value) { return this.isUsed = value ; };
11705 ConcreteType.prototype.get$members = function() { return this.members; }; 11921 ConcreteType.prototype.get$members = function() { return this.members; };
11706 ConcreteType.prototype.set$members = function(value) { return this.members = val ue; }; 11922 ConcreteType.prototype.set$members = function(value) { return this.members = val ue; };
11707 ConcreteType.prototype.get$constructors = function() { return this.constructors; }; 11923 ConcreteType.prototype.get$constructors = function() { return this.constructors; };
11708 ConcreteType.prototype.set$constructors = function(value) { return this.construc tors = value; }; 11924 ConcreteType.prototype.set$constructors = function(value) { return this.construc tors = value; };
11709 ConcreteType.prototype.get$factories = function() { return this.factories; }; 11925 ConcreteType.prototype.get$factories = function() { return this.factories; };
11710 ConcreteType.prototype.set$factories = function(value) { return this.factories = value; }; 11926 ConcreteType.prototype.set$factories = function(value) { return this.factories = value; };
11711 ConcreteType.prototype.resolveTypeParams = function(inType) { 11927 ConcreteType.prototype.resolveTypeParams = function(inType) {
11712 var newTypeArgs = []; 11928 var newTypeArgs = [];
11713 var needsNewType = false; 11929 var needsNewType = false;
11714 var $$list = this.typeArgsInOrder; 11930 var $$list = this.typeArgsInOrder;
11715 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 11931 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
11716 var t = $$list[$$i]; 11932 var t = $$list.$index($$i);
11717 var newType = t.resolveTypeParams$1(inType); 11933 var newType = t.resolveTypeParams$1(inType);
11718 if ($ne(newType, t)) needsNewType = true; 11934 if ($ne(newType, t)) needsNewType = true;
11719 newTypeArgs.add$1(newType); 11935 newTypeArgs.add$1(newType);
11720 } 11936 }
11721 if (!needsNewType) return this; 11937 if (!needsNewType) return this;
11722 return this.genericType.getOrMakeConcreteType(newTypeArgs); 11938 return this.genericType.getOrMakeConcreteType(newTypeArgs);
11723 } 11939 }
11724 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) { 11940 ConcreteType.prototype.getOrMakeConcreteType = function(typeArgs) {
11725 return this.genericType.getOrMakeConcreteType(typeArgs); 11941 return this.genericType.getOrMakeConcreteType(typeArgs);
11726 } 11942 }
11727 ConcreteType.prototype.get$parent = function() { 11943 ConcreteType.prototype.get$parent = function() {
11728 if (this._parent == null && this.genericType.get$parent() != null) { 11944 if (this._parent == null && this.genericType.get$parent() != null) {
11729 this._parent = this.genericType.get$parent().resolveTypeParams(this); 11945 this._parent = this.genericType.get$parent().resolveTypeParams(this);
11730 } 11946 }
11731 return this._parent; 11947 return this._parent;
11732 } 11948 }
11733 ConcreteType.prototype.get$interfaces = function() { 11949 ConcreteType.prototype.get$interfaces = function() {
11734 if (this._interfaces == null && this.genericType.interfaces != null) { 11950 if (this._interfaces == null && this.genericType.interfaces != null) {
11735 this._interfaces = []; 11951 this._interfaces = [];
11736 var $$list = this.genericType.interfaces; 11952 var $$list = this.genericType.interfaces;
11737 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 11953 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
11738 var i = $$list[$$i]; 11954 var i = $$list.$index($$i);
11739 this._interfaces.add(i.resolveTypeParams$1(this)); 11955 this._interfaces.add(i.resolveTypeParams$1(this));
11740 } 11956 }
11741 } 11957 }
11742 return this._interfaces; 11958 return this._interfaces;
11743 } 11959 }
11744 ConcreteType.prototype.get$subtypes = function() { 11960 ConcreteType.prototype.get$subtypes = function() {
11745 if (this._subtypes == null) { 11961 if (this._subtypes == null) {
11746 this._subtypes = new HashSetImplementation(); 11962 this._subtypes = new HashSetImplementation();
11747 var $$list = this.genericType.get$subtypes(); 11963 var $$list = this.genericType.get$subtypes();
11748 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 11964 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
11949 DefinedType.prototype.getAllMembers = function() { 12165 DefinedType.prototype.getAllMembers = function() {
11950 return HashMapImplementation.HashMapImplementation$from$factory(this.members); 12166 return HashMapImplementation.HashMapImplementation$from$factory(this.members);
11951 } 12167 }
11952 DefinedType.prototype.markUsed = function() { 12168 DefinedType.prototype.markUsed = function() {
11953 if (this.isUsed) return; 12169 if (this.isUsed) return;
11954 this.isUsed = true; 12170 this.isUsed = true;
11955 this._checkExtends(); 12171 this._checkExtends();
11956 if (this._lazyGenMethods != null) { 12172 if (this._lazyGenMethods != null) {
11957 var $$list = orderValuesByKeys(this._lazyGenMethods); 12173 var $$list = orderValuesByKeys(this._lazyGenMethods);
11958 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 12174 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
11959 var method = $$list[$$i]; 12175 var method = $$list.$index($$i);
11960 $globals.world.gen.genMethod(method); 12176 $globals.world.gen.genMethod(method);
11961 } 12177 }
11962 this._lazyGenMethods = null; 12178 this._lazyGenMethods = null;
11963 } 12179 }
11964 if (this.get$parent() != null) this.get$parent().markUsed(); 12180 if (this.get$parent() != null) this.get$parent().markUsed();
11965 } 12181 }
11966 DefinedType.prototype.genMethod = function(method) { 12182 DefinedType.prototype.genMethod = function(method) {
11967 if (this.isUsed) { 12183 if (this.isUsed) {
11968 $globals.world.gen.genMethod(method); 12184 $globals.world.gen.genMethod(method);
11969 } 12185 }
11970 else if (this.isClass) { 12186 else if (this.isClass) {
11971 if (this._lazyGenMethods == null) this._lazyGenMethods = new HashMapImplemen tation(); 12187 if (this._lazyGenMethods == null) this._lazyGenMethods = new HashMapImplemen tation();
11972 this._lazyGenMethods.$setindex(method.name, method); 12188 this._lazyGenMethods.$setindex(method.name, method);
11973 } 12189 }
11974 } 12190 }
11975 DefinedType.prototype._resolveInterfaces = function(types) { 12191 DefinedType.prototype._resolveInterfaces = function(types) {
11976 if (types == null) return []; 12192 if (types == null) return [];
11977 var interfaces = []; 12193 var interfaces = [];
11978 for (var $$i = 0;$$i < types.get$length(); $$i++) { 12194 for (var $$i = 0;$$i < types.get$length(); $$i++) {
11979 var type = types[$$i]; 12195 var type = types.$index($$i);
11980 var resolvedInterface = this.resolveType$2(type, true); 12196 var resolvedInterface = this.resolveType$2(type, true);
11981 if (resolvedInterface.get$isClosed() && !(this.library.get$isCore() || this. library.get$isCoreImpl())) { 12197 if (resolvedInterface.get$isClosed() && !(this.library.get$isCore() || this. library.get$isCoreImpl())) {
11982 $globals.world.error(("can not implement \"" + resolvedInterface.get$name( ) + "\": ") + "only native implementation allowed", type.get$span()); 12198 $globals.world.error(("can not implement \"" + resolvedInterface.get$name( ) + "\": ") + "only native implementation allowed", type.get$span());
11983 } 12199 }
11984 resolvedInterface.addDirectSubtype$1(this); 12200 resolvedInterface.addDirectSubtype$1(this);
11985 interfaces.add$1(resolvedInterface); 12201 interfaces.add$1(resolvedInterface);
11986 } 12202 }
11987 return interfaces; 12203 return interfaces;
11988 } 12204 }
11989 DefinedType.prototype.addDirectSubtype = function(type) { 12205 DefinedType.prototype.addDirectSubtype = function(type) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
12025 if (ancestor == null) return false; 12241 if (ancestor == null) return false;
12026 if (ancestor == $this) return true; 12242 if (ancestor == $this) return true;
12027 if (seen.contains$1(ancestor)) { 12243 if (seen.contains$1(ancestor)) {
12028 return false; 12244 return false;
12029 } 12245 }
12030 seen.add$1(ancestor); 12246 seen.add$1(ancestor);
12031 if (ancestor.get$interfaces() != null) { 12247 if (ancestor.get$interfaces() != null) {
12032 var $$list = ancestor.get$interfaces(); 12248 var $$list = ancestor.get$interfaces();
12033 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 12249 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
12034 var parent = $$i.next$0(); 12250 var parent = $$i.next$0();
12035 if (_helper.call$1(parent)) return true; 12251 if (_helper(parent)) return true;
12036 } 12252 }
12037 } 12253 }
12038 return false; 12254 return false;
12039 } 12255 }
12040 for (var i = (0); 12256 for (var i = (0);
12041 i < this.interfaces.get$length(); i++) { 12257 i < this.interfaces.get$length(); i++) {
12042 if (_helper.call$1(this.interfaces[i])) return i; 12258 if (_helper(this.interfaces.$index(i))) return i;
12043 } 12259 }
12044 return (-1); 12260 return (-1);
12045 } 12261 }
12046 DefinedType.prototype.resolve = function() { 12262 DefinedType.prototype.resolve = function() {
12047 if ((this.definition instanceof TypeDefinition)) { 12263 if ((this.definition instanceof TypeDefinition)) {
12048 var typeDef = this.definition; 12264 var typeDef = this.definition;
12049 if (this.isClass) { 12265 if (this.isClass) {
12050 if (typeDef.extendsTypes != null && typeDef.extendsTypes.get$length() > (0 )) { 12266 if (typeDef.extendsTypes != null && typeDef.extendsTypes.get$length() > (0 )) {
12051 if (typeDef.extendsTypes.get$length() > (1)) { 12267 if (typeDef.extendsTypes.get$length() > (1)) {
12052 $globals.world.error("more than one base class", typeDef.extendsTypes[ (1)].get$span()); 12268 $globals.world.error("more than one base class", typeDef.extendsTypes. $index((1)).get$span());
12053 } 12269 }
12054 var extendsTypeRef = typeDef.extendsTypes[(0)]; 12270 var extendsTypeRef = typeDef.extendsTypes.$index((0));
12055 if ((extendsTypeRef instanceof GenericTypeReference)) { 12271 if ((extendsTypeRef instanceof GenericTypeReference)) {
12056 var g = extendsTypeRef; 12272 var g = extendsTypeRef;
12057 this.set$parent(this.resolveType$2(g.baseType, true)); 12273 this.set$parent(this.resolveType$2(g.baseType, true));
12058 } 12274 }
12059 this.set$parent(this.resolveType$2(extendsTypeRef, true)); 12275 this.set$parent(this.resolveType$2(extendsTypeRef, true));
12060 if (!this.get$parent().get$isClass()) { 12276 if (!this.get$parent().get$isClass()) {
12061 $globals.world.error("class may not extend an interface - use implemen ts", typeDef.extendsTypes[(0)].get$span()); 12277 $globals.world.error("class may not extend an interface - use implemen ts", typeDef.extendsTypes.$index((0)).get$span());
12062 } 12278 }
12063 this.get$parent().addDirectSubtype$1(this); 12279 this.get$parent().addDirectSubtype$1(this);
12064 if (this._cycleInClassExtends()) { 12280 if (this._cycleInClassExtends()) {
12065 $globals.world.error(("class \"" + this.name + "\" has a cycle in its inheritance chain"), extendsTypeRef.get$span()); 12281 $globals.world.error(("class \"" + this.name + "\" has a cycle in its inheritance chain"), extendsTypeRef.get$span());
12066 } 12282 }
12067 } 12283 }
12068 else { 12284 else {
12069 if (!this.get$isObject()) { 12285 if (!this.get$isObject()) {
12070 this.set$parent($globals.world.objectType); 12286 this.set$parent($globals.world.objectType);
12071 this.get$parent().addDirectSubtype$1(this); 12287 this.get$parent().addDirectSubtype$1(this);
12072 } 12288 }
12073 } 12289 }
12074 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes); 12290 this.interfaces = this._resolveInterfaces(typeDef.implementsTypes);
12075 if (typeDef.defaultType != null) { 12291 if (typeDef.defaultType != null) {
12076 $globals.world.error("default not allowed on classes", typeDef.defaultTy pe.span); 12292 $globals.world.error("default not allowed on classes", typeDef.defaultTy pe.span);
12077 } 12293 }
12078 } 12294 }
12079 else { 12295 else {
12080 if (typeDef.implementsTypes != null && typeDef.implementsTypes.get$length( ) > (0)) { 12296 if (typeDef.implementsTypes != null && typeDef.implementsTypes.get$length( ) > (0)) {
12081 $globals.world.error("implements not allowed on interfaces (use extends) ", typeDef.implementsTypes[(0)].get$span()); 12297 $globals.world.error("implements not allowed on interfaces (use extends) ", typeDef.implementsTypes.$index((0)).get$span());
12082 } 12298 }
12083 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes); 12299 this.interfaces = this._resolveInterfaces(typeDef.extendsTypes);
12084 var res = this._cycleInInterfaceExtends(); 12300 var res = this._cycleInInterfaceExtends();
12085 if (res >= (0)) { 12301 if (res >= (0)) {
12086 $globals.world.error(("interface \"" + this.name + "\" has a cycle in it s inheritance chain"), typeDef.extendsTypes[res].get$span()); 12302 $globals.world.error(("interface \"" + this.name + "\" has a cycle in it s inheritance chain"), typeDef.extendsTypes.$index(res).get$span());
12087 } 12303 }
12088 if (typeDef.defaultType != null) { 12304 if (typeDef.defaultType != null) {
12089 this.defaultType = this.resolveType$2(typeDef.defaultType.baseType, true ); 12305 this.defaultType = this.resolveType$2(typeDef.defaultType.baseType, true );
12090 if (this.defaultType == null) { 12306 if (this.defaultType == null) {
12091 $globals.world.warning("unresolved default class", typeDef.defaultType .span); 12307 $globals.world.warning("unresolved default class", typeDef.defaultType .span);
12092 } 12308 }
12093 else { 12309 else {
12094 this.defaultType._resolveTypeParams(typeDef.defaultType.typeParameters ); 12310 this.defaultType._resolveTypeParams(typeDef.defaultType.typeParameters );
12095 } 12311 }
12096 } 12312 }
12097 } 12313 }
12098 } 12314 }
12099 else if ((this.definition instanceof FunctionTypeDefinition)) { 12315 else if ((this.definition instanceof FunctionTypeDefinition)) {
12100 this.interfaces = [$globals.world.functionType]; 12316 this.interfaces = [$globals.world.functionType];
12101 } 12317 }
12102 this._resolveTypeParams(this.typeParameters); 12318 this._resolveTypeParams(this.typeParameters);
12103 if (this.get$isObject()) this._createNotEqualMember(); 12319 if (this.get$isObject()) this._createNotEqualMember();
12104 $globals.world._addType(this); 12320 $globals.world._addType(this);
12105 var $$list = this.constructors.getValues(); 12321 var $$list = this.constructors.getValues$0();
12106 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 12322 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
12107 var c = $$i.next$0(); 12323 var c = $$i.next$0();
12108 c.resolve$0(); 12324 c.resolve$0();
12109 } 12325 }
12110 var $$list = this.members.getValues(); 12326 var $$list = this.members.getValues$0();
12111 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 12327 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
12112 var m = $$i.next$0(); 12328 var m = $$i.next$0();
12113 m.resolve$0(); 12329 m.resolve$0();
12114 } 12330 }
12115 this.factories.forEach((function (f) { 12331 this.factories.forEach((function (f) {
12116 return f.resolve$0(); 12332 return f.resolve$0();
12117 }) 12333 })
12118 ); 12334 );
12119 if (this.get$isJsGlobalObject()) { 12335 if (this.get$isJsGlobalObject()) {
12120 var $$list = this.members.getValues(); 12336 var $$list = this.members.getValues$0();
12121 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 12337 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
12122 var m = $$i.next$0(); 12338 var m = $$i.next$0();
12123 if (!m.get$isStatic()) $globals.world._addTopName(new ExistingJsGlobal(m.g et$name(), m)); 12339 if (!m.get$isStatic()) $globals.world._addTopName(new ExistingJsGlobal(m.g et$name(), m));
12124 } 12340 }
12125 } 12341 }
12126 } 12342 }
12127 DefinedType.prototype._resolveTypeParams = function(params) { 12343 DefinedType.prototype._resolveTypeParams = function(params) {
12128 if (params == null) return; 12344 if (params == null) return;
12129 for (var $$i = 0;$$i < params.get$length(); $$i++) { 12345 for (var $$i = 0;$$i < params.get$length(); $$i++) {
12130 var tp = params[$$i]; 12346 var tp = params.$index($$i);
12131 tp.set$enclosingElement(this); 12347 tp.set$enclosingElement(this);
12132 tp.resolve$0(); 12348 tp.resolve$0();
12133 } 12349 }
12134 } 12350 }
12135 DefinedType.prototype.addMethod = function(methodName, definition) { 12351 DefinedType.prototype.addMethod = function(methodName, definition) {
12136 if (methodName == null) methodName = definition.name.name; 12352 if (methodName == null) methodName = definition.name.name;
12137 var method = new MethodMember(methodName, this, definition); 12353 var method = new MethodMember(methodName, this, definition);
12138 if (method.get$isConstructor()) { 12354 if (method.get$isConstructor()) {
12139 if (this.constructors.containsKey(method.get$constructorName())) { 12355 if (this.constructors.containsKey(method.get$constructorName())) {
12140 $globals.world.error(("duplicate constructor definition of " + method.get$ name()), definition.span); 12356 $globals.world.error(("duplicate constructor definition of " + method.get$ name()), definition.span);
12141 return; 12357 return;
12142 } 12358 }
12143 this.constructors.$setindex(method.get$constructorName(), method); 12359 this.constructors.$setindex(method.get$constructorName(), method);
12144 return; 12360 return;
12145 } 12361 }
12146 if (definition.modifiers != null && definition.modifiers.get$length() == (1) & & $eq(definition.modifiers[(0)].get$kind(), (74))) { 12362 if (definition.modifiers != null && definition.modifiers.get$length() == (1) & & $eq(definition.modifiers.$index((0)).get$kind(), (74))) {
12147 if (this.factories.getFactory(method.get$constructorName(), method.get$name( )) != null) { 12363 if (this.factories.getFactory(method.get$constructorName(), method.get$name( )) != null) {
12148 $globals.world.error(("duplicate factory definition of \"" + method.get$na me() + "\""), definition.span); 12364 $globals.world.error(("duplicate factory definition of \"" + method.get$na me() + "\""), definition.span);
12149 return; 12365 return;
12150 } 12366 }
12151 this.factories.addFactory(method.get$constructorName(), method.get$name(), m ethod); 12367 this.factories.addFactory(method.get$constructorName(), method.get$name(), m ethod);
12152 return; 12368 return;
12153 } 12369 }
12154 if (methodName.startsWith("get:") || methodName.startsWith("set:")) { 12370 if (methodName.startsWith("get:") || methodName.startsWith("set:")) {
12155 var propName = methodName.substring((4)); 12371 var propName = methodName.substring((4));
12156 var prop = this.members.$index(propName); 12372 var prop = this.members.$index(propName);
(...skipping 21 matching lines...) Expand all
12178 } 12394 }
12179 if (this.members.containsKey(methodName)) { 12395 if (this.members.containsKey(methodName)) {
12180 $globals.world.error(("duplicate method definition of \"" + method.get$name( ) + "\""), definition.span); 12396 $globals.world.error(("duplicate method definition of \"" + method.get$name( ) + "\""), definition.span);
12181 return; 12397 return;
12182 } 12398 }
12183 this.members.$setindex(methodName, method); 12399 this.members.$setindex(methodName, method);
12184 } 12400 }
12185 DefinedType.prototype.addField = function(definition) { 12401 DefinedType.prototype.addField = function(definition) {
12186 for (var i = (0); 12402 for (var i = (0);
12187 i < definition.names.get$length(); i++) { 12403 i < definition.names.get$length(); i++) {
12188 var name = definition.names[i].get$name(); 12404 var name = definition.names.$index(i).get$name();
12189 if (this.members.containsKey(name)) { 12405 if (this.members.containsKey(name)) {
12190 $globals.world.error(("duplicate field definition of \"" + name + "\""), d efinition.span); 12406 $globals.world.error(("duplicate field definition of \"" + name + "\""), d efinition.span);
12191 return; 12407 return;
12192 } 12408 }
12193 var value = null; 12409 var value = null;
12194 if (definition.values != null) { 12410 if (definition.values != null) {
12195 value = definition.values[i]; 12411 value = definition.values.$index(i);
12196 } 12412 }
12197 var field = new FieldMember(name, this, definition, value); 12413 var field = new FieldMember(name, this, definition, value);
12198 this.members.$setindex(name, field); 12414 this.members.$setindex(name, field);
12199 if (this.isNative) { 12415 if (this.isNative) {
12200 field.set$isNative(true); 12416 field.set$isNative(true);
12201 } 12417 }
12202 } 12418 }
12203 } 12419 }
12204 DefinedType.prototype.getFactory = function(type, constructorName) { 12420 DefinedType.prototype.getFactory = function(type, constructorName) {
12205 var ret = this.factories.getFactory(type.name, constructorName); 12421 var ret = this.factories.getFactory(type.name, constructorName);
(...skipping 18 matching lines...) Expand all
12224 return this._tryCreateDefaultConstructor(constructorName); 12440 return this._tryCreateDefaultConstructor(constructorName);
12225 } 12441 }
12226 DefinedType.prototype._checkDefaultTypeParams = function() { 12442 DefinedType.prototype._checkDefaultTypeParams = function() {
12227 function toList(list) { 12443 function toList(list) {
12228 return (list != null ? list : const$0008); 12444 return (list != null ? list : const$0008);
12229 } 12445 }
12230 var typeDef = this.definition; 12446 var typeDef = this.definition;
12231 if (typeDef.defaultType.oldFactory) { 12447 if (typeDef.defaultType.oldFactory) {
12232 return; 12448 return;
12233 } 12449 }
12234 var interfaceParams = toList.call$1(this.typeParameters); 12450 var interfaceParams = toList(this.typeParameters);
12235 var defaultParams = toList.call$1(typeDef.defaultType.typeParameters); 12451 var defaultParams = toList(typeDef.defaultType.typeParameters);
12236 var classParams = toList.call$1(this.defaultType.typeParameters); 12452 var classParams = toList(this.defaultType.typeParameters);
12237 if ($ne(interfaceParams.get$length(), defaultParams.get$length()) || $ne(defau ltParams.get$length(), classParams.get$length())) { 12453 if ($ne(interfaceParams.get$length(), defaultParams.get$length()) || $ne(defau ltParams.get$length(), classParams.get$length())) {
12238 $globals.world.error("\"default\" must have the same number of type paramete rs as the class and interface do", this.get$span(), typeDef.defaultType.span, th is.defaultType.get$span()); 12454 $globals.world.error("\"default\" must have the same number of type paramete rs as the class and interface do", this.get$span(), typeDef.defaultType.span, th is.defaultType.get$span());
12239 return; 12455 return;
12240 } 12456 }
12241 for (var i = (0); 12457 for (var i = (0);
12242 i < interfaceParams.get$length(); i++) { 12458 i < interfaceParams.get$length(); i++) {
12243 var ip = interfaceParams.$index(i); 12459 var ip = interfaceParams.$index(i);
12244 var dp = defaultParams.$index(i); 12460 var dp = defaultParams.$index(i);
12245 var cp = classParams.$index(i); 12461 var cp = classParams.$index(i);
12246 dp.resolve$0(); 12462 dp.resolve$0();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
12298 } 12514 }
12299 DefinedType.prototype.resolveTypeParams = function(inType) { 12515 DefinedType.prototype.resolveTypeParams = function(inType) {
12300 return this; 12516 return this;
12301 } 12517 }
12302 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) { 12518 DefinedType.prototype.getOrMakeConcreteType = function(typeArgs) {
12303 var jsnames = []; 12519 var jsnames = [];
12304 var names = []; 12520 var names = [];
12305 var typeMap = new HashMapImplementation(); 12521 var typeMap = new HashMapImplementation();
12306 for (var i = (0); 12522 for (var i = (0);
12307 i < typeArgs.get$length(); i++) { 12523 i < typeArgs.get$length(); i++) {
12308 var paramName = this.typeParameters[i].get$name(); 12524 var paramName = this.typeParameters.$index(i).get$name();
12309 typeMap.$setindex(paramName, typeArgs[i]); 12525 typeMap.$setindex(paramName, typeArgs.$index(i));
12310 names.add$1(typeArgs[i].get$name()); 12526 names.add$1(typeArgs.$index(i).get$name());
12311 jsnames.add$1(typeArgs[i].get$jsname()); 12527 jsnames.add$1(typeArgs.$index(i).get$jsname());
12312 } 12528 }
12313 var jsname = ("" + this.get$jsname() + "_" + Strings.join(jsnames, "$")); 12529 var jsname = ("" + this.get$jsname() + "_" + Strings.join(jsnames, "$"));
12314 var simpleName = ("" + this.name + "<" + Strings.join(names, ", ") + ">"); 12530 var simpleName = ("" + this.name + "<" + Strings.join(names, ", ") + ">");
12315 var key = Strings.join(names, "$"); 12531 var key = Strings.join(names, "$");
12316 var ret = this._concreteTypes.$index(key); 12532 var ret = this._concreteTypes.$index(key);
12317 if (ret == null) { 12533 if (ret == null) {
12318 ret = new ConcreteType(simpleName, this, typeMap, typeArgs); 12534 ret = new ConcreteType(simpleName, this, typeMap, typeArgs);
12319 ret.set$_jsname(jsname); 12535 ret.set$_jsname(jsname);
12320 this._concreteTypes.$setindex(key, ret); 12536 this._concreteTypes.$setindex(key, ret);
12321 } 12537 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
12384 } 12600 }
12385 FixedCollection.prototype.every = function(f) { 12601 FixedCollection.prototype.every = function(f) {
12386 return Collections.every(this, f); 12602 return Collections.every(this, f);
12387 } 12603 }
12388 FixedCollection.prototype.some = function(f) { 12604 FixedCollection.prototype.some = function(f) {
12389 return Collections.some(this, f); 12605 return Collections.some(this, f);
12390 } 12606 }
12391 FixedCollection.prototype.isEmpty = function() { 12607 FixedCollection.prototype.isEmpty = function() {
12392 return this.length == (0); 12608 return this.length == (0);
12393 } 12609 }
12610 FixedCollection.prototype.every$1 = function($0) {
12611 return this.every(to$call$1($0));
12612 };
12394 FixedCollection.prototype.filter$1 = function($0) { 12613 FixedCollection.prototype.filter$1 = function($0) {
12395 return this.filter(to$call$1($0)); 12614 return this.filter(to$call$1($0));
12396 }; 12615 };
12397 FixedCollection.prototype.forEach$1 = function($0) { 12616 FixedCollection.prototype.forEach$1 = function($0) {
12398 return this.forEach(to$call$1($0)); 12617 return this.forEach(to$call$1($0));
12399 }; 12618 };
12400 FixedCollection.prototype.isEmpty$0 = FixedCollection.prototype.isEmpty; 12619 FixedCollection.prototype.isEmpty$0 = FixedCollection.prototype.isEmpty;
12401 FixedCollection.prototype.iterator$0 = FixedCollection.prototype.iterator; 12620 FixedCollection.prototype.iterator$0 = FixedCollection.prototype.iterator;
12621 FixedCollection.prototype.some$1 = function($0) {
12622 return this.some(to$call$1($0));
12623 };
12402 // ********** Code for FixedCollection_Type ************** 12624 // ********** Code for FixedCollection_Type **************
12403 $inherits(FixedCollection_Type, FixedCollection); 12625 $inherits(FixedCollection_Type, FixedCollection);
12404 function FixedCollection_Type(value, length) { 12626 function FixedCollection_Type(value, length) {
12405 this.value = value; 12627 this.value = value;
12406 this.length = length; 12628 this.length = length;
12407 } 12629 }
12408 // ********** Code for FixedIterator ************** 12630 // ********** Code for FixedIterator **************
12409 function FixedIterator(value, length) { 12631 function FixedIterator(value, length) {
12410 this.length = length; 12632 this.length = length;
12411 this._index = (0); 12633 this._index = (0);
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
12913 $globals.world.gen.corejs.useThrow = true; 13135 $globals.world.gen.corejs.useThrow = true;
12914 return ("$throw(" + result.get$code() + ")"); 13136 return ("$throw(" + result.get$code() + ")");
12915 }) 13137 })
12916 ); 13138 );
12917 } 13139 }
12918 if (toType.get$isNum()) toType = $globals.world.numType; 13140 if (toType.get$isNum()) toType = $globals.world.numType;
12919 var check; 13141 var check;
12920 if (toType.get$isVoid()) { 13142 if (toType.get$isVoid()) {
12921 check = ("$assert_void(" + this.get$code() + ")"); 13143 check = ("$assert_void(" + this.get$code() + ")");
12922 if (toType.typeCheckCode == null) { 13144 if (toType.typeCheckCode == null) {
12923 toType.typeCheckCode = ("function $assert_void(x) {\n if (x == null) retu rn null;\n " + throwTypeError.call$1("x") + "\n}"); 13145 toType.typeCheckCode = ("function $assert_void(x) {\n if (x == null) retu rn null;\n " + throwTypeError("x") + "\n}");
12924 } 13146 }
12925 } 13147 }
12926 else if ($eq(toType, $globals.world.nonNullBool)) { 13148 else if ($eq(toType, $globals.world.nonNullBool)) {
12927 $globals.world.gen.corejs.useNotNullBool = true; 13149 $globals.world.gen.corejs.useNotNullBool = true;
12928 check = ("$notnull_bool(" + this.get$code() + ")"); 13150 check = ("$notnull_bool(" + this.get$code() + ")");
12929 } 13151 }
12930 else if (toType.get$library().get$isCore() && toType.get$typeofName() != null) { 13152 else if (toType.get$library().get$isCore() && toType.get$typeofName() != null) {
12931 check = ("$assert_" + toType.name + "(" + this.get$code() + ")"); 13153 check = ("$assert_" + toType.name + "(" + this.get$code() + ")");
12932 if (toType.typeCheckCode == null) { 13154 if (toType.typeCheckCode == null) {
12933 toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if ( x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n " + throwTypeError.call$1("x") + "\n}"); 13155 toType.typeCheckCode = ("function $assert_" + toType.name + "(x) {\n if ( x == null || typeof(x) == \"" + toType.get$typeofName() + "\") return x;\n " + throwTypeError("x") + "\n}");
12934 } 13156 }
12935 } 13157 }
12936 else { 13158 else {
12937 toType.isChecked = true; 13159 toType.isChecked = true;
12938 var checkName = "assert$" + toType.get$jsname(); 13160 var checkName = "assert$" + toType.get$jsname();
12939 var temp = context.getTemp(this); 13161 var temp = context.getTemp(this);
12940 check = ("(" + context.assignTemp(temp, this).get$code() + " == null ? null :"); 13162 check = ("(" + context.assignTemp(temp, this).get$code() + " == null ? null :");
12941 check = check + (" " + temp.get$code() + "." + checkName + "())"); 13163 check = check + (" " + temp.get$code() + "." + checkName + "())");
12942 if ($ne(this, temp)) context.freeTemp(temp); 13164 if ($ne(this, temp)) context.freeTemp(temp);
12943 $globals.world.objectType.varStubs.putIfAbsent(checkName, (function () { 13165 $globals.world.objectType.varStubs.putIfAbsent(checkName, (function () {
12944 return new VarMethodStub(checkName, null, Arguments.get$EMPTY(), throwType Error.call$1("this")); 13166 return new VarMethodStub(checkName, null, Arguments.get$EMPTY(), throwType Error("this"));
12945 }) 13167 })
12946 ); 13168 );
12947 } 13169 }
12948 context.counters.typeAsserts++; 13170 context.counters.typeAsserts++;
12949 return new Value(toType, check, this.span); 13171 return new Value(toType, check, this.span);
12950 } 13172 }
12951 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) { 13173 Value.prototype.instanceOf = function(context, toType, span, isTrue, forceCheck) {
12952 if (toType.get$isVar()) { 13174 if (toType.get$isVar()) {
12953 $globals.world.error("can not resolve type", span); 13175 $globals.world.error("can not resolve type", span);
12954 } 13176 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
12998 } 13220 }
12999 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) { 13221 Value.prototype.invokeNoSuchMethod = function(context, name, node, args) {
13000 if (this.get$isType()) { 13222 if (this.get$isType()) {
13001 $globals.world.error(("member lookup failed for \"" + name + "\""), node.spa n); 13223 $globals.world.error(("member lookup failed for \"" + name + "\""), node.spa n);
13002 } 13224 }
13003 var pos = ""; 13225 var pos = "";
13004 if (args != null) { 13226 if (args != null) {
13005 var argsCode = []; 13227 var argsCode = [];
13006 for (var i = (0); 13228 for (var i = (0);
13007 i < args.get$length(); i++) { 13229 i < args.get$length(); i++) {
13008 argsCode.add$1(args.values[i].get$code()); 13230 argsCode.add$1(args.values.$index(i).get$code());
13009 } 13231 }
13010 pos = Strings.join(argsCode, ", "); 13232 pos = Strings.join(argsCode, ", ");
13011 } 13233 }
13012 var noSuchArgs = [new Value($globals.world.stringType, ("\"" + name + "\""), n ode.span), new Value($globals.world.listType, ("[" + pos + "]"), node.span)]; 13234 var noSuchArgs = [new Value($globals.world.stringType, ("\"" + name + "\""), n ode.span), new Value($globals.world.listType, ("[" + pos + "]"), node.span)];
13013 return this._resolveMember(context, "noSuchMethod", node, false).invoke(contex t, node, this, new Arguments(null, noSuchArgs), false); 13235 return this._resolveMember(context, "noSuchMethod", node, false).invoke(contex t, node, this, new Arguments(null, noSuchArgs), false);
13014 } 13236 }
13015 Value.fromBool = function(value, span) { 13237 Value.fromBool = function(value, span) {
13016 return new BoolValue(value, true, span); 13238 return new BoolValue(value, true, span);
13017 } 13239 }
13018 Value.fromInt = function(value, span) { 13240 Value.fromInt = function(value, span) {
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
13572 function ListValue(values, isConst, type, span) { 13794 function ListValue(values, isConst, type, span) {
13573 this.values = values; 13795 this.values = values;
13574 EvaluatedValue.call(this, isConst, type, span); 13796 EvaluatedValue.call(this, isConst, type, span);
13575 } 13797 }
13576 ListValue.prototype.get$code = function() { 13798 ListValue.prototype.get$code = function() {
13577 var buf = new StringBufferImpl(""); 13799 var buf = new StringBufferImpl("");
13578 buf.add$1("["); 13800 buf.add$1("[");
13579 for (var i = (0); 13801 for (var i = (0);
13580 i < this.values.get$length(); i = $add(i, (1))) { 13802 i < this.values.get$length(); i = $add(i, (1))) {
13581 if (i > (0)) buf.add$1(", "); 13803 if (i > (0)) buf.add$1(", ");
13582 buf.add$1(this.values[i].get$code()); 13804 buf.add$1(this.values.$index(i).get$code());
13583 } 13805 }
13584 buf.add$1("]"); 13806 buf.add$1("]");
13585 var listCode = buf.toString$0(); 13807 var listCode = buf.toString$0();
13586 if (!this.isConst) return listCode; 13808 if (!this.isConst) return listCode;
13587 var v = new Value($globals.world.listType, listCode, this.span); 13809 var v = new Value($globals.world.listType, listCode, this.span);
13588 var immutableListCtor = $globals.world.immutableListType.getConstructor("from" ); 13810 var immutableListCtor = $globals.world.immutableListType.getConstructor("from" );
13589 var result = immutableListCtor.invoke$4(null, null, new TypeValue(v.get$type() , this.span), new Arguments(null, [v])); 13811 var result = immutableListCtor.invoke$4(null, null, new TypeValue(v.get$type() , this.span), new Arguments(null, [v]));
13590 return result.get$code(); 13812 return result.get$code();
13591 } 13813 }
13592 ListValue.prototype.binop = function(kind, other, context, node) { 13814 ListValue.prototype.binop = function(kind, other, context, node) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
13684 else { 13906 else {
13685 this.fields.$setindex(field, value); 13907 this.fields.$setindex(field, value);
13686 } 13908 }
13687 } 13909 }
13688 } 13910 }
13689 ObjectValue.prototype.validateInitialized = function(span) { 13911 ObjectValue.prototype.validateInitialized = function(span) {
13690 var buf = new StringBufferImpl(""); 13912 var buf = new StringBufferImpl("");
13691 buf.add$1("Object.create("); 13913 buf.add$1("Object.create(");
13692 buf.add$1(("" + this.get$type().get$jsname() + ".prototype, ")); 13914 buf.add$1(("" + this.get$type().get$jsname() + ".prototype, "));
13693 buf.add$1("{"); 13915 buf.add$1("{");
13694 var $$list = this.fields.getKeys(); 13916 var $$list = this.fields.getKeys$0();
13695 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 13917 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
13696 var field = $$i.next$0(); 13918 var field = $$i.next$0();
13697 buf.add$1(field.get$name()); 13919 buf.add$1(field.get$name());
13698 buf.add$1(": "); 13920 buf.add$1(": ");
13699 buf.add$1("{\"value\": "); 13921 buf.add$1("{\"value\": ");
13700 if (this.fields.$index(field) == null) { 13922 if (this.fields.$index(field) == null) {
13701 $globals.world.error(("Required field \"" + field.get$name() + "\" was not initialized"), span, field.get$span()); 13923 $globals.world.error(("Required field \"" + field.get$name() + "\" was not initialized"), span, field.get$span());
13702 buf.add$1("null"); 13924 buf.add$1("null");
13703 } 13925 }
13704 else { 13926 else {
(...skipping 25 matching lines...) Expand all
13730 // ********** Code for GlobalValue ************** 13952 // ********** Code for GlobalValue **************
13731 $inherits(GlobalValue, Value); 13953 $inherits(GlobalValue, Value);
13732 function GlobalValue(type, code, isConst, field, name, exp, span, deps) { 13954 function GlobalValue(type, code, isConst, field, name, exp, span, deps) {
13733 this.exp = exp; 13955 this.exp = exp;
13734 this.field = field; 13956 this.field = field;
13735 this.name = name; 13957 this.name = name;
13736 this.dependencies = []; 13958 this.dependencies = [];
13737 this.isConst = isConst; 13959 this.isConst = isConst;
13738 Value.call(this, type, code, span); 13960 Value.call(this, type, code, span);
13739 for (var $$i = 0;$$i < deps.get$length(); $$i++) { 13961 for (var $$i = 0;$$i < deps.get$length(); $$i++) {
13740 var dep = deps[$$i]; 13962 var dep = deps.$index($$i);
13741 if ((dep instanceof GlobalValue)) { 13963 if ((dep instanceof GlobalValue)) {
13742 this.dependencies.add(dep); 13964 this.dependencies.add(dep);
13743 this.dependencies.addAll(dep.get$dependencies()); 13965 this.dependencies.addAll(dep.get$dependencies());
13744 } 13966 }
13745 } 13967 }
13746 } 13968 }
13747 GlobalValue.prototype.get$field = function() { return this.field; }; 13969 GlobalValue.prototype.get$field = function() { return this.field; };
13748 GlobalValue.prototype.get$name = function() { return this.name; }; 13970 GlobalValue.prototype.get$name = function() { return this.name; };
13749 GlobalValue.prototype.get$exp = function() { return this.exp; }; 13971 GlobalValue.prototype.get$exp = function() { return this.exp; };
13750 GlobalValue.prototype.get$isConst = function() { return this.isConst; }; 13972 GlobalValue.prototype.get$isConst = function() { return this.isConst; };
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
14129 this.printStatus(); 14351 this.printStatus();
14130 return !this.get$hasErrors(); 14352 return !this.get$hasErrors();
14131 } 14353 }
14132 World.prototype.runLeg = function() { 14354 World.prototype.runLeg = function() {
14133 var $this = this; // closure support 14355 var $this = this; // closure support
14134 if (!$globals.options.enableLeg) return false; 14356 if (!$globals.options.enableLeg) return false;
14135 if ($globals.legCompile == null) { 14357 if ($globals.legCompile == null) {
14136 this.fatal("requested leg enabled, but no leg compiler available"); 14358 this.fatal("requested leg enabled, but no leg compiler available");
14137 } 14359 }
14138 var res = this.withTiming("try leg compile", (function () { 14360 var res = this.withTiming("try leg compile", (function () {
14139 return $globals.legCompile.call$1($this); 14361 return $globals.legCompile($this);
14140 }) 14362 })
14141 ); 14363 );
14142 if (!res && $globals.options.legOnly) { 14364 if (!res && $globals.options.legOnly) {
14143 this.fatal(("Leg could not compile " + $globals.options.dartScript)); 14365 this.fatal(("Leg could not compile " + $globals.options.dartScript));
14144 return true; 14366 return true;
14145 } 14367 }
14146 return res; 14368 return res;
14147 } 14369 }
14148 World.prototype.runCompilationPhases = function() { 14370 World.prototype.runCompilationPhases = function() {
14149 var $this = this; // closure support 14371 var $this = this; // closure support
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
14208 } 14430 }
14209 } 14431 }
14210 } 14432 }
14211 World.prototype.processDartScript = function(script) { 14433 World.prototype.processDartScript = function(script) {
14212 if (script == null) script = $globals.options.dartScript; 14434 if (script == null) script = $globals.options.dartScript;
14213 var library = this.getOrAddLibrary(script); 14435 var library = this.getOrAddLibrary(script);
14214 this.process(); 14436 this.process();
14215 return library; 14437 return library;
14216 } 14438 }
14217 World.prototype.resolveAll = function() { 14439 World.prototype.resolveAll = function() {
14218 var $$list = this.libraries.getValues(); 14440 var $$list = this.libraries.getValues$0();
14219 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 14441 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
14220 var lib = $$i.next$0(); 14442 var lib = $$i.next$0();
14221 lib.resolve$0(); 14443 lib.resolve$0();
14222 } 14444 }
14223 var $$list = this.libraries.getValues(); 14445 var $$list = this.libraries.getValues$0();
14224 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) { 14446 for (var $$i = $$list.iterator$0(); $$i.hasNext$0(); ) {
14225 var lib = $$i.next$0(); 14447 var lib = $$i.next$0();
14226 lib.postResolveChecks$0(); 14448 lib.postResolveChecks$0();
14227 } 14449 }
14228 } 14450 }
14229 World.prototype.get$resolveAll = function() { 14451 World.prototype.get$resolveAll = function() {
14230 return this.resolveAll.bind(this); 14452 return this.resolveAll.bind(this);
14231 } 14453 }
14232 World.prototype.findMainMethod = function(lib) { 14454 World.prototype.findMainMethod = function(lib) {
14233 var main = lib.lookup("main", lib.get$span()); 14455 var main = lib.lookup("main", lib.get$span());
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
14363 else { 14585 else {
14364 $globals.world.error(("Invalid configuration " + this.config)); 14586 $globals.world.error(("Invalid configuration " + this.config));
14365 $throw("Invalid configuration"); 14587 $throw("Invalid configuration");
14366 } 14588 }
14367 var ignoreUnrecognizedFlags = false; 14589 var ignoreUnrecognizedFlags = false;
14368 var passedLibDir = false; 14590 var passedLibDir = false;
14369 this.childArgs = []; 14591 this.childArgs = [];
14370 loop: 14592 loop:
14371 for (var i = (2); 14593 for (var i = (2);
14372 i < args.get$length(); i++) { 14594 i < args.get$length(); i++) {
14373 var arg = args[i]; 14595 var arg = args.$index(i);
14374 switch (arg) { 14596 switch (arg) {
14375 case "--enable_leg": 14597 case "--enable_leg":
14376 14598
14377 this.enableLeg = true; 14599 this.enableLeg = true;
14378 break; 14600 break;
14379 14601
14380 case "--leg_only": 14602 case "--leg_only":
14381 14603
14382 this.enableLeg = true; 14604 this.enableLeg = true;
14383 this.legOnly = true; 14605 this.legOnly = true;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
14456 14678
14457 case "--Xinfer_types": 14679 case "--Xinfer_types":
14458 14680
14459 this.inferTypes = true; 14681 this.inferTypes = true;
14460 break; 14682 break;
14461 14683
14462 default: 14684 default:
14463 14685
14464 if (arg.endsWith$1(".dart")) { 14686 if (arg.endsWith$1(".dart")) {
14465 this.dartScript = arg; 14687 this.dartScript = arg;
14466 this.childArgs = args.getRange(i + (1), args.get$length() - i - (1)); 14688 this.childArgs = args.getRange$2(i + (1), args.get$length() - i - (1)) ;
14467 break loop; 14689 break loop;
14468 } 14690 }
14469 else if (arg.startsWith$1("--out=")) { 14691 else if (arg.startsWith$1("--out=")) {
14470 this.outfile = arg.substring$1("--out=".length); 14692 this.outfile = arg.substring$1("--out=".length);
14471 } 14693 }
14472 else if (arg.startsWith$1("--libdir=")) { 14694 else if (arg.startsWith$1("--libdir=")) {
14473 this.libDir = arg.substring$1("--libdir=".length); 14695 this.libDir = arg.substring$1("--libdir=".length);
14474 passedLibDir = true; 14696 passedLibDir = true;
14475 } 14697 }
14476 else { 14698 else {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
14628 ).get$length() >= (1); 14850 ).get$length() >= (1);
14629 } 14851 }
14630 VarMethodStub.prototype._useDirectCall = function(args) { 14852 VarMethodStub.prototype._useDirectCall = function(args) {
14631 if ((this.member instanceof MethodMember) && !this.member.declaringType.get$ha sNativeSubtypes()) { 14853 if ((this.member instanceof MethodMember) && !this.member.declaringType.get$ha sNativeSubtypes()) {
14632 var method = this.member; 14854 var method = this.member;
14633 if (method.needsArgumentConversion(args)) { 14855 if (method.needsArgumentConversion(args)) {
14634 return false; 14856 return false;
14635 } 14857 }
14636 for (var i = args.get$length(); 14858 for (var i = args.get$length();
14637 i < method.parameters.get$length(); i++) { 14859 i < method.parameters.get$length(); i++) {
14638 if ($ne(method.parameters[i].get$value().get$code(), "null")) { 14860 if ($ne(method.parameters.$index(i).get$value().get$code(), "null")) {
14639 return false; 14861 return false;
14640 } 14862 }
14641 } 14863 }
14642 return method.namesInHomePositions(args); 14864 return method.namesInHomePositions(args);
14643 } 14865 }
14644 else { 14866 else {
14645 return false; 14867 return false;
14646 } 14868 }
14647 } 14869 }
14648 VarMethodStub.prototype.generate$1 = VarMethodStub.prototype.generate; 14870 VarMethodStub.prototype.generate$1 = VarMethodStub.prototype.generate;
(...skipping 12 matching lines...) Expand all
14661 VarMethodSet.prototype.invoke = function(context, node, target, args) { 14883 VarMethodSet.prototype.invoke = function(context, node, target, args) {
14662 this._invokeMembers(context, node); 14884 this._invokeMembers(context, node);
14663 return VarMember.prototype.invoke.call(this, context, node, target, args); 14885 return VarMember.prototype.invoke.call(this, context, node, target, args);
14664 } 14886 }
14665 VarMethodSet.prototype._invokeMembers = function(context, node) { 14887 VarMethodSet.prototype._invokeMembers = function(context, node) {
14666 if (this.invoked) return; 14888 if (this.invoked) return;
14667 this.invoked = true; 14889 this.invoked = true;
14668 var hasObjectType = false; 14890 var hasObjectType = false;
14669 var $$list = this.members; 14891 var $$list = this.members;
14670 for (var $$i = 0;$$i < $$list.get$length(); $$i++) { 14892 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
14671 var member = $$list[$$i]; 14893 var member = $$list.$index($$i);
14672 var type = member.get$declaringType(); 14894 var type = member.get$declaringType();
14673 var target = new Value(type, "this", node.span); 14895 var target = new Value(type, "this", node.span);
14674 var result = member.invoke$4$isDynamic(context, node, target, this.args, tru e); 14896 var result = member.invoke$4$isDynamic(context, node, target, this.args, tru e);
14675 var stub = new VarMethodStub(this.name, member, this.args, "return " + resul t.get$code()); 14897 var stub = new VarMethodStub(this.name, member, this.args, "return " + resul t.get$code());
14676 type.get$varStubs().$setindex(stub.get$name(), stub); 14898 type.get$varStubs().$setindex(stub.get$name(), stub);
14677 if (type.get$isObject()) hasObjectType = true; 14899 if (type.get$isObject()) hasObjectType = true;
14678 } 14900 }
14679 if (!hasObjectType) { 14901 if (!hasObjectType) {
14680 var target = new Value($globals.world.objectType, "this", node.span); 14902 var target = new Value($globals.world.objectType, "this", node.span);
14681 var result = target.invokeNoSuchMethod$4(context, this.baseName, node, this. args); 14903 var result = target.invokeNoSuchMethod$4(context, this.baseName, node, this. args);
(...skipping 10 matching lines...) Expand all
14692 function _otherOperator(jsname, op) { 14914 function _otherOperator(jsname, op) {
14693 return ("function " + jsname + "(x, y) {\n return (typeof(x) == 'number' && t ypeof(y) == 'number')\n ? x " + op + " y : x." + jsname + "(y);\n}"); 14915 return ("function " + jsname + "(x, y) {\n return (typeof(x) == 'number' && t ypeof(y) == 'number')\n ? x " + op + " y : x." + jsname + "(y);\n}");
14694 } 14916 }
14695 function map(source, mapper) { 14917 function map(source, mapper) {
14696 var result = new Array(); 14918 var result = new Array();
14697 if (!!(source && source.is$List())) { 14919 if (!!(source && source.is$List())) {
14698 var list = source; 14920 var list = source;
14699 result.set$length(list.get$length()); 14921 result.set$length(list.get$length());
14700 for (var i = (0); 14922 for (var i = (0);
14701 i < list.get$length(); i++) { 14923 i < list.get$length(); i++) {
14702 result.$setindex(i, mapper.call$1(list[i])); 14924 result.$setindex(i, mapper(list.$index(i)));
14703 } 14925 }
14704 } 14926 }
14705 else { 14927 else {
14706 for (var $$i = source.iterator$0(); $$i.hasNext$0(); ) { 14928 for (var $$i = source.iterator$0(); $$i.hasNext$0(); ) {
14707 var item = $$i.next$0(); 14929 var item = $$i.next$0();
14708 result.add(mapper.call$1(item)); 14930 result.add(mapper(item));
14709 } 14931 }
14710 } 14932 }
14711 return result; 14933 return result;
14712 } 14934 }
14713 function reduce(source, callback, initialValue) { 14935 function reduce(source, callback, initialValue) {
14714 var i = source.iterator$0(); 14936 var i = source.iterator$0();
14715 var current = initialValue; 14937 var current = initialValue;
14716 if (current == null && i.hasNext$0()) { 14938 if (current == null && i.hasNext$0()) {
14717 current = i.next$0(); 14939 current = i.next$0();
14718 } 14940 }
14719 while (i.hasNext$0()) { 14941 while (i.hasNext$0()) {
14720 current = callback.call$2(current, i.next$0()); 14942 current = callback.call$2(current, i.next$0());
14721 } 14943 }
14722 return current; 14944 return current;
14723 } 14945 }
14724 function orderValuesByKeys(map) { 14946 function orderValuesByKeys(map) {
14725 var keys = map.getKeys(); 14947 var keys = map.getKeys$0();
14726 keys.sort((function (x, y) { 14948 keys.sort((function (x, y) {
14727 return x.compareTo$1(y); 14949 return x.compareTo$1(y);
14728 }) 14950 })
14729 ); 14951 );
14730 var values = []; 14952 var values = [];
14731 for (var $$i = 0;$$i < keys.get$length(); $$i++) { 14953 for (var $$i = 0;$$i < keys.get$length(); $$i++) {
14732 var k = keys[$$i]; 14954 var k = keys.$index($$i);
14733 values.add$1(map.$index(k)); 14955 values.add$1(map.$index(k));
14734 } 14956 }
14735 return values; 14957 return values;
14736 } 14958 }
14737 var world; 14959 var world;
14738 var experimentalAwaitPhase; 14960 var experimentalAwaitPhase;
14739 var legCompile; 14961 var legCompile;
14740 function initializeWorld(files) { 14962 function initializeWorld(files) {
14741 $globals.world = new World(files); 14963 $globals.world = new World(files);
14742 $globals.world.init(); 14964 $globals.world.init();
(...skipping 16 matching lines...) Expand all
14759 if (name0.contains$1("$")) { 14981 if (name0.contains$1("$")) {
14760 nameBuilder.add$1(("" + name0.get$length())); 14982 nameBuilder.add$1(("" + name0.get$length()));
14761 } 14983 }
14762 nameBuilder.add$1(name0); 14984 nameBuilder.add$1(name0);
14763 } 14985 }
14764 return nameBuilder.toString$0(); 14986 return nameBuilder.toString$0();
14765 } 14987 }
14766 // ********** Library minfrog ************** 14988 // ********** Library minfrog **************
14767 // ********** Code for top level ************** 14989 // ********** Code for top level **************
14768 function main() { 14990 function main() {
14769 var homedir = path.dirname(fs.realpathSync(get$process().get$argv()[(1)])); 14991 var homedir = path.dirname(get$fs().realpathSync(get$process().get$argv().$ind ex((1))));
14770 var argv = []; 14992 var argv = [];
14771 for (var i = (0); 14993 for (var i = (0);
14772 i < get$process().get$argv().get$length(); i++) { 14994 i < get$process().get$argv().get$length(); i++) {
14773 argv.add$1(get$process().get$argv()[i]); 14995 argv.add$1(get$process().get$argv().$index(i));
14774 if (i == (1)) { 14996 if (i == (1)) {
14775 var terminal = get$process().get$env().$index("TERM"); 14997 var terminal = get$process().get$env().$index("TERM");
14776 if (terminal == null || !terminal.startsWith$1("xterm")) { 14998 if (terminal == null || !terminal.startsWith$1("xterm")) {
14777 argv.add$1("--no_colors"); 14999 argv.add$1("--no_colors");
14778 } 15000 }
14779 } 15001 }
14780 } 15002 }
14781 if (compile(homedir, argv, new NodeFileSystem())) { 15003 if (compile(homedir, argv, new NodeFileSystem())) {
14782 var code = $globals.world.getGeneratedCode(); 15004 var code = $globals.world.getGeneratedCode();
14783 if ($globals.options.compileOnly) { 15005 if ($globals.options.compileOnly) {
(...skipping 18 matching lines...) Expand all
14802 /** Implements extends for generic types. */ 15024 /** Implements extends for generic types. */
14803 function $inheritsMembers(child, parent) { 15025 function $inheritsMembers(child, parent) {
14804 child = child.prototype; 15026 child = child.prototype;
14805 parent = parent.prototype; 15027 parent = parent.prototype;
14806 Object.getOwnPropertyNames(parent).forEach(function(name) { 15028 Object.getOwnPropertyNames(parent).forEach(function(name) {
14807 if (typeof(child[name]) == 'undefined') child[name] = parent[name]; 15029 if (typeof(child[name]) == 'undefined') child[name] = parent[name];
14808 }); 15030 });
14809 } 15031 }
14810 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_E, DoubleLinkedQueueEntry_E); 15032 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_E, DoubleLinkedQueueEntry_E);
14811 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ ueueEntry_KeyValuePair_K$V); 15033 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ ueueEntry_KeyValuePair_K$V);
15034 $inheritsMembers(NativeMapPrimitiveValue_dart_core_String, NativeMapBase_dart_co re_String);
14812 $inheritsMembers(_SharedBackingMap_K$V, HashMapImplementation_K$V); 15035 $inheritsMembers(_SharedBackingMap_K$V, HashMapImplementation_K$V);
14813 $inheritsMembers(_SharedBackingMap_dart_core_String$VariableValue, HashMapImplem entation_dart_core_String$VariableValue); 15036 $inheritsMembers(_SharedBackingMap_dart_core_String$VariableValue, HashMapImplem entation_dart_core_String$VariableValue);
14814 // 1 dynamic types. 15037 // 1 dynamic types.
14815 // 1 types 15038 // 1 types
14816 // 0 !leaf 15039 // 0 !leaf
14817 // ********** Globals ************** 15040 // ********** Globals **************
14818 function $static_init(){ 15041 function $static_init(){
14819 $globals._GREEN_COLOR = "\x1b[32m"; 15042 $globals._GREEN_COLOR = "\x1b[32m";
14820 $globals._MAGENTA_COLOR = "\x1b[35m"; 15043 $globals._MAGENTA_COLOR = "\x1b[35m";
14821 $globals._NO_COLOR = "\x1b[0m"; 15044 $globals._NO_COLOR = "\x1b[0m";
14822 $globals._RED_COLOR = "\x1b[31m"; 15045 $globals._RED_COLOR = "\x1b[31m";
14823 } 15046 }
14824 var const$0000 = Object.create(EmptyQueueException.prototype, {}); 15047 var const$0000 = Object.create(EmptyQueueException.prototype, {});
14825 var const$0001 = Object.create(_DeletedKeySentinel.prototype, {}); 15048 var const$0001 = Object.create(_DeletedKeySentinel.prototype, {});
14826 var const$0005 = Object.create(NoMoreElementsException.prototype, {}); 15049 var const$0005 = Object.create(NoMoreElementsException.prototype, {});
14827 var const$0007 = Object.create(IllegalAccessException.prototype, {}); 15050 var const$0007 = Object.create(IllegalAccessException.prototype, {});
14828 var const$0008 = ImmutableList.ImmutableList$from$factory([]); 15051 var const$0008 = ImmutableList.ImmutableList$from$factory([]);
14829 var $globals = {}; 15052 var $globals = {};
14830 $static_init(); 15053 $static_init();
14831 main(); 15054 main();
OLDNEW
« frog/lib/node/net.dart ('K') | « frog/lib/node/zlib.dart ('k') | frog/minfrog.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698