| OLD | NEW |
| 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 } |
| 11 throw e; | 11 throw e; |
| 12 } | 12 } |
| 13 Object.defineProperty(Object.prototype, '$index', { value: function(i) { | 13 Object.defineProperty(Object.prototype, '$index', { value: function(i) { |
| 14 var proto = Object.getPrototypeOf(this); | 14 var proto = Object.getPrototypeOf(this); |
| 15 if (proto !== Object) { | 15 if (proto !== Object) { |
| 16 proto.$index = function(i) { return this[i]; } | 16 proto.$index = function(i) { return this[i]; } |
| 17 } | 17 } |
| 18 return this[i]; | 18 return this[i]; |
| 19 }, enumerable: false, writable: true, configurable: true}); | 19 }, enumerable: false, writable: true, configurable: true}); |
| 20 Object.defineProperty(Array.prototype, '$index', { value: function(i) { | 20 Object.defineProperty(Array.prototype, '$index', { value: function(index) { |
| 21 return this[i]; | 21 var i = index | 0; |
| 22 if (i !== index) { |
| 23 throw new IllegalArgumentException('index is not int'); |
| 24 } else if (i < 0 || i >= this.length) { |
| 25 throw new IndexOutOfRangeException(index); |
| 26 } |
| 27 return this[i]; |
| 22 }, enumerable: false, writable: true, configurable: true}); | 28 }, enumerable: false, writable: true, configurable: true}); |
| 23 Object.defineProperty(String.prototype, '$index', { value: function(i) { | 29 Object.defineProperty(String.prototype, '$index', { value: function(i) { |
| 24 return this[i]; | 30 return this[i]; |
| 25 }, enumerable: false, writable: true, configurable: true}); | 31 }, enumerable: false, writable: true, configurable: true}); |
| 26 Object.defineProperty(Object.prototype, '$setindex', { value: function(i, value)
{ | 32 Object.defineProperty(Object.prototype, '$setindex', { value: function(i, value)
{ |
| 27 var proto = Object.getPrototypeOf(this); | 33 var proto = Object.getPrototypeOf(this); |
| 28 if (proto !== Object) { | 34 if (proto !== Object) { |
| 29 proto.$setindex = function(i, value) { return this[i] = value; } | 35 proto.$setindex = function(i, value) { return this[i] = value; } |
| 30 } | 36 } |
| 31 return this[i] = value; | 37 return this[i] = value; |
| 32 }, enumerable: false, writable: true, configurable: true}); | 38 }, enumerable: false, writable: true, configurable: true}); |
| 33 Object.defineProperty(Array.prototype, '$setindex', { value: function(i, value)
{ | 39 Object.defineProperty(Array.prototype, '$setindex', { value: function(index, val
ue) { |
| 34 return this[i] = value; }, enumerable: false, writable: true, | 40 var i = index | 0; |
| 41 if (i !== index) { |
| 42 throw new IllegalArgumentException('index is not int'); |
| 43 } else if (i < 0 || i >= this.length) { |
| 44 throw new IndexOutOfRangeException(index); |
| 45 } |
| 46 return this[i] = value; }, enumerable: false, writable: true, |
| 35 configurable: true}); | 47 configurable: true}); |
| 36 function $add(x, y) { | 48 function $add(x, y) { |
| 37 return ((typeof(x) == 'number' && typeof(y) == 'number') || | 49 return ((typeof(x) == 'number' && typeof(y) == 'number') || |
| 38 (typeof(x) == 'string')) | 50 (typeof(x) == 'string')) |
| 39 ? x + y : x.$add(y); | 51 ? x + y : x.$add(y); |
| 40 } | 52 } |
| 41 function $bit_xor(x, y) { | 53 function $bit_xor(x, y) { |
| 42 return (typeof(x) == 'number' && typeof(y) == 'number') | 54 return (typeof(x) == 'number' && typeof(y) == 'number') |
| 43 ? x ^ y : x.$bit_xor(y); | 55 ? x ^ y : x.$bit_xor(y); |
| 44 } | 56 } |
| 45 function $eq(x, y) { | 57 function $eq(x, y) { |
| 46 if (x == null) return y == null; | 58 if (x == null) return y == null; |
| 47 return (typeof(x) == 'number' && typeof(y) == 'number') || | 59 return (typeof(x) == 'number' && typeof(y) == 'number') || |
| 48 (typeof(x) == 'boolean' && typeof(y) == 'boolean') || | 60 (typeof(x) == 'boolean' && typeof(y) == 'boolean') || |
| 49 (typeof(x) == 'string' && typeof(y) == 'string') | 61 (typeof(x) == 'string' && typeof(y) == 'string') |
| 50 ? x == y : x.$eq(y); | 62 ? x == y : x.$eq(y); |
| 51 } | 63 } |
| 52 // TODO(jimhug): Should this or should it not match equals? | 64 // TODO(jimhug): Should this or should it not match equals? |
| 53 Object.defineProperty(Object.prototype, '$eq', { value: function(other) { | 65 Object.defineProperty(Object.prototype, '$eq', { value: function(other) { |
| 54 return this === other; | 66 return this === other; |
| 55 }, enumerable: false, writable: true, configurable: true }); | 67 }, enumerable: false, writable: true, configurable: true }); |
| 56 function $gt(x, y) { | 68 function $gt(x, y) { |
| 57 return (typeof(x) == 'number' && typeof(y) == 'number') | 69 return (typeof(x) == 'number' && typeof(y) == 'number') |
| 58 ? x > y : x.$gt(y); | 70 ? x > y : x.$gt(y); |
| 59 } | 71 } |
| 60 function $gte(x, y) { | 72 function $gte(x, y) { |
| 61 return (typeof(x) == 'number' && typeof(y) == 'number') | 73 return (typeof(x) == 'number' && typeof(y) == 'number') |
| 62 ? x >= y : x.$gte(y); | 74 ? x >= y : x.$gte(y); |
| 63 } | 75 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 return this.noSuchMethod("write", [$0]); | 203 return this.noSuchMethod("write", [$0]); |
| 192 }, enumerable: false, writable: true, configurable: true }); | 204 }, enumerable: false, writable: true, configurable: true }); |
| 193 // ********** Code for Clock ************** | 205 // ********** Code for Clock ************** |
| 194 function Clock() {} | 206 function Clock() {} |
| 195 Clock.now = function() { | 207 Clock.now = function() { |
| 196 return new Date().getTime(); | 208 return new Date().getTime(); |
| 197 } | 209 } |
| 198 Clock.frequency = function() { | 210 Clock.frequency = function() { |
| 199 return (1000); | 211 return (1000); |
| 200 } | 212 } |
| 213 // ********** Code for IndexOutOfRangeException ************** |
| 214 function IndexOutOfRangeException(_index) { |
| 215 this._index = _index; |
| 216 } |
| 217 IndexOutOfRangeException.prototype.is$IndexOutOfRangeException = function(){retu
rn true}; |
| 218 IndexOutOfRangeException.prototype.toString = function() { |
| 219 return ("IndexOutOfRangeException: " + this._index); |
| 220 } |
| 221 IndexOutOfRangeException.prototype.toString$0 = IndexOutOfRangeException.prototy
pe.toString; |
| 201 // ********** Code for IllegalAccessException ************** | 222 // ********** Code for IllegalAccessException ************** |
| 202 function IllegalAccessException() { | 223 function IllegalAccessException() { |
| 203 | 224 |
| 204 } | 225 } |
| 205 IllegalAccessException.prototype.toString = function() { | 226 IllegalAccessException.prototype.toString = function() { |
| 206 return "Attempt to modify an immutable object"; | 227 return "Attempt to modify an immutable object"; |
| 207 } | 228 } |
| 208 IllegalAccessException.prototype.toString$0 = IllegalAccessException.prototype.t
oString; | 229 IllegalAccessException.prototype.toString$0 = IllegalAccessException.prototype.t
oString; |
| 209 // ********** Code for NoSuchMethodException ************** | 230 // ********** Code for NoSuchMethodException ************** |
| 210 function NoSuchMethodException(_receiver, _functionName, _arguments) { | 231 function NoSuchMethodException(_receiver, _functionName, _arguments) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 234 } | 255 } |
| 235 ClosureArgumentMismatchException.prototype.toString$0 = ClosureArgumentMismatchE
xception.prototype.toString; | 256 ClosureArgumentMismatchException.prototype.toString$0 = ClosureArgumentMismatchE
xception.prototype.toString; |
| 236 // ********** Code for ObjectNotClosureException ************** | 257 // ********** Code for ObjectNotClosureException ************** |
| 237 function ObjectNotClosureException() { | 258 function ObjectNotClosureException() { |
| 238 | 259 |
| 239 } | 260 } |
| 240 ObjectNotClosureException.prototype.toString = function() { | 261 ObjectNotClosureException.prototype.toString = function() { |
| 241 return "Object is not closure"; | 262 return "Object is not closure"; |
| 242 } | 263 } |
| 243 ObjectNotClosureException.prototype.toString$0 = ObjectNotClosureException.proto
type.toString; | 264 ObjectNotClosureException.prototype.toString$0 = ObjectNotClosureException.proto
type.toString; |
| 265 // ********** Code for IllegalArgumentException ************** |
| 266 function IllegalArgumentException(args) { |
| 267 this._args = args; |
| 268 } |
| 269 IllegalArgumentException.prototype.is$IllegalArgumentException = function(){retu
rn true}; |
| 270 IllegalArgumentException.prototype.toString = function() { |
| 271 return ("Illegal argument(s): " + this._args); |
| 272 } |
| 273 IllegalArgumentException.prototype.toString$0 = IllegalArgumentException.prototy
pe.toString; |
| 244 // ********** Code for StackOverflowException ************** | 274 // ********** Code for StackOverflowException ************** |
| 245 function StackOverflowException() { | 275 function StackOverflowException() { |
| 246 | 276 |
| 247 } | 277 } |
| 248 StackOverflowException.prototype.toString = function() { | 278 StackOverflowException.prototype.toString = function() { |
| 249 return "Stack Overflow"; | 279 return "Stack Overflow"; |
| 250 } | 280 } |
| 251 StackOverflowException.prototype.toString$0 = StackOverflowException.prototype.t
oString; | 281 StackOverflowException.prototype.toString$0 = StackOverflowException.prototype.t
oString; |
| 252 // ********** Code for BadNumberFormatException ************** | 282 // ********** Code for BadNumberFormatException ************** |
| 253 function BadNumberFormatException(_s) { | 283 function BadNumberFormatException(_s) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 274 } | 304 } |
| 275 NoMoreElementsException.prototype.toString$0 = NoMoreElementsException.prototype
.toString; | 305 NoMoreElementsException.prototype.toString$0 = NoMoreElementsException.prototype
.toString; |
| 276 // ********** Code for EmptyQueueException ************** | 306 // ********** Code for EmptyQueueException ************** |
| 277 function EmptyQueueException() { | 307 function EmptyQueueException() { |
| 278 | 308 |
| 279 } | 309 } |
| 280 EmptyQueueException.prototype.toString = function() { | 310 EmptyQueueException.prototype.toString = function() { |
| 281 return "EmptyQueueException"; | 311 return "EmptyQueueException"; |
| 282 } | 312 } |
| 283 EmptyQueueException.prototype.toString$0 = EmptyQueueException.prototype.toStrin
g; | 313 EmptyQueueException.prototype.toString$0 = EmptyQueueException.prototype.toStrin
g; |
| 314 // ********** Code for IntegerDivisionByZeroException ************** |
| 315 function IntegerDivisionByZeroException() { |
| 316 |
| 317 } |
| 318 IntegerDivisionByZeroException.prototype.is$IntegerDivisionByZeroException = fun
ction(){return true}; |
| 319 IntegerDivisionByZeroException.prototype.toString = function() { |
| 320 return "IntegerDivisionByZeroException"; |
| 321 } |
| 322 IntegerDivisionByZeroException.prototype.toString$0 = IntegerDivisionByZeroExcep
tion.prototype.toString; |
| 284 // ********** Code for dart_core_Function ************** | 323 // ********** Code for dart_core_Function ************** |
| 285 Function.prototype.to$call$0 = function() { | 324 Function.prototype.to$call$0 = function() { |
| 286 this.call$0 = this._genStub(0); | 325 this.call$0 = this._genStub(0); |
| 287 this.to$call$0 = function() { return this.call$0; }; | 326 this.to$call$0 = function() { return this.call$0; }; |
| 288 return this.call$0; | 327 return this.call$0; |
| 289 }; | 328 }; |
| 290 Function.prototype.call$0 = function() { | 329 Function.prototype.call$0 = function() { |
| 291 return this.to$call$0()(); | 330 return this.to$call$0()(); |
| 292 }; | 331 }; |
| 293 function to$call$0(f) { return f && f.to$call$0(); } | 332 function to$call$0(f) { return f && f.to$call$0(); } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 this.add(item); | 467 this.add(item); |
| 429 } | 468 } |
| 430 }, enumerable: false, writable: true, configurable: true }); | 469 }, enumerable: false, writable: true, configurable: true }); |
| 431 Object.defineProperty(ListFactory.prototype, "clear", { value: function() { | 470 Object.defineProperty(ListFactory.prototype, "clear", { value: function() { |
| 432 this.set$length((0)); | 471 this.set$length((0)); |
| 433 }, enumerable: false, writable: true, configurable: true }); | 472 }, enumerable: false, writable: true, configurable: true }); |
| 434 Object.defineProperty(ListFactory.prototype, "removeLast", { value: function() { | 473 Object.defineProperty(ListFactory.prototype, "removeLast", { value: function() { |
| 435 return this.pop(); | 474 return this.pop(); |
| 436 }, enumerable: false, writable: true, configurable: true }); | 475 }, enumerable: false, writable: true, configurable: true }); |
| 437 Object.defineProperty(ListFactory.prototype, "last", { value: function() { | 476 Object.defineProperty(ListFactory.prototype, "last", { value: function() { |
| 438 return this[this.get$length() - (1)]; | 477 return this.$index(this.get$length() - (1)); |
| 439 }, enumerable: false, writable: true, configurable: true }); | 478 }, enumerable: false, writable: true, configurable: true }); |
| 440 Object.defineProperty(ListFactory.prototype, "getRange", { value: function(start
, length) { | 479 Object.defineProperty(ListFactory.prototype, "getRange", { value: function(start
, length) { |
| 441 return this.slice(start, start + length); | 480 if (length == 0) return []; |
| 481 if (length < 0) throw new IllegalArgumentException('length'); |
| 482 if (start < 0 || start + length > this.length) |
| 483 throw new IndexOutOfRangeException(start); |
| 484 return this.slice(start, start + length); |
| 485 |
| 442 }, enumerable: false, writable: true, configurable: true }); | 486 }, enumerable: false, writable: true, configurable: true }); |
| 443 Object.defineProperty(ListFactory.prototype, "insertRange", { value: function(st
art, length, initialValue) { | 487 Object.defineProperty(ListFactory.prototype, "insertRange", { value: function(st
art, length, initialValue) { |
| 488 if (length == 0) return; |
| 489 if (length < 0) throw new IllegalArgumentException('length'); |
| 490 if (start < 0 || start > this.length) |
| 491 throw new IndexOutOfRangeException(start); |
| 492 |
| 444 // Splice in the values with a minimum of array allocations. | 493 // Splice in the values with a minimum of array allocations. |
| 445 var args = new Array(length + 2); | 494 var args = new Array(length + 2); |
| 446 args[0] = start; | 495 args[0] = start; |
| 447 args[1] = 0; | 496 args[1] = 0; |
| 448 for (var i = 0; i < length; i++) { | 497 for (var i = 0; i < length; i++) { |
| 449 args[i + 2] = initialValue; | 498 args[i + 2] = initialValue; |
| 450 } | 499 } |
| 451 this.splice.apply(this, args); | 500 this.splice.apply(this, args); |
| 452 | 501 |
| 453 }, enumerable: false, writable: true, configurable: true }); | 502 }, enumerable: false, writable: true, configurable: true }); |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 if (entry.map.hasOwnProperty(tag)) { | 1655 if (entry.map.hasOwnProperty(tag)) { |
| 1607 method = methods[entry.tag]; | 1656 method = methods[entry.tag]; |
| 1608 if (method) break; | 1657 if (method) break; |
| 1609 } | 1658 } |
| 1610 } | 1659 } |
| 1611 } | 1660 } |
| 1612 method = method || methods.Object; | 1661 method = method || methods.Object; |
| 1613 var proto = Object.getPrototypeOf(obj); | 1662 var proto = Object.getPrototypeOf(obj); |
| 1614 if (!proto.hasOwnProperty(name)) { | 1663 if (!proto.hasOwnProperty(name)) { |
| 1615 Object.defineProperty(proto, name, | 1664 Object.defineProperty(proto, name, |
| 1616 { value: method, enumerable: false, writable: true, | 1665 { value: method, enumerable: false, writable: true, |
| 1617 configurable: true }); | 1666 configurable: true }); |
| 1618 } | 1667 } |
| 1619 | 1668 |
| 1620 return method.apply(this, Array.prototype.slice.call(arguments)); | 1669 return method.apply(this, Array.prototype.slice.call(arguments)); |
| 1621 }; | 1670 }; |
| 1622 $dynamicBind.methods = methods; | 1671 $dynamicBind.methods = methods; |
| 1623 Object.defineProperty(Object.prototype, name, { value: $dynamicBind, | 1672 Object.defineProperty(Object.prototype, name, { value: $dynamicBind, |
| 1624 enumerable: false, writable: true, configurable: true}); | 1673 enumerable: false, writable: true, configurable: true}); |
| 1625 return methods; | 1674 return methods; |
| 1626 } | 1675 } |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 this.writeln(text); | 2791 this.writeln(text); |
| 2743 } | 2792 } |
| 2744 CodeWriter.prototype.nextBlock = function(text) { | 2793 CodeWriter.prototype.nextBlock = function(text) { |
| 2745 this._indentation--; | 2794 this._indentation--; |
| 2746 this.writeln(text); | 2795 this.writeln(text); |
| 2747 this._indentation++; | 2796 this._indentation++; |
| 2748 } | 2797 } |
| 2749 CodeWriter.prototype.write$1 = CodeWriter.prototype.write; | 2798 CodeWriter.prototype.write$1 = CodeWriter.prototype.write; |
| 2750 // ********** Code for CoreJs ************** | 2799 // ********** Code for CoreJs ************** |
| 2751 function CoreJs() { | 2800 function CoreJs() { |
| 2752 this.useAssert = false; | |
| 2753 this.useIsolates = false; | 2801 this.useIsolates = false; |
| 2754 this._generatedTypeNameOf = false; | 2802 this._generatedTypeNameOf = false; |
| 2755 this._usedOperators = new HashMapImplementation(); | 2803 this._usedOperators = new HashMapImplementation(); |
| 2756 this._generatedInherits = false; | 2804 this._generatedInherits = false; |
| 2757 this.useNotNullBool = false; | 2805 this.useNotNullBool = false; |
| 2758 this.writer = new CodeWriter(); | 2806 this.writer = new CodeWriter(); |
| 2759 this.useWrap0 = false; | 2807 this.useWrap0 = false; |
| 2760 this.useThrow = false; | 2808 this.useThrow = false; |
| 2761 this._generatedDynamicProto = false; | 2809 this._generatedDynamicProto = false; |
| 2762 this.useWrap1 = false; | 2810 this.useWrap1 = false; |
| 2763 this.useSetIndex = false; | 2811 this.useSetIndex = false; |
| 2764 this.useIndex = false; | 2812 this.useIndex = false; |
| 2765 } | 2813 } |
| 2766 CoreJs.prototype.get$writer = function() { return this.writer; }; | 2814 CoreJs.prototype.get$writer = function() { return this.writer; }; |
| 2767 CoreJs.prototype.set$writer = function(value) { return this.writer = value; }; | 2815 CoreJs.prototype.set$writer = function(value) { return this.writer = value; }; |
| 2768 CoreJs.prototype.useOperator = function(name) { | 2816 CoreJs.prototype.useOperator = function(name) { |
| 2769 if ($ne(this._usedOperators.$index(name))) return; | 2817 if ($ne(this._usedOperators.$index(name))) return; |
| 2770 var code; | 2818 var code; |
| 2771 switch (name) { | 2819 switch (name) { |
| 2772 case ":ne": | 2820 case ":ne": |
| 2773 | 2821 |
| 2774 code = "function $ne(x, y) {\n if (x == null) return y != null;\n return
(typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'bo
olean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(
y) == 'string')\n ? x != y : !x.$eq(y);\n}"; | 2822 code = "function $ne(x, y) {\n if (x == null) return y != null;\n return
(typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'bo
olean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(
y) == 'string')\n ? x != y : !x.$eq(y);\n}"; |
| 2775 break; | 2823 break; |
| 2776 | 2824 |
| 2777 case ":eq": | 2825 case ":eq": |
| 2778 | 2826 |
| 2779 code = "function $eq(x, y) {\n if (x == null) return y == null;\n return
(typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'bo
olean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(
y) == 'string')\n ? x == y : x.$eq(y);\n}\n// TODO(jimhug): Should this or sh
ould it not match equals?\nObject.defineProperty(Object.prototype, '$eq', { valu
e: function(other) { \n return this === other;\n}, enumerable: false, writable:
true, configurable: true });"; | 2827 code = "function $eq(x, y) {\n if (x == null) return y == null;\n return
(typeof(x) == 'number' && typeof(y) == 'number') ||\n (typeof(x) == 'bo
olean' && typeof(y) == 'boolean') ||\n (typeof(x) == 'string' && typeof(
y) == 'string')\n ? x == y : x.$eq(y);\n}\n// TODO(jimhug): Should this or sh
ould it not match equals?\nObject.defineProperty(Object.prototype, '$eq', { valu
e: function(other) {\n return this === other;\n}, enumerable: false, writable:
true, configurable: true });"; |
| 2780 break; | 2828 break; |
| 2781 | 2829 |
| 2782 case ":bit_not": | 2830 case ":bit_not": |
| 2783 | 2831 |
| 2784 code = "function $bit_not(x) {\n return (typeof(x) == 'number') ? ~x : x.
$bit_not();\n}"; | 2832 code = "function $bit_not(x) {\n return (typeof(x) == 'number') ? ~x : x.
$bit_not();\n}"; |
| 2785 break; | 2833 break; |
| 2786 | 2834 |
| 2787 case ":negate": | 2835 case ":negate": |
| 2788 | 2836 |
| 2789 code = "function $negate(x) {\n return (typeof(x) == 'number') ? -x : x.$
negate();\n}"; | 2837 code = "function $negate(x) {\n return (typeof(x) == 'number') ? -x : x.$
negate();\n}"; |
| 2790 break; | 2838 break; |
| 2791 | 2839 |
| 2792 case ":add": | 2840 case ":add": |
| 2793 | 2841 |
| 2794 code = "function $add(x, y) {\n return ((typeof(x) == 'number' && typeof(
y) == 'number') ||\n (typeof(x) == 'string'))\n ? x + y : x.$add(y);
\n}"; | 2842 code = "function $add(x, y) {\n return ((typeof(x) == 'number' && typeof(
y) == 'number') ||\n (typeof(x) == 'string'))\n ? x + y : x.$add(y);
\n}"; |
| 2795 break; | 2843 break; |
| 2796 | 2844 |
| 2797 case ":truncdiv": | 2845 case ":truncdiv": |
| 2798 | 2846 |
| 2799 this.useThrow = true; | 2847 this.useThrow = true; |
| 2848 $globals.world.gen.markTypeUsed($globals.world.corelib.types.$index("Integ
erDivisionByZeroException")); |
| 2800 code = "function $truncdiv(x, y) {\n if (typeof(x) == 'number' && typeof(
y) == 'number') {\n if (y == 0) $throw(new IntegerDivisionByZeroException());
\n var tmp = x / y;\n return (tmp < 0) ? Math.ceil(tmp) : Math.floor(tmp);
\n } else {\n return x.$truncdiv(y);\n }\n}"; | 2849 code = "function $truncdiv(x, y) {\n if (typeof(x) == 'number' && typeof(
y) == 'number') {\n if (y == 0) $throw(new IntegerDivisionByZeroException());
\n var tmp = x / y;\n return (tmp < 0) ? Math.ceil(tmp) : Math.floor(tmp);
\n } else {\n return x.$truncdiv(y);\n }\n}"; |
| 2801 break; | 2850 break; |
| 2802 | 2851 |
| 2803 case ":mod": | 2852 case ":mod": |
| 2804 | 2853 |
| 2805 code = "function $mod(x, y) {\n if (typeof(x) == 'number' && typeof(y) ==
'number') {\n var result = x % y;\n if (result == 0) {\n return 0;
// Make sure we don't return -0.0.\n } else if (result < 0) {\n if (y <
0) {\n return result - y;\n } else {\n return result + y;\n
}\n }\n return result;\n } else {\n return x.$mod(y);\n }\n}"; | 2854 code = "function $mod(x, y) {\n if (typeof(x) == 'number' && typeof(y) ==
'number') {\n var result = x % y;\n if (result == 0) {\n return 0;
// Make sure we don't return -0.0.\n } else if (result < 0) {\n if (y <
0) {\n return result - y;\n } else {\n return result + y;\n
}\n }\n return result;\n } else {\n return x.$mod(y);\n }\n}"; |
| 2806 break; | 2855 break; |
| 2807 | 2856 |
| 2808 default: | 2857 default: |
| 2809 | 2858 |
| 2810 var op = TokenKind.rawOperatorFromMethod(name); | 2859 var op = TokenKind.rawOperatorFromMethod(name); |
| 2811 var jsname = $globals.world.toJsIdentifier(name); | 2860 var jsname = $globals.world.toJsIdentifier(name); |
| 2812 code = _otherOperator(jsname, op); | 2861 code = _otherOperator(jsname, op); |
| 2813 break; | 2862 break; |
| 2814 | 2863 |
| 2815 } | 2864 } |
| 2816 this._usedOperators.$setindex(name, code); | 2865 this._usedOperators.$setindex(name, code); |
| 2817 } | 2866 } |
| 2818 CoreJs.prototype.ensureDynamicProto = function() { | 2867 CoreJs.prototype.ensureDynamicProto = function() { |
| 2819 if (this._generatedDynamicProto) return; | 2868 if (this._generatedDynamicProto) return; |
| 2820 this._generatedDynamicProto = true; | 2869 this._generatedDynamicProto = true; |
| 2821 this.ensureTypeNameOf(); | 2870 this.ensureTypeNameOf(); |
| 2822 this.writer.writeln("function $dynamic(name) {\n var f = Object.prototype[nam
e];\n if (f && f.methods) return f.methods;\n\n var methods = {};\n if (f) me
thods.Object = f;\n function $dynamicBind() {\n // Find the target method\n
var obj = this;\n var tag = obj.$typeNameOf();\n var method = methods[t
ag];\n if (!method) {\n var table = $dynamicMetadata;\n for (var i
= 0; i < table.length; i++) {\n var entry = table[i];\n if (entry.
map.hasOwnProperty(tag)) {\n method = methods[entry.tag];\n if
(method) break;\n }\n }\n }\n method = method || methods.Obje
ct;\n var proto = Object.getPrototypeOf(obj);\n if (!proto.hasOwnProperty(
name)) {\n Object.defineProperty(proto, name,\n { value: method, enu
merable: false, writable: true, \n configurable: true });\n }\n\n r
eturn method.apply(this, Array.prototype.slice.call(arguments));\n };\n $dynam
icBind.methods = methods;\n Object.defineProperty(Object.prototype, name, { val
ue: $dynamicBind,\n enumerable: false, writable: true, configurable: true})
;\n return methods;\n}\nif (typeof $dynamicMetadata == 'undefined') $dynamicMet
adata = [];\n\nfunction $dynamicSetMetadata(inputTable) {\n // TODO: Deal with
light isolates.\n var table = [];\n for (var i = 0; i < inputTable.length; i++
) {\n var tag = inputTable[i][0];\n var tags = inputTable[i][1];\n var
map = {};\n var tagNames = tags.split('|');\n for (var j = 0; j < tagNames
.length; j++) {\n map[tagNames[j]] = true;\n }\n table.push({tag: tag
, tags: tags, map: map});\n }\n $dynamicMetadata = table;\n}\n"); | 2871 this.writer.writeln("function $dynamic(name) {\n var f = Object.prototype[nam
e];\n if (f && f.methods) return f.methods;\n\n var methods = {};\n if (f) me
thods.Object = f;\n function $dynamicBind() {\n // Find the target method\n
var obj = this;\n var tag = obj.$typeNameOf();\n var method = methods[t
ag];\n if (!method) {\n var table = $dynamicMetadata;\n for (var i
= 0; i < table.length; i++) {\n var entry = table[i];\n if (entry.
map.hasOwnProperty(tag)) {\n method = methods[entry.tag];\n if
(method) break;\n }\n }\n }\n method = method || methods.Obje
ct;\n var proto = Object.getPrototypeOf(obj);\n if (!proto.hasOwnProperty(
name)) {\n Object.defineProperty(proto, name,\n { value: method, enu
merable: false, writable: true,\n configurable: true });\n }\n\n re
turn method.apply(this, Array.prototype.slice.call(arguments));\n };\n $dynami
cBind.methods = methods;\n Object.defineProperty(Object.prototype, name, { valu
e: $dynamicBind,\n enumerable: false, writable: true, configurable: true});
\n return methods;\n}\nif (typeof $dynamicMetadata == 'undefined') $dynamicMeta
data = [];\n\nfunction $dynamicSetMetadata(inputTable) {\n // TODO: Deal with l
ight isolates.\n var table = [];\n for (var i = 0; i < inputTable.length; i++)
{\n var tag = inputTable[i][0];\n var tags = inputTable[i][1];\n var m
ap = {};\n var tagNames = tags.split('|');\n for (var j = 0; j < tagNames.
length; j++) {\n map[tagNames[j]] = true;\n }\n table.push({tag: tag,
tags: tags, map: map});\n }\n $dynamicMetadata = table;\n}\n"); |
| 2823 } | 2872 } |
| 2824 CoreJs.prototype.ensureTypeNameOf = function() { | 2873 CoreJs.prototype.ensureTypeNameOf = function() { |
| 2825 if (this._generatedTypeNameOf) return; | 2874 if (this._generatedTypeNameOf) return; |
| 2826 this._generatedTypeNameOf = true; | 2875 this._generatedTypeNameOf = true; |
| 2827 this.writer.writeln("Object.defineProperty(Object.prototype, '$typeNameOf', {
value: function() {\n if ((typeof(window) != 'undefined' && window.constructor.
name == 'DOMWindow')\n || typeof(process) != 'undefined') { // fast-path fo
r Chrome and Node\n return this.constructor.name;\n }\n var str = Object.pr
ototype.toString.call(this);\n str = str.substring(8, str.length - 1);\n if (s
tr == 'Window') {\n str = 'DOMWindow';\n } else if (str == 'Document') {\n
str = 'HTMLDocument';\n }\n return str;\n}, enumerable: false, writable: tru
e, configurable: true});"); | 2876 this.writer.writeln("Object.defineProperty(Object.prototype, '$typeNameOf', {
value: function() {\n if ((typeof(window) != 'undefined' && window.constructor.
name == 'DOMWindow')\n || typeof(process) != 'undefined') { // fast-path fo
r Chrome and Node\n return this.constructor.name;\n }\n var str = Object.pr
ototype.toString.call(this);\n str = str.substring(8, str.length - 1);\n if (s
tr == 'Window') {\n str = 'DOMWindow';\n } else if (str == 'Document') {\n
str = 'HTMLDocument';\n }\n return str;\n}, enumerable: false, writable: tru
e, configurable: true});"); |
| 2828 } | 2877 } |
| 2829 CoreJs.prototype.ensureInheritsHelper = function() { | 2878 CoreJs.prototype.ensureInheritsHelper = function() { |
| 2830 if (this._generatedInherits) return; | 2879 if (this._generatedInherits) return; |
| 2831 this._generatedInherits = true; | 2880 this._generatedInherits = true; |
| 2832 this.writer.writeln("/** Implements extends for Dart classes on JavaScript pro
totypes. */\nfunction $inherits(child, parent) {\n if (child.prototype.__proto_
_) {\n child.prototype.__proto__ = parent.prototype;\n } else {\n functio
n tmp() {};\n tmp.prototype = parent.prototype;\n child.prototype = new tm
p();\n child.prototype.constructor = child;\n }\n}"); | 2881 this.writer.writeln("/** Implements extends for Dart classes on JavaScript pro
totypes. */\nfunction $inherits(child, parent) {\n if (child.prototype.__proto_
_) {\n child.prototype.__proto__ = parent.prototype;\n } else {\n functio
n tmp() {};\n tmp.prototype = parent.prototype;\n child.prototype = new tm
p();\n child.prototype.constructor = child;\n }\n}"); |
| 2833 } | 2882 } |
| 2834 CoreJs.prototype.generate = function(w) { | 2883 CoreJs.prototype.generate = function(w) { |
| 2835 w.write(this.writer.get$text()); | 2884 w.write(this.writer.get$text()); |
| 2836 this.writer = w; | 2885 this.writer = w; |
| 2837 if (this.useNotNullBool) { | 2886 if (this.useNotNullBool) { |
| 2838 this.useThrow = true; | 2887 this.useThrow = true; |
| 2839 w.writeln("function $notnull_bool(test) {\n if (test === true || test === f
alse) return test;\n $throw(new TypeError(test, 'bool'));\n}"); | 2888 w.writeln("function $notnull_bool(test) {\n if (test === true || test === f
alse) return test;\n $throw(new TypeError(test, 'bool'));\n}"); |
| 2840 } | 2889 } |
| 2841 if (this.useThrow) { | 2890 if (this.useThrow) { |
| 2842 w.writeln("function $throw(e) {\n // If e is not a value, we can use V8's c
aptureStackTrace utility method.\n // TODO(jmesserly): capture the stack trace
on other JS engines.\n if (e && (typeof e == 'object') && Error.captureStackTra
ce) {\n // TODO(jmesserly): this will clobber the e.stack property\n Error
.captureStackTrace(e, $throw);\n }\n throw e;\n}"); | 2891 w.writeln("function $throw(e) {\n // If e is not a value, we can use V8's c
aptureStackTrace utility method.\n // TODO(jmesserly): capture the stack trace
on other JS engines.\n if (e && (typeof e == 'object') && Error.captureStackTra
ce) {\n // TODO(jmesserly): this will clobber the e.stack property\n Error
.captureStackTrace(e, $throw);\n }\n throw e;\n}"); |
| 2843 } | 2892 } |
| 2844 if (this.useIndex) { | 2893 if (this.useIndex) { |
| 2845 w.writeln("Object.defineProperty(Object.prototype, '$index', { value: functi
on(i) {\n var proto = Object.getPrototypeOf(this);\n if (proto !== Object) {\n
proto.$index = function(i) { return this[i]; }\n }\n return this[i];\n}, e
numerable: false, writable: true, configurable: true});\nObject.defineProperty(A
rray.prototype, '$index', { value: function(i) { \n return this[i]; \n}, enumer
able: false, writable: true, configurable: true});\nObject.defineProperty(String
.prototype, '$index', { value: function(i) { \n return this[i]; \n}, enumerable
: false, writable: true, configurable: true});"); | 2894 w.writeln($globals.options.disableBoundsChecks ? "Object.defineProperty(Obje
ct.prototype, '$index', { value: function(i) {\n var proto = Object.getPrototyp
eOf(this);\n if (proto !== Object) {\n proto.$index = function(i) { return t
his[i]; }\n }\n return this[i];\n}, enumerable: false, writable: true, configu
rable: true});\nObject.defineProperty(Array.prototype, '$index', { value: functi
on(i) {\n return this[i];\n}, enumerable: false, writable: true, configurable:
true});\nObject.defineProperty(String.prototype, '$index', { value: function(i)
{\n return this[i];\n}, enumerable: false, writable: true, configurable: true})
;" : "Object.defineProperty(Object.prototype, '$index', { value: function(i) {\n
var proto = Object.getPrototypeOf(this);\n if (proto !== Object) {\n proto
.$index = function(i) { return this[i]; }\n }\n return this[i];\n}, enumerable
: false, writable: true, configurable: true});\nObject.defineProperty(Array.prot
otype, '$index', { value: function(index) {\n var i = index | 0;\n if (i !== i
ndex) {\n throw new IllegalArgumentException('index is not int');\n } else i
f (i < 0 || i >= this.length) {\n throw new IndexOutOfRangeException(index);\
n }\n return this[i];\n}, enumerable: false, writable: true, configurable: tru
e});\nObject.defineProperty(String.prototype, '$index', { value: function(i) {\n
return this[i];\n}, enumerable: false, writable: true, configurable: true});")
; |
| 2846 } | 2895 } |
| 2847 if (this.useSetIndex) { | 2896 if (this.useSetIndex) { |
| 2848 w.writeln("Object.defineProperty(Object.prototype, '$setindex', { value: fun
ction(i, value) {\n var proto = Object.getPrototypeOf(this);\n if (proto !== O
bject) {\n proto.$setindex = function(i, value) { return this[i] = value; }\n
}\n return this[i] = value;\n}, enumerable: false, writable: true, configurab
le: true});\nObject.defineProperty(Array.prototype, '$setindex', { value: functi
on(i, value) { \n return this[i] = value; }, enumerable: false, writable: true,
\n configurable: true});"); | 2897 w.writeln($globals.options.disableBoundsChecks ? "Object.defineProperty(Obje
ct.prototype, '$setindex', { value: function(i, value) {\n var proto = Object.g
etPrototypeOf(this);\n if (proto !== Object) {\n proto.$setindex = function(
i, value) { return this[i] = value; }\n }\n return this[i] = value;\n}, enumer
able: false, writable: true, configurable: true});\nObject.defineProperty(Array.
prototype, '$setindex', { value: function(i, value) {\n return this[i] = value;
}, enumerable: false, writable: true,\n configurable: true});" : "Object.defin
eProperty(Object.prototype, '$setindex', { value: function(i, value) {\n var pr
oto = Object.getPrototypeOf(this);\n if (proto !== Object) {\n proto.$setind
ex = function(i, value) { return this[i] = value; }\n }\n return this[i] = val
ue;\n}, enumerable: false, writable: true, configurable: true});\nObject.defineP
roperty(Array.prototype, '$setindex', { value: function(index, value) {\n var i
= index | 0;\n if (i !== index) {\n throw new IllegalArgumentException('ind
ex is not int');\n } else if (i < 0 || i >= this.length) {\n throw new Index
OutOfRangeException(index);\n }\n return this[i] = value; }, enumerable: false
, writable: true,\n configurable: true});"); |
| 2849 } | 2898 } |
| 2850 if (this.useIsolates) { | 2899 if (this.useIsolates) { |
| 2851 if (this.useWrap0) { | 2900 if (this.useWrap0) { |
| 2852 w.writeln("// Wrap a 0-arg dom-callback to bind it with the current isolat
e:\nfunction $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }\nFunction.proto
type.wrap$call$0 = function() {\n var isolateContext = $globalState.currentCont
ext;\n var self = this;\n this.wrap$0 = function() {\n isolateContext.eval(
self);\n $globalState.topEventLoop.run();\n };\n this.wrap$call$0 = functio
n() { return this.wrap$0; };\n return this.wrap$0;\n}"); | 2901 w.writeln("// Wrap a 0-arg dom-callback to bind it with the current isolat
e:\nfunction $wrap_call$0(fn) { return fn && fn.wrap$call$0(); }\nFunction.proto
type.wrap$call$0 = function() {\n var isolateContext = $globalState.currentCont
ext;\n var self = this;\n this.wrap$0 = function() {\n isolateContext.eval(
self);\n $globalState.topEventLoop.run();\n };\n this.wrap$call$0 = functio
n() { return this.wrap$0; };\n return this.wrap$0;\n}"); |
| 2853 } | 2902 } |
| 2854 if (this.useWrap1) { | 2903 if (this.useWrap1) { |
| 2855 w.writeln("// Wrap a 1-arg dom-callback to bind it with the current isolat
e:\nfunction $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }\nFunction.proto
type.wrap$call$1 = function() {\n var isolateContext = $globalState.currentCont
ext;\n var self = this;\n this.wrap$1 = function(arg) {\n isolateContext.ev
al(function() { self(arg); });\n $globalState.topEventLoop.run();\n };\n th
is.wrap$call$1 = function() { return this.wrap$1; };\n return this.wrap$1;\n}")
; | 2904 w.writeln("// Wrap a 1-arg dom-callback to bind it with the current isolat
e:\nfunction $wrap_call$1(fn) { return fn && fn.wrap$call$1(); }\nFunction.proto
type.wrap$call$1 = function() {\n var isolateContext = $globalState.currentCont
ext;\n var self = this;\n this.wrap$1 = function(arg) {\n isolateContext.ev
al(function() { self(arg); });\n $globalState.topEventLoop.run();\n };\n th
is.wrap$call$1 = function() { return this.wrap$1; };\n return this.wrap$1;\n}")
; |
| 2856 } | 2905 } |
| 2857 w.writeln("var $globalThis = this;\nvar $globals = null;\nvar $globalState =
null;"); | 2906 w.writeln("var $globalThis = this;\nvar $globals = null;\nvar $globalState =
null;"); |
| 2858 } | 2907 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 WorldGenerator.prototype.run = function() { | 3095 WorldGenerator.prototype.run = function() { |
| 3047 this.mainContext = new MethodGenerator(this.main, null); | 3096 this.mainContext = new MethodGenerator(this.main, null); |
| 3048 var mainTarget = new TypeValue(this.main.declaringType, this.main.get$span()); | 3097 var mainTarget = new TypeValue(this.main.declaringType, this.main.get$span()); |
| 3049 var mainCall = this.main.invoke(this.mainContext, null, mainTarget, Arguments.
get$EMPTY()); | 3098 var mainCall = this.main.invoke(this.mainContext, null, mainTarget, Arguments.
get$EMPTY()); |
| 3050 this.main.declaringType.markUsed(); | 3099 this.main.declaringType.markUsed(); |
| 3051 if ($globals.options.compileAll) { | 3100 if ($globals.options.compileAll) { |
| 3052 this.markLibrariesUsed([$globals.world.coreimpl, $globals.world.corelib, thi
s.main.declaringType.get$library()]); | 3101 this.markLibrariesUsed([$globals.world.coreimpl, $globals.world.corelib, thi
s.main.declaringType.get$library()]); |
| 3053 } | 3102 } |
| 3054 $globals.world.numImplType.markUsed(); | 3103 $globals.world.numImplType.markUsed(); |
| 3055 $globals.world.stringImplType.markUsed(); | 3104 $globals.world.stringImplType.markUsed(); |
| 3105 if (this.corejs.useIndex || this.corejs.useSetIndex) { |
| 3106 if (!$globals.options.disableBoundsChecks) { |
| 3107 this.markTypeUsed($globals.world.corelib.types.$index("IndexOutOfRangeExce
ption")); |
| 3108 this.markTypeUsed($globals.world.corelib.types.$index("IllegalArgumentExce
ption")); |
| 3109 } |
| 3110 } |
| 3056 if ($globals.world.corelib.types.$index("Isolate").get$isUsed() || $globals.wo
rld.coreimpl.types.$index("ReceivePortImpl").get$isUsed()) { | 3111 if ($globals.world.corelib.types.$index("Isolate").get$isUsed() || $globals.wo
rld.coreimpl.types.$index("ReceivePortImpl").get$isUsed()) { |
| 3057 if (this.corejs.useWrap0 || this.corejs.useWrap1) { | 3112 if (this.corejs.useWrap0 || this.corejs.useWrap1) { |
| 3058 this.genMethod($globals.world.coreimpl.types.$index("IsolateContext").getM
ember("eval")); | 3113 this.genMethod($globals.world.coreimpl.types.$index("IsolateContext").getM
ember("eval")); |
| 3059 this.genMethod($globals.world.coreimpl.types.$index("EventLoop").getMember
("run")); | 3114 this.genMethod($globals.world.coreimpl.types.$index("EventLoop").getMember
("run")); |
| 3060 } | 3115 } |
| 3061 this.corejs.useIsolates = true; | 3116 this.corejs.useIsolates = true; |
| 3062 var isolateMain = $globals.world.coreimpl.lookup("startRootIsolate", this.ma
in.get$span()); | 3117 var isolateMain = $globals.world.coreimpl.lookup("startRootIsolate", this.ma
in.get$span()); |
| 3063 var isolateMainTarget = new TypeValue($globals.world.coreimpl.topType, this.
main.get$span()); | 3118 var isolateMainTarget = new TypeValue($globals.world.coreimpl.topType, this.
main.get$span()); |
| 3064 mainCall = isolateMain.invoke(this.mainContext, null, isolateMainTarget, new
Arguments(null, [this.main._get(this.mainContext, this.main.definition, null)])
); | 3119 mainCall = isolateMain.invoke(this.mainContext, null, isolateMainTarget, new
Arguments(null, [this.main._get(this.mainContext, this.main.definition, null)])
); |
| 3065 } | 3120 } |
| (...skipping 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6372 } | 6427 } |
| 6373 } | 6428 } |
| 6374 else if (target.get$type().get$isString()) { | 6429 else if (target.get$type().get$isString()) { |
| 6375 if (this.name == ":index" && args.values.$index((0)).get$type().get$isNum())
{ | 6430 if (this.name == ":index" && args.values.$index((0)).get$type().get$isNum())
{ |
| 6376 return new Value(this.declaringType, ("" + target.get$code() + "[" + argsC
ode.$index((0)) + "]"), node.span); | 6431 return new Value(this.declaringType, ("" + target.get$code() + "[" + argsC
ode.$index((0)) + "]"), node.span); |
| 6377 } | 6432 } |
| 6378 else if (this.name == ":add" && args.values.$index((0)).get$type().get$isNum
()) { | 6433 else if (this.name == ":add" && args.values.$index((0)).get$type().get$isNum
()) { |
| 6379 return new Value(this.declaringType, ("" + target.get$code() + " + " + arg
sCode.$index((0))), node.span); | 6434 return new Value(this.declaringType, ("" + target.get$code() + " + " + arg
sCode.$index((0))), node.span); |
| 6380 } | 6435 } |
| 6381 } | 6436 } |
| 6382 else if (this.declaringType.get$isNative()) { | 6437 else if (this.declaringType.get$isNative() && $globals.options.disableBoundsCh
ecks) { |
| 6383 if (args.get$length() > (0) && args.values.$index((0)).get$type().get$isNum(
)) { | 6438 if (args.get$length() > (0) && args.values.$index((0)).get$type().get$isNum(
)) { |
| 6384 if (this.name == ":index") { | 6439 if (this.name == ":index") { |
| 6385 return new Value(this.returnType, ("" + target.get$code() + "[" + argsCo
de.$index((0)) + "]"), node.span); | 6440 return new Value(this.returnType, ("" + target.get$code() + "[" + argsCo
de.$index((0)) + "]"), node.span); |
| 6386 } | 6441 } |
| 6387 else if (this.name == ":setindex") { | 6442 else if (this.name == ":setindex") { |
| 6388 return new Value(this.returnType, ("" + target.get$code() + "[" + argsCo
de.$index((0)) + "] = " + argsCode.$index((1))), node.span); | 6443 return new Value(this.returnType, ("" + target.get$code() + "[" + argsCo
de.$index((0)) + "] = " + argsCode.$index((1))), node.span); |
| 6389 } | 6444 } |
| 6390 } | 6445 } |
| 6391 } | 6446 } |
| 6392 if (this.name == ":eq" || this.name == ":ne") { | 6447 if (this.name == ":eq" || this.name == ":ne") { |
| (...skipping 7656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14049 var sw = new StopwatchImplementation(); | 14104 var sw = new StopwatchImplementation(); |
| 14050 sw.start(); | 14105 sw.start(); |
| 14051 var result = f(); | 14106 var result = f(); |
| 14052 sw.stop(); | 14107 sw.stop(); |
| 14053 this.info(("" + name + " in " + sw.elapsedInMs() + "msec")); | 14108 this.info(("" + name + " in " + sw.elapsedInMs() + "msec")); |
| 14054 return result; | 14109 return result; |
| 14055 } | 14110 } |
| 14056 // ********** Code for FrogOptions ************** | 14111 // ********** Code for FrogOptions ************** |
| 14057 function FrogOptions(homedir, args, files) { | 14112 function FrogOptions(homedir, args, files) { |
| 14058 this.legOnly = false; | 14113 this.legOnly = false; |
| 14059 this.throwOnFatal = false; | 14114 this.disableBoundsChecks = false; |
| 14060 this.maxInferenceIterations = (4); | 14115 this.maxInferenceIterations = (4); |
| 14061 this.config = "dev"; | |
| 14062 this.throwOnWarnings = false; | 14116 this.throwOnWarnings = false; |
| 14063 this.inferTypes = false; | 14117 this.inferTypes = false; |
| 14064 this.verifyImplements = false; | |
| 14065 this.warningsAsErrors = false; | 14118 this.warningsAsErrors = false; |
| 14066 this.enableLeg = false; | |
| 14067 this.enableAsserts = false; | 14119 this.enableAsserts = false; |
| 14068 this.enableTypeChecks = false; | |
| 14069 this.forceDynamic = false; | 14120 this.forceDynamic = false; |
| 14070 this.showInfo = false; | |
| 14071 this.dietParse = false; | 14121 this.dietParse = false; |
| 14072 this.useColors = true; | |
| 14073 this.compileOnly = false; | 14122 this.compileOnly = false; |
| 14074 this.showWarnings = true; | 14123 this.showWarnings = true; |
| 14124 this.throwOnFatal = false; |
| 14125 this.config = "dev"; |
| 14126 this.verifyImplements = false; |
| 14127 this.enableLeg = false; |
| 14128 this.enableTypeChecks = false; |
| 14129 this.showInfo = false; |
| 14130 this.useColors = true; |
| 14075 this.compileAll = false; | 14131 this.compileAll = false; |
| 14076 this.throwOnErrors = false; | 14132 this.throwOnErrors = false; |
| 14077 if ($eq(this.config, "dev")) { | 14133 if ($eq(this.config, "dev")) { |
| 14078 this.libDir = joinPaths(homedir, "/lib"); | 14134 this.libDir = joinPaths(homedir, "/lib"); |
| 14079 } | 14135 } |
| 14080 else if ($eq(this.config, "sdk")) { | 14136 else if ($eq(this.config, "sdk")) { |
| 14081 this.libDir = joinPaths(homedir, "/../lib"); | 14137 this.libDir = joinPaths(homedir, "/../lib"); |
| 14082 } | 14138 } |
| 14083 else { | 14139 else { |
| 14084 $globals.world.error(("Invalid configuration " + this.config)); | 14140 $globals.world.error(("Invalid configuration " + this.config)); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14172 case "--no_colors": | 14228 case "--no_colors": |
| 14173 | 14229 |
| 14174 this.useColors = false; | 14230 this.useColors = false; |
| 14175 break; | 14231 break; |
| 14176 | 14232 |
| 14177 case "--Xinfer_types": | 14233 case "--Xinfer_types": |
| 14178 | 14234 |
| 14179 this.inferTypes = true; | 14235 this.inferTypes = true; |
| 14180 break; | 14236 break; |
| 14181 | 14237 |
| 14238 case "--checked": |
| 14239 |
| 14240 this.enableTypeChecks = true; |
| 14241 this.enableAsserts = true; |
| 14242 break; |
| 14243 |
| 14244 case "--unchecked": |
| 14245 |
| 14246 this.disableBoundsChecks = true; |
| 14247 break; |
| 14248 |
| 14182 default: | 14249 default: |
| 14183 | 14250 |
| 14184 if (arg.endsWith(".dart")) { | 14251 if (arg.endsWith(".dart")) { |
| 14185 this.dartScript = arg; | 14252 this.dartScript = arg; |
| 14186 this.childArgs = args.getRange(i + (1), args.get$length() - i - (1)); | 14253 this.childArgs = args.getRange(i + (1), args.get$length() - i - (1)); |
| 14187 break loop; | 14254 break loop; |
| 14188 } | 14255 } |
| 14189 else if (arg.startsWith("--out=")) { | 14256 else if (arg.startsWith("--out=")) { |
| 14190 this.outfile = arg.substring$1("--out=".length); | 14257 this.outfile = arg.substring$1("--out=".length); |
| 14191 } | 14258 } |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14526 } | 14593 } |
| 14527 var const$0000 = Object.create(_DeletedKeySentinel.prototype, {}); | 14594 var const$0000 = Object.create(_DeletedKeySentinel.prototype, {}); |
| 14528 var const$0001 = Object.create(NoMoreElementsException.prototype, {}); | 14595 var const$0001 = Object.create(NoMoreElementsException.prototype, {}); |
| 14529 var const$0002 = Object.create(EmptyQueueException.prototype, {}); | 14596 var const$0002 = Object.create(EmptyQueueException.prototype, {}); |
| 14530 var const$0006 = Object.create(IllegalAccessException.prototype, {}); | 14597 var const$0006 = Object.create(IllegalAccessException.prototype, {}); |
| 14531 var const$0007 = ImmutableList.ImmutableList$from$factory([]); | 14598 var const$0007 = ImmutableList.ImmutableList$from$factory([]); |
| 14532 var const$0009 = new JSSyntaxRegExp("^[a-zA-Z]:/"); | 14599 var const$0009 = new JSSyntaxRegExp("^[a-zA-Z]:/"); |
| 14533 var $globals = {}; | 14600 var $globals = {}; |
| 14534 $static_init(); | 14601 $static_init(); |
| 14535 main(); | 14602 main(); |
| OLD | NEW |