Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Generated by dart2js, the Dart to JavaScript compiler. | |
| 2 // The code supports the following hooks: | |
| 3 // dartPrint(message) - if this function is defined it is called | |
| 4 // instead of the Dart [print] method. | |
| 5 // dartMainRunner(main) - if this function is defined, the Dart [main] | |
| 6 // method will not be invoked directly. | |
| 7 // Instead, a closure that will invoke [main] is | |
| 8 // passed to [dartMainRunner]. | |
| 9 function Isolate() {} | |
| 10 init(); | |
| 11 | |
| 12 var $$ = {}; | |
| 13 var $ = Isolate.$isolateProperties; | |
| 14 $$.StringBufferImpl = {'': function StringBufferImpl(_buffer, _length) { this._b uffer = _buffer; this._length = _length; }, | |
|
kasperl
2012/10/18 09:20:07
Looks like we could use shorter argument names fai
floitsch
2012/10/18 10:33:09
Done.
| |
| 15 "super": "Object", | |
| 16 get$length: function() { | |
| 17 return this._length; | |
| 18 }, | |
| 19 isEmpty$0: function() { | |
| 20 return this._length === 0; | |
| 21 }, | |
| 22 add$1: function(obj) { | |
| 23 var str = $.toString(obj); | |
| 24 if (str == null || $.isEmpty(str) === true) | |
| 25 return this; | |
| 26 $.add$1(this._buffer, str); | |
| 27 this._length = $.add(this._length, $.get$length(str)); | |
| 28 return this; | |
| 29 }, | |
| 30 clear$0: function() { | |
| 31 this._buffer = $.ListImplementation_List(null); | |
| 32 this._length = 0; | |
| 33 return this; | |
| 34 }, | |
| 35 toString$0: function() { | |
| 36 if ($.get$length(this._buffer) === 0) | |
| 37 return ''; | |
| 38 if ($.get$length(this._buffer) === 1) | |
| 39 return $.index(this._buffer, 0); | |
| 40 var result = $.StringImplementation_concatAll(this._buffer); | |
| 41 $.clear(this._buffer); | |
| 42 $.add$1(this._buffer, result); | |
| 43 return result; | |
| 44 }, | |
| 45 StringBufferImpl$1: function(content$) { | |
| 46 this.clear$0(); | |
| 47 this.add$1(content$); | |
| 48 } | |
| 49 }; | |
| 50 | |
| 51 $$.ArgumentError = {'': function ArgumentError(message) { this.message = message ; }, | |
| 52 "super": "Object", | |
| 53 toString$0: function() { | |
| 54 var t1 = this.message; | |
| 55 if (!(t1 == null)) | |
| 56 return 'Illegal argument(s): ' + $.S(t1); | |
| 57 return 'Illegal argument(s)'; | |
| 58 } | |
| 59 }; | |
| 60 | |
| 61 $$.IndexOutOfRangeException = {'': function IndexOutOfRangeException(_value) { t his._value = _value; }, | |
| 62 "super": "Object", | |
| 63 toString$0: function() { | |
| 64 return 'IndexOutOfRangeException: ' + $.S(this._value); | |
| 65 } | |
| 66 }; | |
| 67 | |
| 68 $$.NullPointerException = {'': function NullPointerException(functionName, argum ents) { this.functionName = functionName; this.arguments = arguments; }, | |
| 69 "super": "Object", | |
| 70 toString$0: function() { | |
| 71 var t1 = this.functionName; | |
| 72 if (t1 == null) | |
| 73 return this.get$exceptionName(); | |
| 74 else | |
| 75 return $.S(this.get$exceptionName()) + ' : method: \'' + $.S(t1) + '\'\n' + 'Receiver: null\n' + 'Arguments: ' + $.S(this.arguments); | |
| 76 }, | |
| 77 get$exceptionName: function() { | |
| 78 return 'NullPointerException'; | |
| 79 } | |
| 80 }; | |
| 81 | |
| 82 $$.NoMoreElementsException = {'': function NoMoreElementsException() { }, | |
| 83 "super": "Object", | |
| 84 toString$0: function() { | |
| 85 return 'NoMoreElementsException'; | |
| 86 } | |
| 87 }; | |
| 88 | |
| 89 $$.UnsupportedOperationException = {'': function UnsupportedOperationException(_ message) { this._message = _message; }, | |
| 90 "super": "Object", | |
| 91 toString$0: function() { | |
| 92 return 'UnsupportedOperationException: ' + this._message; | |
| 93 } | |
| 94 }; | |
| 95 | |
| 96 $$.Object = {'': function Object() { }, | |
| 97 "super": "", | |
| 98 operator$eq$1: function(other) { | |
| 99 return this === other; | |
| 100 }, | |
| 101 toString$0: function() { | |
| 102 return $.Primitives_objectToString(this); | |
| 103 } | |
| 104 }; | |
| 105 | |
| 106 $$.ListIterator = {'': function ListIterator(i, list) { this.i = i; this.list = list; }, | |
| 107 "super": "Object", | |
| 108 hasNext$0: function() { | |
| 109 return this.i < this.list.length; | |
| 110 }, | |
| 111 next$0: function() { | |
| 112 if (this.hasNext$0() !== true) | |
| 113 throw $.$$throw($.NoMoreElementsException$()); | |
| 114 var value = this.list[this.i]; | |
| 115 this.i = this.i + 1; | |
| 116 return value; | |
| 117 } | |
| 118 }; | |
| 119 | |
| 120 $$.Closure = {'': function Closure() { }, | |
| 121 "super": "Object", | |
| 122 toString$0: function() { | |
| 123 return 'Closure'; | |
| 124 } | |
| 125 }; | |
| 126 | |
| 127 $$.MetaInfo = {'': function MetaInfo(_tag, _tags, _set) { this._tag = _tag; this ._tags = _tags; this._set = _set; }, | |
| 128 "super": "Object", | |
| 129 get$_tag: function() { return this._tag; }, | |
| 130 get$_set: function() { return this._set; } | |
| 131 }; | |
| 132 | |
| 133 $$.C = {'': function C(titi, toto) { this.titi = titi; this.toto = toto; }, | |
| 134 "super": "Object", | |
| 135 set$titi: function(v) { this.titi = v; }, | |
| 136 get$toto: function() { return this.toto; }, | |
| 137 foo$0: function() { | |
| 138 return 499; | |
| 139 } | |
| 140 }; | |
| 141 | |
| 142 $$.Maps__emitMap_anon = {'': function Maps__emitMap_anon(result_3, box_0, visiti ng_2) { this.result_3 = result_3; this.box_0 = box_0; this.visiting_2 = visiting _2; }, | |
| 143 "super": "Closure", | |
| 144 call$2: function(k, v) { | |
| 145 var t1 = this.box_0; | |
| 146 if (t1.first_1 !== true) | |
| 147 $.add$1(this.result_3, ', '); | |
| 148 t1.first_1 = false; | |
| 149 t1 = this.result_3; | |
| 150 var t2 = this.visiting_2; | |
| 151 $.Collections__emitObject(k, t1, t2); | |
| 152 $.add$1(t1, ': '); | |
| 153 $.Collections__emitObject(v, t1, t2); | |
| 154 } | |
| 155 }; | |
| 156 | |
| 157 $.S = function(value) { | |
| 158 var res = $.toString(value); | |
| 159 if (!(typeof res === 'string')) | |
| 160 throw $.$$throw($.ArgumentError$(value)); | |
| 161 return res; | |
| 162 }; | |
| 163 | |
| 164 $.Collections__emitObject = function(o, result, visiting) { | |
| 165 if (typeof o === 'object' && o !== null && (o.constructor === Array || !!o.is$ Collection)) | |
| 166 if ($.Collections__containsRef(visiting, o)) | |
| 167 $.add$1(result, typeof o === 'object' && o !== null && (o.constructor === Array || !!o.is$List) ? '[...]' : '{...}'); | |
| 168 else | |
| 169 $.Collections__emitCollection(o, result, visiting); | |
| 170 else if (typeof o === 'object' && o !== null && !!o.is$Map) | |
| 171 if ($.Collections__containsRef(visiting, o)) | |
| 172 $.add$1(result, '{...}'); | |
| 173 else | |
| 174 $.Maps__emitMap(o, result, visiting); | |
| 175 else | |
| 176 $.add$1(result, o); | |
| 177 }; | |
| 178 | |
| 179 $.typeNameInOpera = function(obj) { | |
| 180 var name$ = $.constructorNameFallback(obj); | |
| 181 if (name$ === 'Window') | |
| 182 return 'DOMWindow'; | |
| 183 return name$; | |
| 184 }; | |
| 185 | |
| 186 $._dynamicMetadata = function(table) { | |
| 187 $dynamicMetadata = table; | |
| 188 }; | |
| 189 | |
| 190 $.Maps__emitMap = function(m, result, visiting) { | |
| 191 var t1 = {}; | |
| 192 $.add$1(visiting, m); | |
| 193 $.add$1(result, '{'); | |
| 194 t1.first_1 = true; | |
| 195 m.forEach$1(new $.Maps__emitMap_anon(result, t1, visiting)); | |
| 196 $.add$1(result, '}'); | |
| 197 $.removeLast(visiting); | |
| 198 }; | |
| 199 | |
| 200 $._dynamicMetadata0 = function() { | |
| 201 if ($.identical(typeof($dynamicMetadata), 'undefined')) { | |
| 202 var t1 = []; | |
| 203 $._dynamicMetadata(t1); | |
| 204 } | |
| 205 return $dynamicMetadata; | |
| 206 }; | |
| 207 | |
| 208 $.floor = function(receiver) { | |
| 209 return Math.floor(receiver); | |
| 210 }; | |
| 211 | |
| 212 $.truncate = function(receiver) { | |
| 213 return receiver < 0 ? $.ceil(receiver) : $.floor(receiver); | |
| 214 }; | |
| 215 | |
| 216 $.toStringForNativeObject = function(obj) { | |
| 217 return 'Instance of ' + $.getTypeNameOf(obj); | |
| 218 }; | |
| 219 | |
| 220 $.charCodeAt = function(receiver, index) { | |
| 221 if (typeof receiver === 'string') { | |
| 222 if (index < 0) | |
| 223 throw $.$$throw($.IndexOutOfRangeException$(index)); | |
| 224 if (index >= receiver.length) | |
| 225 throw $.$$throw($.IndexOutOfRangeException$(index)); | |
| 226 return receiver.charCodeAt(index); | |
| 227 } else | |
| 228 return receiver.charCodeAt$1(index); | |
| 229 }; | |
| 230 | |
| 231 $.identical = function(a, b) { | |
| 232 return a == null ? b == null : a === b; | |
| 233 }; | |
| 234 | |
| 235 $.checkNull = function(object) { | |
| 236 if (object == null) | |
| 237 throw $.$$throw($.NullPointerException$(null, $.CTC0)); | |
| 238 return object; | |
| 239 }; | |
| 240 | |
| 241 $.eqB = function(a, b) { | |
| 242 if (a == null) | |
| 243 return b == null; | |
| 244 if (b == null) | |
| 245 return false; | |
| 246 if (typeof a === "object") | |
| 247 if (!!a.operator$eq$1) | |
| 248 return $.identical(a.operator$eq$1(b), true); | |
| 249 return a === b; | |
| 250 }; | |
| 251 | |
| 252 $.substring$2 = function(receiver, startIndex, endIndex) { | |
| 253 $.checkNum(startIndex); | |
| 254 var length$ = receiver.length; | |
| 255 if (endIndex == null) | |
| 256 endIndex = length$; | |
| 257 $.checkNum(endIndex); | |
| 258 if (startIndex < 0) | |
| 259 throw $.$$throw($.IndexOutOfRangeException$(startIndex)); | |
| 260 if ($.gtB(startIndex, endIndex)) | |
| 261 throw $.$$throw($.IndexOutOfRangeException$(startIndex)); | |
| 262 if ($.gtB(endIndex, length$)) | |
| 263 throw $.$$throw($.IndexOutOfRangeException$(endIndex)); | |
| 264 return $.substringUnchecked(receiver, startIndex, endIndex); | |
| 265 }; | |
| 266 | |
| 267 $.Collections__containsRef = function(c, ref) { | |
| 268 for (var t1 = $.iterator(c); t1.hasNext$0() === true;) { | |
| 269 var t2 = t1.next$0(); | |
| 270 if (t2 == null ? ref == null : t2 === ref) | |
| 271 return true; | |
| 272 } | |
| 273 return false; | |
| 274 }; | |
| 275 | |
| 276 $.dynamicBind = function(obj, name$, methods, arguments$) { | |
| 277 var tag = $.getTypeNameOf(obj); | |
| 278 var method = methods[tag]; | |
| 279 if (method == null && !($._dynamicMetadata0() == null)) | |
| 280 for (var i = 0; i < $._dynamicMetadata0().length; ++i) { | |
| 281 var entry = $._dynamicMetadata0()[i]; | |
| 282 if (entry.get$_set()[tag]) { | |
| 283 method = methods[entry.get$_tag()]; | |
| 284 if (!(method == null)) | |
| 285 break; | |
| 286 } | |
| 287 } | |
| 288 if (method == null) | |
| 289 method = methods['Object']; | |
| 290 var proto = Object.getPrototypeOf(obj); | |
| 291 if (method == null) | |
| 292 method = function () {if (Object.getPrototypeOf(this) === proto) {throw new TypeError(name$ + " is not a function");} else {return Object.prototype[name$].a pply(this, arguments);}}; | |
| 293 if (!proto.hasOwnProperty(name$)) | |
| 294 $.defineProperty(proto, name$, method); | |
| 295 return method.apply(obj, arguments$); | |
| 296 }; | |
| 297 | |
| 298 $.ArgumentError$ = function(message) { | |
| 299 return new $.ArgumentError(message); | |
| 300 }; | |
| 301 | |
| 302 $.C$ = function(titi, toto) { | |
| 303 return new $.C(titi, toto); | |
| 304 }; | |
| 305 | |
| 306 $.checkGrowable = function(list, reason) { | |
| 307 if (!!(list.fixed$length)) | |
| 308 throw $.$$throw($.UnsupportedOperationException$(reason)); | |
| 309 }; | |
| 310 | |
| 311 $.getFunctionForTypeNameOf = function() { | |
| 312 if (!$.identical(typeof(navigator), 'object')) | |
| 313 return $.typeNameInChrome; | |
| 314 var userAgent = navigator.userAgent; | |
| 315 if ($.contains(userAgent, 'Chrome') || $.contains(userAgent, 'DumpRenderTree') ) | |
| 316 return $.typeNameInChrome; | |
| 317 else if ($.contains(userAgent, 'Firefox')) | |
| 318 return $.typeNameInFirefox; | |
| 319 else if ($.contains(userAgent, 'MSIE')) | |
| 320 return $.typeNameInIE; | |
| 321 else if ($.contains(userAgent, 'Opera')) | |
| 322 return $.typeNameInOpera; | |
| 323 else if ($.contains(userAgent, 'AppleWebKit')) | |
| 324 return $.typeNameInSafari; | |
| 325 else | |
| 326 return $.constructorNameFallback; | |
| 327 }; | |
| 328 | |
| 329 $.index = function(a, index) { | |
| 330 if (typeof a == "string" || a.constructor === Array) { | |
| 331 var key = index >>> 0; | |
| 332 if ($.identical(key, index) && key < a.length) | |
| 333 return a[key]; | |
| 334 } | |
| 335 return $.index$slow(a, index); | |
| 336 }; | |
| 337 | |
| 338 $.stringJoinUnchecked = function(array, separator) { | |
| 339 return array.join(separator); | |
| 340 }; | |
| 341 | |
| 342 $.isJsArray = function(value) { | |
| 343 return !(value == null) && value.constructor === Array; | |
| 344 }; | |
| 345 | |
| 346 $.Collections_collectionToString = function(c) { | |
| 347 var result = $.StringBuffer_StringBuffer(''); | |
| 348 $.Collections__emitCollection(c, result, $.ListImplementation_List(null)); | |
| 349 return $.toString(result); | |
| 350 }; | |
| 351 | |
| 352 $.MetaInfo$ = function(_tag, _tags, _set) { | |
| 353 return new $.MetaInfo(_tag, _tags, _set); | |
| 354 }; | |
| 355 | |
| 356 $.makeA = function() { | |
| 357 return makeA(); | |
| 358 }; | |
| 359 | |
| 360 $.id = function(x) { | |
| 361 if (x == null) | |
| 362 return x; | |
| 363 return x; | |
| 364 }; | |
| 365 | |
| 366 $.dynamicSetMetadata = function(inputTable) { | |
| 367 var t1 = $.buildDynamicMetadata(inputTable); | |
| 368 $._dynamicMetadata(t1); | |
| 369 }; | |
| 370 | |
| 371 $.buildDynamicMetadata = function(inputTable) { | |
| 372 var result = []; | |
| 373 for (var i = 0; i < inputTable.length; ++i) { | |
| 374 var tag = inputTable[i][0]; | |
| 375 var array = inputTable[i]; | |
| 376 var tags = array[1]; | |
| 377 var set = {}; | |
| 378 var tagNames = tags.split('|'); | |
| 379 for (var j = 0, index = 1; j < tagNames.length; ++j) { | |
| 380 $.propertySet(set, tagNames[j], true); | |
| 381 index = j; | |
| 382 array = tagNames; | |
| 383 } | |
| 384 result.push($.MetaInfo$(tag, tags, set)); | |
| 385 } | |
| 386 return result; | |
| 387 }; | |
| 388 | |
| 389 $.add$1 = function(receiver, value) { | |
| 390 if ($.isJsArray(receiver)) { | |
| 391 $.checkGrowable(receiver, 'add'); | |
| 392 receiver.push(value); | |
| 393 return; | |
| 394 } | |
| 395 return receiver.add$1(value); | |
| 396 }; | |
| 397 | |
| 398 $.defineProperty = function(obj, property, value) { | |
| 399 Object.defineProperty(obj, property, | |
| 400 {value: value, enumerable: false, writable: true, configurable: true}); | |
| 401 }; | |
| 402 | |
| 403 $.propertySet = function(object, property, value) { | |
| 404 object[property] = value; | |
| 405 }; | |
| 406 | |
| 407 $.substringUnchecked = function(receiver, startIndex, endIndex) { | |
| 408 return receiver.substring(startIndex, endIndex); | |
| 409 }; | |
| 410 | |
| 411 $.ListImplementation_List = function(length$) { | |
| 412 return $.Primitives_newList(length$); | |
| 413 }; | |
| 414 | |
| 415 $.dynamicFunction = function(name$) { | |
| 416 var f = Object.prototype[name$]; | |
| 417 if (!(f == null) && !!f.methods) | |
| 418 return f.methods; | |
| 419 var methods = {}; | |
| 420 var dartMethod = Object.getPrototypeOf($.CTC1)[name$]; | |
| 421 if (!(dartMethod == null)) | |
| 422 $.propertySet(methods, 'Object', dartMethod); | |
| 423 var bind = function() {return $.dynamicBind.call$4(this, name$, methods, Array .prototype.slice.call(arguments));}; | |
| 424 bind.methods = methods; | |
| 425 $.defineProperty(Object.prototype, name$, bind); | |
| 426 return methods; | |
| 427 }; | |
| 428 | |
| 429 $.add = function(a, b) { | |
| 430 return typeof a === 'number' && typeof b === 'number' ? a + b : $.add$slow(a, b); | |
| 431 }; | |
| 432 | |
| 433 $.checkNumbers = function(a, b) { | |
| 434 if (typeof a === 'number') | |
| 435 if (typeof b === 'number') | |
| 436 return true; | |
| 437 else { | |
| 438 $.checkNull(b); | |
| 439 throw $.$$throw($.ArgumentError$(b)); | |
| 440 } | |
| 441 return false; | |
| 442 }; | |
| 443 | |
| 444 $.UnsupportedOperationException$ = function(_message) { | |
| 445 return new $.UnsupportedOperationException(_message); | |
| 446 }; | |
| 447 | |
| 448 $.contains = function(userAgent, name$) { | |
| 449 return userAgent.indexOf(name$) !== -1; | |
| 450 }; | |
| 451 | |
| 452 $.get$length = function(receiver) { | |
| 453 if (typeof receiver === 'string' || $.isJsArray(receiver)) | |
| 454 return receiver.length; | |
| 455 else | |
| 456 return receiver.get$length(); | |
| 457 }; | |
| 458 | |
| 459 $.hashCodeForNativeObject = function(object) { | |
| 460 return $.Primitives_objectHashCode(object); | |
| 461 }; | |
| 462 | |
| 463 $.ge$slow = function(a, b) { | |
| 464 if ($.checkNumbers(a, b)) | |
| 465 return a >= b; | |
| 466 return a.operator$ge$1(b); | |
| 467 }; | |
| 468 | |
| 469 $.geB = function(a, b) { | |
| 470 return typeof a === 'number' && typeof b === 'number' ? a >= b : $.identical($ .ge$slow(a, b), true); | |
| 471 }; | |
| 472 | |
| 473 $.ListIterator$ = function(list) { | |
| 474 return new $.ListIterator(0, list); | |
| 475 }; | |
| 476 | |
| 477 $.lt$slow = function(a, b) { | |
| 478 if ($.checkNumbers(a, b)) | |
| 479 return a < b; | |
| 480 return a.operator$lt$1(b); | |
| 481 }; | |
| 482 | |
| 483 $.checkNum = function(value) { | |
| 484 if (!(typeof value === 'number')) { | |
| 485 $.checkNull(value); | |
| 486 throw $.$$throw($.ArgumentError$(value)); | |
| 487 } | |
| 488 return value; | |
| 489 }; | |
| 490 | |
| 491 $.StringBufferImpl$ = function(content$) { | |
| 492 var t1 = new $.StringBufferImpl(null, null); | |
| 493 t1.StringBufferImpl$1(content$); | |
| 494 return t1; | |
| 495 }; | |
| 496 | |
| 497 $.Primitives_objectToString = function(object) { | |
| 498 return 'Instance of \'' + $.S($.Primitives_objectTypeName(object)) + '\''; | |
| 499 }; | |
| 500 | |
| 501 $.index$slow = function(a, index) { | |
| 502 if (typeof a === 'string' || $.isJsArray(a)) { | |
| 503 if (!(typeof index === 'number' && Math.floor(index) === index)) { | |
| 504 if (!(typeof index === 'number')) | |
| 505 throw $.$$throw($.ArgumentError$(index)); | |
| 506 if (!$.identical($.truncate(index), index)) | |
| 507 throw $.$$throw($.ArgumentError$(index)); | |
| 508 } | |
| 509 if ($.ltB(index, 0) || $.geB(index, $.get$length(a))) | |
| 510 throw $.$$throw($.IndexOutOfRangeException$(index)); | |
| 511 return a[index]; | |
| 512 } | |
| 513 return a.operator$index$1(index); | |
| 514 }; | |
| 515 | |
| 516 $.substring$1 = function(receiver, startIndex) { | |
| 517 if (!(typeof receiver === 'string')) | |
| 518 return receiver.substring$1(startIndex); | |
| 519 return $.substring$2(receiver, startIndex, null); | |
| 520 }; | |
| 521 | |
| 522 $.typeNameInSafari = function(obj) { | |
| 523 var name$ = $.constructorNameFallback(obj); | |
| 524 if (name$ === 'Window') | |
| 525 return 'DOMWindow'; | |
| 526 if (name$ === 'CanvasPixelArray') | |
| 527 return 'Uint8ClampedArray'; | |
| 528 if (name$ === 'WebKitMutationObserver') | |
| 529 return 'MutationObserver'; | |
| 530 return name$; | |
| 531 }; | |
| 532 | |
| 533 $.Collections__emitCollection = function(c, result, visiting) { | |
| 534 $.add$1(visiting, c); | |
| 535 var isList = typeof c === 'object' && c !== null && (c.constructor === Array | | !!c.is$List); | |
| 536 $.add$1(result, isList ? '[' : '{'); | |
| 537 for (var t1 = $.iterator(c), first = true; t1.hasNext$0() === true;) { | |
| 538 var t2 = t1.next$0(); | |
| 539 if (!first) | |
| 540 $.add$1(result, ', '); | |
| 541 $.Collections__emitObject(t2, result, visiting); | |
| 542 first = false; | |
| 543 } | |
| 544 $.add$1(result, isList ? ']' : '}'); | |
| 545 $.removeLast(visiting); | |
| 546 }; | |
| 547 | |
| 548 $.clear = function(receiver) { | |
| 549 if (!$.isJsArray(receiver)) | |
| 550 return receiver.clear$0(); | |
| 551 $.set$length(receiver, 0); | |
| 552 }; | |
| 553 | |
| 554 $.Primitives_objectTypeName = function(object) { | |
| 555 var name$ = $.constructorNameFallback(object); | |
| 556 if ($.eqB(name$, 'Object')) { | |
| 557 var decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\s*\( /)[1]; | |
| 558 if (typeof decompiled === 'string') | |
| 559 name$ = decompiled; | |
| 560 } | |
| 561 return $.identical($.charCodeAt(name$, 0), 36) ? $.substring$1(name$, 1) : nam e$; | |
| 562 }; | |
| 563 | |
| 564 $.toString = function(value) { | |
| 565 if (typeof value == "object" && value !== null) | |
| 566 if ($.isJsArray(value)) | |
| 567 return $.Collections_collectionToString(value); | |
| 568 else | |
| 569 return value.toString$0(); | |
| 570 if (value === 0 && (1 / value) < 0) | |
| 571 return '-0.0'; | |
| 572 if (value == null) | |
| 573 return 'null'; | |
| 574 if (typeof value == "function") | |
| 575 return 'Closure'; | |
| 576 return String(value); | |
| 577 }; | |
| 578 | |
| 579 $.typeNameInIE = function(obj) { | |
| 580 var name$ = $.constructorNameFallback(obj); | |
| 581 if (name$ === 'Window') | |
| 582 return 'DOMWindow'; | |
| 583 if (name$ === 'Document') { | |
| 584 if (!!obj.xmlVersion) | |
| 585 return 'Document'; | |
| 586 return 'HTMLDocument'; | |
| 587 } | |
| 588 if (name$ === 'ApplicationCache') | |
| 589 return 'DOMApplicationCache'; | |
| 590 if (name$ === 'CanvasPixelArray') | |
| 591 return 'Uint8ClampedArray'; | |
| 592 if (name$ === 'DataTransfer') | |
| 593 return 'Clipboard'; | |
| 594 if (name$ === 'DragEvent') | |
| 595 return 'MouseEvent'; | |
| 596 if (name$ === 'HTMLDDElement') | |
| 597 return 'HTMLElement'; | |
| 598 if (name$ === 'HTMLDTElement') | |
| 599 return 'HTMLElement'; | |
| 600 if (name$ === 'HTMLTableDataCellElement') | |
| 601 return 'HTMLTableCellElement'; | |
| 602 if (name$ === 'HTMLTableHeaderCellElement') | |
| 603 return 'HTMLTableCellElement'; | |
| 604 if (name$ === 'HTMLPhraseElement') | |
| 605 return 'HTMLElement'; | |
| 606 if (name$ === 'MSStyleCSSProperties') | |
| 607 return 'CSSStyleDeclaration'; | |
| 608 if (name$ === 'MouseWheelEvent') | |
| 609 return 'WheelEvent'; | |
| 610 return name$; | |
| 611 }; | |
| 612 | |
| 613 $.set$length = function(receiver, newLength) { | |
| 614 if ($.isJsArray(receiver)) { | |
| 615 $.checkNull(newLength); | |
| 616 if (newLength < 0) | |
| 617 throw $.$$throw($.IndexOutOfRangeException$(newLength)); | |
| 618 $.checkGrowable(receiver, 'set length'); | |
| 619 receiver.length = newLength; | |
| 620 } else | |
| 621 receiver.set$length(newLength); | |
| 622 return newLength; | |
| 623 }; | |
| 624 | |
| 625 $.ioore = function(index) { | |
| 626 throw $.$$throw($.IndexOutOfRangeException$(index)); | |
| 627 }; | |
| 628 | |
| 629 $.typeNameInFirefox = function(obj) { | |
| 630 var name$ = $.constructorNameFallback(obj); | |
| 631 if (name$ === 'Window') | |
| 632 return 'DOMWindow'; | |
| 633 if (name$ === 'Document') | |
| 634 return 'HTMLDocument'; | |
| 635 if (name$ === 'XMLDocument') | |
| 636 return 'Document'; | |
| 637 if (name$ === 'WorkerMessageEvent') | |
| 638 return 'MessageEvent'; | |
| 639 if (name$ === 'DragEvent') | |
| 640 return 'MouseEvent'; | |
| 641 if (name$ === 'DataTransfer') | |
| 642 return 'Clipboard'; | |
| 643 if (name$ === 'MouseScrollEvent') | |
| 644 return 'WheelEvent'; | |
| 645 if (name$ === 'OfflineResourceList') | |
| 646 return 'DOMApplicationCache'; | |
| 647 return name$; | |
| 648 }; | |
| 649 | |
| 650 $.constructorNameFallback = function(object) { | |
| 651 if (object == null) | |
| 652 return 'Null'; | |
| 653 var constructor$ = object.constructor; | |
| 654 if ($.identical(typeof(constructor$), 'function')) { | |
| 655 var name$ = constructor$.name; | |
| 656 if (typeof name$ === 'string') | |
| 657 var t1 = !$.identical(name$, '') && !$.identical(name$, 'Object') && !$.id entical(name$, 'Function.prototype'); | |
| 658 else | |
| 659 t1 = false; | |
| 660 if (t1) | |
| 661 return name$; | |
| 662 } | |
| 663 var string = Object.prototype.toString.call(object); | |
| 664 return string.substring(8, string.length - 1); | |
| 665 }; | |
| 666 | |
| 667 $.gt$slow = function(a, b) { | |
| 668 if ($.checkNumbers(a, b)) | |
| 669 return a > b; | |
| 670 return a.operator$gt$1(b); | |
| 671 }; | |
| 672 | |
| 673 $.toStringWrapper = function() { | |
| 674 return $.toString(this.dartException); | |
| 675 }; | |
| 676 | |
| 677 $.gtB = function(a, b) { | |
| 678 return typeof a === 'number' && typeof b === 'number' ? a > b : $.identical($. gt$slow(a, b), true); | |
| 679 }; | |
| 680 | |
| 681 $.NullPointerException$ = function(functionName, arguments$) { | |
| 682 return new $.NullPointerException(functionName, arguments$); | |
| 683 }; | |
| 684 | |
| 685 $.removeLast = function(receiver) { | |
| 686 if ($.isJsArray(receiver)) { | |
| 687 $.checkGrowable(receiver, 'removeLast'); | |
| 688 if ($.eqB($.get$length(receiver), 0)) | |
| 689 throw $.$$throw($.IndexOutOfRangeException$(-1)); | |
| 690 return receiver.pop(); | |
| 691 } | |
| 692 return receiver.removeLast$0(); | |
| 693 }; | |
| 694 | |
| 695 $.NoMoreElementsException$ = function() { | |
| 696 return new $.NoMoreElementsException(); | |
| 697 }; | |
| 698 | |
| 699 $.ltB = function(a, b) { | |
| 700 return typeof a === 'number' && typeof b === 'number' ? a < b : $.identical($. lt$slow(a, b), true); | |
| 701 }; | |
| 702 | |
| 703 $.Primitives_objectHashCode = function(object) { | |
| 704 var hash = object.$identityHash; | |
| 705 if (hash == null) { | |
| 706 hash = $.add($.Primitives_hashCodeSeed, 1); | |
| 707 $.Primitives_hashCodeSeed = hash; | |
| 708 object.$identityHash = hash; | |
| 709 } | |
| 710 return hash; | |
| 711 }; | |
| 712 | |
| 713 $.add$slow = function(a, b) { | |
| 714 if ($.checkNumbers(a, b)) | |
| 715 return a + b; | |
| 716 return a.operator$add$1(b); | |
| 717 }; | |
| 718 | |
| 719 $.Primitives_newList = function(length$) { | |
| 720 if (length$ == null) | |
| 721 return new Array(); | |
| 722 if (!(typeof length$ === 'number' && Math.floor(length$) === length$) || lengt h$ < 0) | |
| 723 throw $.$$throw($.ArgumentError$(length$)); | |
| 724 var result = new Array(length$); | |
| 725 result.fixed$length = true; | |
| 726 return result; | |
| 727 }; | |
| 728 | |
| 729 $.main = function() { | |
| 730 var a = $.makeA(); | |
| 731 var c = $.C$($.id(1), $.id(2)); | |
| 732 $.id($.id(a).get$toto()); | |
| 733 $.id(a).set$titi(499); | |
| 734 $.id(c).foo$0(); | |
| 735 }; | |
| 736 | |
| 737 $.StringBuffer_StringBuffer = function(content$) { | |
| 738 return $.StringBufferImpl$(content$); | |
| 739 }; | |
| 740 | |
| 741 $.$$throw = function(ex) { | |
| 742 if (ex == null) | |
| 743 ex = $.CTC; | |
| 744 var jsError = new Error(); | |
| 745 jsError.name = ex; | |
| 746 jsError.description = ex; | |
| 747 jsError.dartException = ex; | |
| 748 jsError.toString = $.toStringWrapper.call$0; | |
| 749 throw jsError; | |
| 750 }; | |
| 751 | |
| 752 $.typeNameInChrome = function(obj) { | |
| 753 var name$ = obj.constructor.name; | |
| 754 if (name$ === 'Window') | |
| 755 return 'DOMWindow'; | |
| 756 if (name$ === 'CanvasPixelArray') | |
| 757 return 'Uint8ClampedArray'; | |
| 758 if (name$ === 'WebKitMutationObserver') | |
| 759 return 'MutationObserver'; | |
| 760 return name$; | |
| 761 }; | |
| 762 | |
| 763 $.isEmpty = function(receiver) { | |
| 764 if (typeof receiver === 'string' || $.isJsArray(receiver)) | |
| 765 return receiver.length === 0; | |
| 766 return receiver.isEmpty$0(); | |
| 767 }; | |
| 768 | |
| 769 $.StringImplementation_concatAll = function(strings) { | |
| 770 return $.stringJoinUnchecked($.StringImplementation__toJsStringArray(strings), ''); | |
| 771 }; | |
| 772 | |
| 773 $.ceil = function(receiver) { | |
| 774 return Math.ceil(receiver); | |
| 775 }; | |
| 776 | |
| 777 $.getTypeNameOf = function(obj) { | |
| 778 if ($._getTypeNameOf == null) | |
| 779 $._getTypeNameOf = $.getFunctionForTypeNameOf(); | |
| 780 return $._getTypeNameOf.call$1(obj); | |
| 781 }; | |
| 782 | |
| 783 $.iterator = function(receiver) { | |
| 784 if ($.isJsArray(receiver)) | |
| 785 return $.ListIterator$(receiver); | |
| 786 return receiver.iterator$0(); | |
| 787 }; | |
| 788 | |
| 789 $.StringImplementation__toJsStringArray = function(strings) { | |
| 790 if (typeof strings !== 'object' || strings === null || (strings.constructor != = Array || !!strings.immutable$list) && !strings.is$JavaScriptIndexingBehavior) | |
| 791 return $.StringImplementation__toJsStringArray$bailout(1, strings); | |
| 792 $.checkNull(strings); | |
| 793 var length$ = strings.length; | |
| 794 if ($.isJsArray(strings)) { | |
| 795 for (var i = 0; i < length$; ++i) { | |
| 796 if (i >= strings.length) | |
| 797 throw $.ioore(i); | |
| 798 var string = strings[i]; | |
| 799 $.checkNull(string); | |
| 800 if (!(typeof string === 'string')) | |
| 801 throw $.$$throw($.ArgumentError$(string)); | |
| 802 } | |
| 803 var array = strings; | |
| 804 } else { | |
| 805 array = $.ListImplementation_List(length$); | |
| 806 for (i = 0; i < length$; ++i) { | |
| 807 if (i >= strings.length) | |
| 808 throw $.ioore(i); | |
| 809 string = strings[i]; | |
| 810 $.checkNull(string); | |
| 811 if (!(typeof string === 'string')) | |
| 812 throw $.$$throw($.ArgumentError$(string)); | |
| 813 array[i] = string; | |
| 814 } | |
| 815 } | |
| 816 return array; | |
| 817 }; | |
| 818 | |
| 819 $.IndexOutOfRangeException$ = function(_value) { | |
| 820 return new $.IndexOutOfRangeException(_value); | |
| 821 }; | |
| 822 | |
| 823 $.StringImplementation__toJsStringArray$bailout = function(state0, strings) { | |
| 824 $.checkNull(strings); | |
| 825 var length$ = $.get$length(strings); | |
| 826 if ($.isJsArray(strings)) { | |
| 827 for (var i = 0; $.ltB(i, length$); ++i) { | |
| 828 var string = $.index(strings, i); | |
| 829 $.checkNull(string); | |
| 830 if (!(typeof string === 'string')) | |
| 831 throw $.$$throw($.ArgumentError$(string)); | |
| 832 } | |
| 833 var array = strings; | |
| 834 } else { | |
| 835 array = $.ListImplementation_List(length$); | |
| 836 for (i = 0; $.ltB(i, length$); ++i) { | |
| 837 string = $.index(strings, i); | |
| 838 $.checkNull(string); | |
| 839 if (!(typeof string === 'string')) | |
| 840 throw $.$$throw($.ArgumentError$(string)); | |
| 841 if (i >= array.length) | |
| 842 throw $.ioore(i); | |
| 843 array[i] = string; | |
| 844 } | |
| 845 } | |
| 846 return array; | |
| 847 }; | |
| 848 | |
| 849 $.dynamicBind.call$4 = $.dynamicBind; | |
| 850 $.dynamicBind.$name = "dynamicBind"; | |
| 851 $.typeNameInOpera.call$1 = $.typeNameInOpera; | |
| 852 $.typeNameInOpera.$name = "typeNameInOpera"; | |
| 853 $.typeNameInIE.call$1 = $.typeNameInIE; | |
| 854 $.typeNameInIE.$name = "typeNameInIE"; | |
| 855 $.typeNameInChrome.call$1 = $.typeNameInChrome; | |
| 856 $.typeNameInChrome.$name = "typeNameInChrome"; | |
| 857 $.toStringWrapper.call$0 = $.toStringWrapper; | |
| 858 $.toStringWrapper.$name = "toStringWrapper"; | |
| 859 $.typeNameInSafari.call$1 = $.typeNameInSafari; | |
| 860 $.typeNameInSafari.$name = "typeNameInSafari"; | |
| 861 $.typeNameInFirefox.call$1 = $.typeNameInFirefox; | |
| 862 $.typeNameInFirefox.$name = "typeNameInFirefox"; | |
| 863 $.constructorNameFallback.call$1 = $.constructorNameFallback; | |
| 864 $.constructorNameFallback.$name = "constructorNameFallback"; | |
| 865 Isolate.$finishClasses($$); | |
| 866 $$ = {}; | |
| 867 Isolate.makeConstantList = function(list) { | |
| 868 list.immutable$list = true; | |
| 869 list.fixed$length = true; | |
| 870 return list; | |
| 871 }; | |
| 872 $.CTC0 = Isolate.makeConstantList([]); | |
| 873 $.CTC2 = null; | |
| 874 $.CTC = new Isolate.$isolateProperties.NullPointerException(null, Isolate.$isola teProperties.CTC0); | |
| 875 $.CTC1 = new Isolate.$isolateProperties.Object(); | |
| 876 $.Primitives_DOLLAR_CHAR_VALUE = 36; | |
| 877 $._getTypeNameOf = null; | |
| 878 $.Primitives_hashCodeSeed = 0; | |
| 879 var $ = null; | |
| 880 Isolate.$finishClasses($$); | |
| 881 $$ = {}; | |
| 882 Isolate = Isolate.$finishIsolateConstructor(Isolate); | |
| 883 var $ = new Isolate(); | |
| 884 $.$defineNativeClass = function(cls, desc) { | |
| 885 var fields = desc[''] || []; | |
| 886 var generateGetterSetter = function() { | |
| 887 throw 'Internal Error: no dynamic generation of getters and setters allowed'; | |
| 888 }; | |
| 889 for (var i = 0; i < fields.length; i++) { | |
| 890 generateGetterSetter(fields[i], desc); | |
| 891 } | |
| 892 var hasOwnProperty = Object.prototype.hasOwnProperty; | |
| 893 for (var method in desc) { | |
| 894 if (method !== '') { | |
| 895 if (hasOwnProperty.call(desc, method)) { | |
| 896 $.dynamicFunction(method)[cls] = desc[method]; | |
| 897 } | |
| 898 } | |
| 899 } | |
| 900 }; | |
| 901 | |
| 902 (function(table) { | |
| 903 for (var key in table) { | |
| 904 $.defineProperty(Object.prototype, key, table[key]); | |
| 905 } | |
| 906 })({ | |
| 907 toString$0: function() { return $.toStringForNativeObject(this); }, | |
| 908 hashCode$0: function() { return $.hashCodeForNativeObject(this); } | |
| 909 }); | |
| 910 | |
| 911 $.$defineNativeClass('B', { | |
| 912 set$titi: function(v) { this.titi = v; }, | |
| 913 get$toto: function() { return this.toto; }, | |
| 914 foo$0: function() { | |
| 915 return 499; | |
| 916 } | |
| 917 }); | |
| 918 | |
| 919 // 1 dynamic classes. | |
| 920 // 1 classes | |
| 921 // 0 !leaf | |
| 922 | |
| 923 | |
| 924 // | |
| 925 // BEGIN invoke [main]. | |
| 926 // | |
| 927 if (typeof document != 'undefined' && document.readyState != 'complete') { | |
| 928 document.addEventListener('readystatechange', function () { | |
| 929 if (document.readyState == 'complete') { | |
| 930 if (typeof dartMainRunner == 'function') { | |
| 931 dartMainRunner(function() { $.main(); }); | |
| 932 } else { | |
| 933 $.main(); | |
| 934 } | |
| 935 } | |
| 936 }, false); | |
| 937 } else { | |
| 938 if (typeof dartMainRunner == 'function') { | |
| 939 dartMainRunner(function() { $.main(); }); | |
| 940 } else { | |
| 941 $.main(); | |
| 942 } | |
| 943 } | |
| 944 // | |
| 945 // END invoke [main]. | |
| 946 // | |
| 947 | |
| 948 function init() { | |
| 949 Isolate.$isolateProperties = {}; | |
| 950 Isolate.$defineClass = function(cls, constructor, prototype) { | |
| 951 constructor.prototype = prototype; | |
| 952 return constructor; | |
| 953 }; | |
| 954 var supportsProto = !!{}.__proto__;Isolate.$pendingClasses = {}; | |
|
kasperl
2012/10/18 09:20:07
Would be nice with a newline after ;.
floitsch
2012/10/18 10:33:09
Done.
| |
| 955 Isolate.$finishClasses = function(collectedClasses) { | |
| 956 var hasOwnProperty = Object.prototype.hasOwnProperty; | |
| 957 for (var cls in collectedClasses) { | |
| 958 if (hasOwnProperty.call(collectedClasses, cls)) { | |
| 959 var desc = collectedClasses[cls]; | |
| 960 Isolate.$isolateProperties[cls] = Isolate.$defineClass(cls, desc[''], desc ); | |
| 961 if (desc['super'] !== "") Isolate.$pendingClasses[cls] = desc['super']; | |
| 962 } | |
| 963 } | |
| 964 var pendingClasses = Isolate.$pendingClasses; | |
| 965 Isolate.$pendingClasses = {}; | |
| 966 var finishedClasses = {}; | |
| 967 function finishClass(cls) { | |
| 968 var hasOwnProperty = Object.prototype.hasOwnProperty; | |
| 969 if (hasOwnProperty.call(finishedClasses, cls)) return; | |
| 970 finishedClasses[cls] = true; | |
| 971 var superclass = pendingClasses[cls]; | |
| 972 if (!superclass) return; | |
| 973 finishClass(superclass); | |
| 974 var constructor = Isolate.$isolateProperties[cls]; | |
| 975 var superConstructor = Isolate.$isolateProperties[superclass]; | |
| 976 var prototype = constructor.prototype; | |
| 977 if (supportsProto) { | |
| 978 prototype.__proto__ = superConstructor.prototype; | |
| 979 prototype.constructor = constructor; | |
| 980 } else { | |
| 981 function tmp() {}; | |
| 982 tmp.prototype = superConstructor.prototype; | |
| 983 var newPrototype = new tmp(); | |
| 984 constructor.prototype = newPrototype; | |
| 985 newPrototype.constructor = constructor; | |
| 986 for (var member in prototype) { | |
| 987 if (member == '' || member == 'super') continue; | |
| 988 if (hasOwnProperty.call(prototype, member)) { | |
| 989 newPrototype[member] = prototype[member]; | |
| 990 } | |
| 991 } | |
| 992 } | |
| 993 } | |
| 994 for (var cls in pendingClasses) finishClass(cls); | |
| 995 }; | |
| 996 Isolate.$finishIsolateConstructor = function(oldIsolate) { | |
| 997 var isolateProperties = oldIsolate.$isolateProperties; | |
| 998 function Isolate() { | |
| 999 for (var staticName in isolateProperties) { | |
| 1000 if (Object.prototype.hasOwnProperty.call(isolateProperties, staticName)) { | |
| 1001 this[staticName] = isolateProperties[staticName]; | |
| 1002 } | |
| 1003 } | |
| 1004 // Use the newly created object as prototype. In Chrome this creates a | |
| 1005 // hidden class for the object and makes sure it is fast to access. | |
| 1006 function forceEfficientMap() {} | |
|
kasperl
2012/10/18 09:20:07
I think I'd prefer to call this ForceEfficientMap
floitsch
2012/10/18 10:33:09
Done.
| |
| 1007 forceEfficientMap.prototype = this; | |
| 1008 new forceEfficientMap; | |
|
kasperl
2012/10/18 09:20:07
Not necessary.
floitsch
2012/10/18 10:33:09
Benchmark says it is.
| |
| 1009 } | |
| 1010 Isolate.prototype = oldIsolate.prototype; | |
| 1011 Isolate.prototype.constructor = Isolate; | |
| 1012 Isolate.$isolateProperties = isolateProperties; | |
| 1013 return Isolate; | |
| 1014 }; | |
| 1015 } | |
| 1016 | |
| 1017 //@ sourceMappingURL=comp.js.map | |
| OLD | NEW |