-
-
Save darkone23/4115796 to your computer and use it in GitHub Desktop.
Hello world using new dart:isolate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env dart | |
#import('dart:isolate'); | |
isolateCode() { | |
isolate.port.receive((msg, reply) => reply.send("re: $msg")); | |
} | |
void main() { | |
isolate.SendPort sendPort = isolate.spawnFunction(isolateCode); | |
sendPort.call("Hello World").then(print); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Isolate() {} | |
init(); | |
var $$ = {}; | |
var $ = Isolate.$isolateProperties; | |
$$.ListIterator = {"": ["i", "list"], | |
"super": "Object", | |
get$hasNext: function() { | |
return this.i < this.list.length; | |
}, | |
next$0: function() { | |
if (this.get$hasNext() !== true) | |
throw $.$$throw($.StateError$('No more elements')); | |
var value = this.list[this.i]; | |
this.i = this.i + 1; | |
return value; | |
} | |
}; | |
$$.StackTrace = {"": ["stack"], | |
"super": "Object", | |
toString$0: function() { | |
var t1 = this.stack; | |
return !(t1 == null) ? t1 : ''; | |
} | |
}; | |
$$.Closure = {"": [], | |
"super": "Object", | |
toString$0: function() { | |
return 'Closure'; | |
} | |
}; | |
$$.MetaInfo = {"": ["_tag>", "_tags", "_set>"], | |
"super": "Object" | |
}; | |
$$.JSSyntaxRegExp = {"": ["_liblib$_pattern", "_multiLine", "_ignoreCase"], | |
"super": "Object", | |
firstMatch$1: function(str) { | |
var m, matchStart, t1, matchEnd; | |
m = $.regExpExec(this, $.checkString(str)); | |
if (m == null) | |
return; | |
matchStart = m.index; | |
t1 = $.get$length($.index(m, 0)); | |
if (typeof t1 !== 'number') | |
throw $.iae(t1); | |
matchEnd = matchStart + t1; | |
return $._MatchImplementation$(this.get$pattern(), str, matchStart, matchEnd, m); | |
}, | |
get$pattern: function() { | |
return this._liblib$_pattern; | |
}, | |
get$multiLine: function() { | |
return this._multiLine; | |
}, | |
get$ignoreCase: function() { | |
return this._ignoreCase; | |
}, | |
is$JSSyntaxRegExp: true | |
}; | |
$$._MatchImplementation = {"": ["pattern>", "str", "start", "end", "_groups"], | |
"super": "Object", | |
operator$index$1: function(index) { | |
return $.index(this._groups, index); | |
} | |
}; | |
$$.ArgumentError = {"": ["message"], | |
"super": "Object", | |
toString$0: function() { | |
var t1 = this.message; | |
if (!(t1 == null)) | |
return 'Illegal argument(s): ' + $.S(t1); | |
return 'Illegal argument(s)'; | |
} | |
}; | |
$$.RangeError = {"": ["message"], | |
"super": "ArgumentError", | |
toString$0: function() { | |
return 'RangeError: ' + $.S(this.message); | |
} | |
}; | |
$$.NoSuchMethodError = {"": ["_receiver", "_memberName", "_arguments", "_namedArguments", "_existingArgumentNames"], | |
"super": "Object", | |
toString$0: function() { | |
var t1, t2, t3, t4, t5, actualParameters, i, formalParameters; | |
t1 = {}; | |
t1.sb_1 = $.StringBuffer_StringBuffer(''); | |
t1.i_2 = 0; | |
t2 = this._arguments; | |
if (typeof t2 !== 'string' && (typeof t2 !== 'object' || t2 === null || t2.constructor !== Array && !t2.is$JavaScriptIndexingBehavior)) | |
return this.toString$0$bailout(1, t1, t2); | |
for (; $.ltB(t1.i_2, t2.length); t1.i_2 = $.add(t1.i_2, 1)) { | |
if ($.gtB(t1.i_2, 0)) { | |
t3 = t1.sb_1; | |
$.getInterceptor(t3).add$1(t3, ', '); | |
} | |
t3 = t1.sb_1; | |
t4 = $.getInterceptor(t3); | |
t5 = t1.i_2; | |
if (t5 !== (t5 | 0)) | |
throw $.iae(t5); | |
if (t5 < 0 || t5 >= t2.length) | |
throw $.ioore(t5); | |
t4.add$1(t3, $.NoSuchMethodError_safeToString(t2[t5])); | |
} | |
t2 = this._namedArguments; | |
if (!(t2 == null)) | |
$.getInterceptor(t2).forEach$1(t2, new $.NoSuchMethodError_toString_anon(t1)); | |
t2 = this._existingArgumentNames; | |
if (typeof t2 !== 'string' && (typeof t2 !== 'object' || t2 === null || t2.constructor !== Array && !t2.is$JavaScriptIndexingBehavior)) | |
return this.toString$0$bailout(2, t1, t2); | |
actualParameters = $.toString(t1.sb_1); | |
t1.sb_1 = $.StringBuffer_StringBuffer(''); | |
for (i = 0; i < t2.length; ++i) { | |
if (i > 0) { | |
t3 = t1.sb_1; | |
$.getInterceptor(t3).add$1(t3, ', '); | |
} | |
t3 = t1.sb_1; | |
t4 = $.getInterceptor(t3); | |
if (i >= t2.length) | |
throw $.ioore(i); | |
t4.add$1(t3, t2[i]); | |
} | |
formalParameters = $.toString(t1.sb_1); | |
t2 = this._memberName; | |
return 'NoSuchMethodError: incorrect number of arguments passed to method named \'' + $.S(t2) + '\'\n' + 'Receiver: ' + $.S($.NoSuchMethodError_safeToString(this._receiver)) + '\n' + 'Tried calling: ' + $.S(t2) + '(' + $.S(actualParameters) + ')\n' + 'Found: ' + $.S(t2) + '(' + $.S(formalParameters) + ')'; | |
}, | |
toString$0$bailout: function(state0, env0, env1) { | |
switch (state0) { | |
case 1: | |
t2 = env1; | |
t1 = env0; | |
break; | |
case 2: | |
t2 = env1; | |
t1 = env0; | |
break; | |
} | |
switch (state0) { | |
case 0: | |
t1 = {}; | |
t1.sb_1 = $.StringBuffer_StringBuffer(''); | |
t1.i_2 = 0; | |
t2 = this._arguments; | |
case 1: | |
state0 = 0; | |
if (!(t2 == null)) | |
for (; $.ltB(t1.i_2, $.get$length(t2)); t1.i_2 = $.add(t1.i_2, 1)) { | |
if ($.gtB(t1.i_2, 0)) { | |
t3 = t1.sb_1; | |
$.getInterceptor(t3).add$1(t3, ', '); | |
} | |
t3 = t1.sb_1; | |
$.getInterceptor(t3).add$1(t3, $.NoSuchMethodError_safeToString($.index(t2, t1.i_2))); | |
} | |
t2 = this._namedArguments; | |
if (!(t2 == null)) | |
$.getInterceptor(t2).forEach$1(t2, new $.NoSuchMethodError_toString_anon(t1)); | |
t2 = this._existingArgumentNames; | |
case 2: | |
var t1, t2, t3, actualParameters, i, formalParameters; | |
state0 = 0; | |
if (t2 == null) | |
return 'NoSuchMethodError : method not found: \'' + $.S(this._memberName) + '\'\n' + 'Receiver: ' + $.S($.NoSuchMethodError_safeToString(this._receiver)) + '\n' + 'Arguments: [' + $.S(t1.sb_1) + ']'; | |
else { | |
actualParameters = $.toString(t1.sb_1); | |
t1.sb_1 = $.StringBuffer_StringBuffer(''); | |
for (i = 0; $.ltB(i, $.get$length(t2)); ++i) { | |
if (i > 0) { | |
t3 = t1.sb_1; | |
$.getInterceptor(t3).add$1(t3, ', '); | |
} | |
t3 = t1.sb_1; | |
$.getInterceptor(t3).add$1(t3, $.index(t2, i)); | |
} | |
formalParameters = $.toString(t1.sb_1); | |
t2 = this._memberName; | |
return 'NoSuchMethodError: incorrect number of arguments passed to method named \'' + $.S(t2) + '\'\n' + 'Receiver: ' + $.S($.NoSuchMethodError_safeToString(this._receiver)) + '\n' + 'Tried calling: ' + $.S(t2) + '(' + $.S(actualParameters) + ')\n' + 'Found: ' + $.S(t2) + '(' + $.S(formalParameters) + ')'; | |
} | |
} | |
} | |
}; | |
$$.UnsupportedError = {"": ["message>"], | |
"super": "Object", | |
toString$0: function() { | |
return 'Unsupported operation: ' + $.S(this.get$message()); | |
} | |
}; | |
$$.UnimplementedError = {"": ["message>"], | |
"super": "Object", | |
toString$0: function() { | |
var t1 = this.message; | |
return !(t1 == null) ? 'UnimplementedError: ' + $.S(t1) : 'UnimplementedError'; | |
} | |
}; | |
$$.StateError = {"": ["message"], | |
"super": "Object", | |
toString$0: function() { | |
return 'Bad state: ' + this.message; | |
} | |
}; | |
$$.StackOverflowError = {"": [], | |
"super": "Object", | |
toString$0: function() { | |
return 'Stack Overflow'; | |
} | |
}; | |
$$._ExceptionImplementation = {"": ["message"], | |
"super": "Object", | |
toString$0: function() { | |
var t1 = this.message; | |
return t1 == null ? 'Exception' : 'Exception: ' + $.S(t1); | |
}, | |
is$Exception: true | |
}; | |
$$.FormatException = {"": ["message"], | |
"super": "Object", | |
toString$0: function() { | |
return 'FormatException: ' + $.S(this.message); | |
}, | |
is$Exception: true | |
}; | |
$$.NullPointerException = {"": ["functionName", "arguments"], | |
"super": "Object", | |
toString$0: function() { | |
var t1 = this.functionName; | |
if (t1 == null) | |
return this.get$exceptionName(); | |
else | |
return $.S(this.get$exceptionName()) + ' : method: \'' + $.S(t1) + '\'\n' + 'Receiver: null\n' + 'Arguments: ' + $.S(this.arguments); | |
}, | |
get$exceptionName: function() { | |
return 'NullPointerException'; | |
}, | |
is$Exception: true | |
}; | |
$$.IllegalJSRegExpException = {"": ["_pattern", "_errmsg"], | |
"super": "Object", | |
toString$0: function() { | |
return 'IllegalJSRegExpException: \'' + $.S(this._pattern) + '\' \'' + this._errmsg + '\''; | |
}, | |
is$Exception: true | |
}; | |
$$.RuntimeError = {"": ["message"], | |
"super": "Object", | |
toString$0: function() { | |
return 'RuntimeError: ' + this.message; | |
}, | |
is$Exception: true | |
}; | |
$$.FutureNotCompleteException = {"": [], | |
"super": "Object", | |
toString$0: function() { | |
return 'Exception: future has not been completed'; | |
}, | |
is$Exception: true | |
}; | |
$$.FutureAlreadyCompleteException = {"": [], | |
"super": "Object", | |
toString$0: function() { | |
return 'Exception: future already completed'; | |
}, | |
is$Exception: true | |
}; | |
$$.FutureUnhandledException = {"": ["source", "stackTrace>"], | |
"super": "Object", | |
toString$0: function() { | |
var t1, t2, t3; | |
t1 = $.toString(this.source); | |
t2 = 'FutureUnhandledException: exception while executing Future\n ' + $.S($.getInterceptor(t1).replaceAll$2(t1, '\n', '\n ')) + '\n' + 'original stack trace:\n '; | |
t3 = $.toString(this.stackTrace); | |
return t2 + $.S($.getInterceptor(t3).replaceAll$2(t3, '\n', '\n ')); | |
}, | |
is$Exception: true | |
}; | |
$$._FutureImpl = {"": ["_isComplete", "_value", "_exception", "_stackTrace", "_exceptionHandled", "_successListeners", "_exceptionHandlers", "_completionListeners"], | |
"super": "Object", | |
get$value: function() { | |
if (this.get$isComplete() !== true) | |
throw $.$$throw($.FutureNotCompleteException$()); | |
var t1 = this._exception; | |
if (!(t1 == null)) | |
throw $.$$throw($.FutureUnhandledException$(t1, this.get$stackTrace())); | |
return this._value; | |
}, | |
get$stackTrace: function() { | |
if (this.get$isComplete() !== true) | |
throw $.$$throw($.FutureNotCompleteException$()); | |
return this._stackTrace; | |
}, | |
get$isComplete: function() { | |
return this._isComplete; | |
}, | |
get$hasValue: function() { | |
return this.get$isComplete() === true && this._exception == null; | |
}, | |
then$1: function(onSuccess) { | |
var t1; | |
if (this.get$hasValue() === true) | |
onSuccess.call$1(this.get$value()); | |
else if (this.get$isComplete() !== true) { | |
t1 = this._successListeners; | |
$.getInterceptor(t1).add$1(t1, onSuccess); | |
} else if (this._exceptionHandled !== true) | |
throw $.$$throw($.FutureUnhandledException$(this._exception, this.get$stackTrace())); | |
}, | |
handleException$1: function(onException) { | |
var t1; | |
if (this._exceptionHandled === true) | |
return; | |
if (this._isComplete) { | |
t1 = this._exception; | |
if (!(t1 == null)) | |
this._exceptionHandled = onException.call$1(t1); | |
} else { | |
t1 = this._exceptionHandlers; | |
$.getInterceptor(t1).add$1(t1, onException); | |
} | |
}, | |
_complete$0: function(exception) { | |
var t1, handler, listener, listener0; | |
this._isComplete = true; | |
try { | |
if (!(this._exception == null)) | |
for (t1 = $.iterator(this._exceptionHandlers); t1.get$hasNext() === true;) { | |
handler = t1.next$0(); | |
if ($.eqB(handler.call$1(this._exception), true)) { | |
this._exceptionHandled = true; | |
break; | |
} | |
} | |
if (this.get$hasValue() === true) | |
for (t1 = $.iterator(this._successListeners); t1.get$hasNext() === true;) { | |
listener = t1.next$0(); | |
listener.call$1(this.get$value()); | |
} | |
else if (this._exceptionHandled !== true && this._successListeners.length > 0) | |
throw $.$$throw($.FutureUnhandledException$(this._exception, this.get$stackTrace())); | |
} finally { | |
for (t1 = $.iterator(this._completionListeners); t1.get$hasNext() === true;) { | |
listener0 = t1.next$0(); | |
try { | |
listener0.call$1(this); | |
} catch (exception) { | |
$.unwrapException(exception); | |
} | |
} | |
} | |
}, | |
_setValue$1: function(value) { | |
if (this._isComplete) | |
throw $.$$throw($.FutureAlreadyCompleteException$()); | |
this._value = value; | |
this._complete$0(); | |
}, | |
_setException$2: function(exception, stackTrace) { | |
if (exception == null) | |
throw $.$$throw($.ArgumentError$(null)); | |
if (this._isComplete) | |
throw $.$$throw($.FutureAlreadyCompleteException$()); | |
this._exception = exception; | |
this._stackTrace = stackTrace; | |
this._complete$0(); | |
} | |
}; | |
$$._CompleterImpl = {"": ["_futureImpl"], | |
"super": "Object", | |
get$future: function() { | |
return this._futureImpl; | |
}, | |
complete$1: function(value) { | |
this._futureImpl._setValue$1(value); | |
}, | |
completeException$2: function(exception, stackTrace) { | |
this._futureImpl._setException$2(exception, stackTrace); | |
}, | |
completeException$1: function(exception) { | |
return this.completeException$2(exception,null) | |
} | |
}; | |
$$.List = {"": [], | |
"super": "Object", | |
is$List: true, | |
is$Collection: true | |
}; | |
$$._HashMapImpl = {"": ["_keys", "_values", "_loadLimit", "_numberOfEntries", "_numberOfDeleted"], | |
"super": "Object", | |
_probeForAdding$1: function(key) { | |
var t1, hash, insertionIndex, numberOfProbes, existingKey, numberOfProbes0; | |
if (key == null) | |
throw $.$$throw($.CTC2); | |
t1 = $.get$hashCode(key); | |
if (t1 !== (t1 | 0)) | |
return this._probeForAdding$1$bailout(1, key, t1); | |
hash = (t1 & this._keys.length - 1) >>> 0; | |
for (insertionIndex = -1, numberOfProbes = 1; true; numberOfProbes = numberOfProbes0) { | |
t1 = this._keys; | |
if (hash < 0 || hash >= t1.length) | |
throw $.ioore(hash); | |
existingKey = t1[hash]; | |
if (existingKey == null) { | |
if (insertionIndex < 0) | |
return hash; | |
return insertionIndex; | |
} else if ($.eqB(existingKey, key)) | |
return hash; | |
else if (insertionIndex < 0 && existingKey === $.CTC4) | |
insertionIndex = hash; | |
numberOfProbes0 = numberOfProbes + 1; | |
hash = $._HashMapImpl__nextProbe(hash, numberOfProbes, this._keys.length); | |
} | |
}, | |
_probeForAdding$1$bailout: function(state0, key, t1) { | |
var hash, insertionIndex, numberOfProbes, existingKey, numberOfProbes0; | |
hash = $.and(t1, this._keys.length - 1); | |
for (insertionIndex = -1, numberOfProbes = 1; true; numberOfProbes = numberOfProbes0) { | |
t1 = this._keys; | |
if (hash !== (hash | 0)) | |
throw $.iae(hash); | |
if (hash < 0 || hash >= t1.length) | |
throw $.ioore(hash); | |
existingKey = t1[hash]; | |
if (existingKey == null) { | |
if (insertionIndex < 0) | |
return hash; | |
return insertionIndex; | |
} else if ($.eqB(existingKey, key)) | |
return hash; | |
else if (insertionIndex < 0 && existingKey === $.CTC4) | |
insertionIndex = hash; | |
numberOfProbes0 = numberOfProbes + 1; | |
hash = $._HashMapImpl__nextProbe(hash, numberOfProbes, this._keys.length); | |
} | |
}, | |
_probeForLookup$1: function(key) { | |
var hash, numberOfProbes, t1, existingKey, numberOfProbes0; | |
if (key == null) | |
throw $.$$throw($.CTC2); | |
hash = $.and($.get$hashCode(key), this._keys.length - 1); | |
if (hash !== (hash | 0)) | |
return this._probeForLookup$1$bailout(1, key, hash); | |
for (numberOfProbes = 1; true; numberOfProbes = numberOfProbes0) { | |
t1 = this._keys; | |
if (hash < 0 || hash >= t1.length) | |
throw $.ioore(hash); | |
existingKey = t1[hash]; | |
if (existingKey == null) | |
return -1; | |
if ($.eqB(existingKey, key)) | |
return hash; | |
numberOfProbes0 = numberOfProbes + 1; | |
hash = $._HashMapImpl__nextProbe(hash, numberOfProbes, this._keys.length); | |
} | |
}, | |
_probeForLookup$1$bailout: function(state0, key, hash) { | |
var numberOfProbes, t1, existingKey, numberOfProbes0; | |
for (numberOfProbes = 1; true; numberOfProbes = numberOfProbes0) { | |
t1 = this._keys; | |
if (hash !== (hash | 0)) | |
throw $.iae(hash); | |
if (hash < 0 || hash >= t1.length) | |
throw $.ioore(hash); | |
existingKey = t1[hash]; | |
if (existingKey == null) | |
return -1; | |
if ($.eqB(existingKey, key)) | |
return hash; | |
numberOfProbes0 = numberOfProbes + 1; | |
hash = $._HashMapImpl__nextProbe(hash, numberOfProbes, this._keys.length); | |
} | |
}, | |
_ensureCapacity$0: function() { | |
var newNumberOfEntries, capacity, numberOfFreeOrDeleted, t1; | |
newNumberOfEntries = this._numberOfEntries + 1; | |
if ($.geB(newNumberOfEntries, this._loadLimit)) { | |
this._grow$1(this._keys.length * 2); | |
return; | |
} | |
capacity = this._keys.length; | |
numberOfFreeOrDeleted = capacity - newNumberOfEntries; | |
t1 = this._numberOfDeleted; | |
if (t1 > numberOfFreeOrDeleted - t1) | |
this._grow$1(capacity); | |
}, | |
_grow$1: function(newCapacity) { | |
var capacity, oldKeys, oldValues, t1, t2, i, key, value, newIndex, t3; | |
capacity = this._keys.length; | |
this._loadLimit = $.tdiv(newCapacity * 3, 4); | |
oldKeys = this._keys; | |
oldValues = this._values; | |
this._keys = $._ListImpl_List(newCapacity); | |
this._values = $._ListImpl_List(newCapacity); | |
for (t1 = oldKeys.length, t2 = oldValues.length, i = 0; i < capacity; ++i) { | |
if (i >= t1) | |
throw $.ioore(i); | |
key = oldKeys[i]; | |
if (key == null || key === $.CTC4) | |
continue; | |
if (i >= t2) | |
throw $.ioore(i); | |
value = oldValues[i]; | |
newIndex = this._probeForAdding$1(key); | |
t3 = this._keys; | |
if (newIndex !== (newIndex | 0)) | |
throw $.iae(newIndex); | |
if (newIndex < 0 || newIndex >= t3.length) | |
throw $.ioore(newIndex); | |
t3[newIndex] = key; | |
t3 = this._values; | |
if (newIndex >= t3.length) | |
throw $.ioore(newIndex); | |
t3[newIndex] = value; | |
} | |
this._numberOfDeleted = 0; | |
}, | |
clear$0: function() { | |
var t1, length$, t2, t3, i; | |
this._numberOfEntries = 0; | |
this._numberOfDeleted = 0; | |
t1 = this._keys; | |
length$ = t1.length; | |
for (t2 = this._values, t3 = t2.length, i = 0; i < length$; ++i) { | |
t1[i] = null; | |
if (i >= t3) | |
throw $.ioore(i); | |
t2[i] = null; | |
} | |
}, | |
oprator$indexSet$2: function(key, value) { | |
var index, t1; | |
this._ensureCapacity$0(); | |
index = this._probeForAdding$1(key); | |
t1 = this._keys; | |
if (index !== (index | 0)) | |
throw $.iae(index); | |
if (index < 0 || index >= t1.length) | |
throw $.ioore(index); | |
t1 = t1[index]; | |
if (t1 == null || t1 === $.CTC4) | |
this._numberOfEntries = this._numberOfEntries + 1; | |
t1 = this._keys; | |
if (index >= t1.length) | |
throw $.ioore(index); | |
t1[index] = key; | |
t1 = this._values; | |
if (index >= t1.length) | |
throw $.ioore(index); | |
t1[index] = value; | |
}, | |
operator$index$1: function(key) { | |
var index, t1; | |
index = this._probeForLookup$1(key); | |
if ($.ltB(index, 0)) | |
return; | |
t1 = this._values; | |
if (index !== (index | 0)) | |
throw $.iae(index); | |
if (index < 0 || index >= t1.length) | |
throw $.ioore(index); | |
return t1[index]; | |
}, | |
remove$1: function(key) { | |
var index, t1, value; | |
index = this._probeForLookup$1(key); | |
if ($.geB(index, 0)) { | |
this._numberOfEntries = this._numberOfEntries - 1; | |
t1 = this._values; | |
if (index !== (index | 0)) | |
throw $.iae(index); | |
if (index < 0 || index >= t1.length) | |
throw $.ioore(index); | |
value = t1[index]; | |
t1[index] = null; | |
t1 = this._keys; | |
if (index >= t1.length) | |
throw $.ioore(index); | |
t1[index] = $.CTC4; | |
this._numberOfDeleted = this._numberOfDeleted + 1; | |
return value; | |
} | |
return; | |
}, | |
get$isEmpty: function() { | |
return this._numberOfEntries === 0; | |
}, | |
get$length: function() { | |
return this._numberOfEntries; | |
}, | |
forEach$1: function(f) { | |
var length$, i, t1, key; | |
length$ = this._keys.length; | |
for (i = 0; i < length$; ++i) { | |
t1 = this._keys; | |
if (i >= t1.length) | |
throw $.ioore(i); | |
key = t1[i]; | |
if (!(key == null) && !(key === $.CTC4)) { | |
t1 = this._values; | |
if (i >= t1.length) | |
throw $.ioore(i); | |
f.call$2(key, t1[i]); | |
} | |
} | |
}, | |
get$keys: function() { | |
var t1, list; | |
t1 = {}; | |
list = $._ListImpl_List(this.get$length()); | |
t1.i_10 = 0; | |
this.forEach$1(new $._HashMapImpl_keys_anon(t1, list)); | |
return list; | |
}, | |
get$values: function() { | |
var t1, list; | |
t1 = {}; | |
list = $._ListImpl_List(this.get$length()); | |
t1.i_1 = 0; | |
this.forEach$1(new $._HashMapImpl_values_anon(t1, list)); | |
return list; | |
}, | |
containsKey$1: function(key) { | |
return !$.eqB(this._probeForLookup$1(key), -1); | |
}, | |
toString$0: function() { | |
return $.Maps_mapToString(this); | |
}, | |
_HashMapImpl$0: function() { | |
this._numberOfEntries = 0; | |
this._numberOfDeleted = 0; | |
this._loadLimit = $._HashMapImpl__computeLoadLimit(8); | |
this._keys = $._ListImpl_List(8); | |
this._values = $._ListImpl_List(8); | |
}, | |
is$Map: true | |
}; | |
$$._DeletedKeySentinel = {"": [], | |
"super": "Object" | |
}; | |
$$._KeyValuePair = {"": ["key>", "value="], | |
"super": "Object" | |
}; | |
$$._LinkedHashMapImpl = {"": ["_list", "_map"], | |
"super": "Object", | |
oprator$indexSet$2: function(key, value) { | |
var t1; | |
if (this._map.containsKey$1(key) === true) | |
$.index(this._map, key).get$element().set$value(value); | |
else { | |
t1 = this._list; | |
$.getInterceptor(t1).addLast$1(t1, $._KeyValuePair$(key, value)); | |
$.indexSet(this._map, key, this._list.lastEntry$0()); | |
} | |
}, | |
operator$index$1: function(key) { | |
var entry = $.index(this._map, key); | |
if (entry == null) | |
return; | |
return entry.get$element().get$value(); | |
}, | |
remove$1: function(key) { | |
var entry = this._map.remove$1(key); | |
if (entry == null) | |
return; | |
entry.remove$0(); | |
return entry.get$element().get$value(); | |
}, | |
get$keys: function() { | |
var t1, list, t2; | |
t1 = {}; | |
list = $._ListImpl_List(this.get$length()); | |
t1.index_10 = 0; | |
t2 = this._list; | |
$.getInterceptor(t2).forEach$1(t2, new $._LinkedHashMapImpl_keys_anon(t1, list)); | |
return list; | |
}, | |
get$values: function() { | |
var t1, list, t2; | |
t1 = {}; | |
list = $._ListImpl_List(this.get$length()); | |
t1.index_1 = 0; | |
t2 = this._list; | |
$.getInterceptor(t2).forEach$1(t2, new $._LinkedHashMapImpl_values_anon(t1, list)); | |
return list; | |
}, | |
forEach$1: function(f) { | |
var t1 = this._list; | |
$.getInterceptor(t1).forEach$1(t1, new $._LinkedHashMapImpl_forEach_anon(f)); | |
}, | |
containsKey$1: function(key) { | |
return this._map.containsKey$1(key); | |
}, | |
get$length: function() { | |
return $.get$length(this._map); | |
}, | |
get$isEmpty: function() { | |
return $.eq(this.get$length(), 0); | |
}, | |
clear$0: function() { | |
var t1 = this._map; | |
$.getInterceptor(t1).clear$0(t1); | |
t1 = this._list; | |
$.getInterceptor(t1).clear$0(t1); | |
}, | |
toString$0: function() { | |
return $.Maps_mapToString(this); | |
}, | |
_LinkedHashMapImpl$0: function() { | |
this._map = $.HashMap_HashMap(); | |
this._list = $.DoubleLinkedQueue$(); | |
}, | |
is$Map: true | |
}; | |
$$.Object = {"": [], | |
"super": "", | |
operator$eq$1: function(other) { | |
return this === other; | |
}, | |
get$hashCode: function() { | |
return $.Primitives_objectHashCode(this); | |
}, | |
toString$0: function() { | |
return $.Primitives_objectToString(this); | |
} | |
}; | |
$$.DoubleLinkedQueueEntry = {"": ["_previous<", "_next=", "_element>"], | |
"super": "Object", | |
_link$2: function(p, n) { | |
this._next = n; | |
this._previous = p; | |
p.set$_next(this); | |
n.set$_previous(this); | |
}, | |
prepend$1: function(e) { | |
$.DoubleLinkedQueueEntry$(e)._link$2(this._previous, this); | |
}, | |
remove$0: function() { | |
var t1 = this._next; | |
this._previous.set$_next(t1); | |
t1 = this._previous; | |
this._next.set$_previous(t1); | |
this._next = null; | |
this._previous = null; | |
return this._element; | |
}, | |
_asNonSentinelEntry$0: function() { | |
return this; | |
}, | |
previousEntry$0: function() { | |
return this._previous._asNonSentinelEntry$0(); | |
}, | |
get$element: function() { | |
return this._element; | |
}, | |
DoubleLinkedQueueEntry$1: function(e) { | |
this._element = e; | |
} | |
}; | |
$$._DoubleLinkedQueueEntrySentinel = {"": ["_previous", "_next", "_element"], | |
"super": "DoubleLinkedQueueEntry", | |
remove$0: function() { | |
throw $.$$throw($.StateError$('Empty queue')); | |
}, | |
_asNonSentinelEntry$0: function() { | |
return; | |
}, | |
get$element: function() { | |
throw $.$$throw($.StateError$('Empty queue')); | |
}, | |
_DoubleLinkedQueueEntrySentinel$0: function() { | |
this._link$2(this, this); | |
} | |
}; | |
$$.DoubleLinkedQueue = {"": ["_sentinel"], | |
"super": "Object", | |
addLast$1: function(value) { | |
this._sentinel.prepend$1(value); | |
}, | |
add$1: function(value) { | |
this._sentinel.prepend$1(value); | |
}, | |
removeLast$0: function() { | |
return this._sentinel._previous.remove$0(); | |
}, | |
removeFirst$0: function() { | |
return this._sentinel._next.remove$0(); | |
}, | |
lastEntry$0: function() { | |
return this._sentinel.previousEntry$0(); | |
}, | |
get$length: function() { | |
var t1 = {}; | |
t1.counter_1 = 0; | |
this.forEach$1(new $.DoubleLinkedQueue_length_anon(t1)); | |
return t1.counter_1; | |
}, | |
get$isEmpty: function() { | |
var t1 = this._sentinel; | |
return t1._next === t1; | |
}, | |
clear$0: function() { | |
var t1 = this._sentinel; | |
t1._next = t1; | |
t1 = this._sentinel; | |
t1._previous = t1; | |
}, | |
forEach$1: function(f) { | |
var entry, nextEntry; | |
entry = this._sentinel._next; | |
for (; !(entry === this._sentinel); entry = nextEntry) { | |
nextEntry = entry.get$_next(); | |
f.call$1(entry.get$_element()); | |
} | |
}, | |
iterator$0: function() { | |
return $._DoubleLinkedQueueIterator$(this._sentinel); | |
}, | |
toString$0: function() { | |
return $.Collections_collectionToString(this); | |
}, | |
DoubleLinkedQueue$0: function() { | |
this._sentinel = $._DoubleLinkedQueueEntrySentinel$(); | |
}, | |
is$Collection: true | |
}; | |
$$._DoubleLinkedQueueIterator = {"": ["_sentinel", "_currentEntry"], | |
"super": "Object", | |
get$hasNext: function() { | |
return !(this._currentEntry.get$_next() === this._sentinel); | |
}, | |
next$0: function() { | |
if (this.get$hasNext() !== true) | |
throw $.$$throw($.StateError$('No more elements')); | |
this._currentEntry = this._currentEntry.get$_next(); | |
return this._currentEntry.get$element(); | |
}, | |
_DoubleLinkedQueueIterator$1: function(_sentinel) { | |
this._currentEntry = this._sentinel; | |
} | |
}; | |
$$.String = {"": [], | |
"super": "Object", | |
is$String: true | |
}; | |
$$._StringBufferImpl = {"": ["_buffer", "_length"], | |
"super": "Object", | |
get$length: function() { | |
return this._length; | |
}, | |
get$isEmpty: function() { | |
return $.eq(this._length, 0); | |
}, | |
add$1: function(obj) { | |
var str, t1, t3; | |
str = $.toString(obj); | |
if (str == null || $.get$isEmpty(str) === true) | |
return this; | |
t1 = this._buffer; | |
$.getInterceptor(t1).add$1(t1, str); | |
t1 = this._length; | |
if (typeof t1 !== 'number') | |
return this.add$1$bailout(1, t1, str); | |
t3 = $.get$length(str); | |
if (typeof t3 !== 'number') | |
return this.add$1$bailout(2, t1, t3); | |
this._length = t1 + t3; | |
return this; | |
}, | |
add$1$bailout: function(state0, env0, env1) { | |
switch (state0) { | |
case 1: | |
str = env1; | |
t1 = env0; | |
break; | |
case 2: | |
t3 = env1; | |
t1 = env0; | |
break; | |
} | |
switch (state0) { | |
case 0: | |
str = $.toString(obj); | |
if (str == null || $.get$isEmpty(str) === true) | |
return this; | |
t1 = this._buffer; | |
$.getInterceptor(t1).add$1(t1, str); | |
t1 = this._length; | |
case 1: | |
state0 = 0; | |
t3 = $.get$length(str); | |
case 2: | |
var str, t1, t3; | |
state0 = 0; | |
this._length = $.add(t1, t3); | |
return this; | |
} | |
}, | |
clear$0: function() { | |
this._buffer = $._ListImpl_List(null); | |
this._length = 0; | |
return this; | |
}, | |
toString$0: function() { | |
var result, t1; | |
if ($.eqB($.get$length(this._buffer), 0)) | |
return ''; | |
if ($.eqB($.get$length(this._buffer), 1)) | |
return $.index(this._buffer, 0); | |
result = $.stringJoinUnchecked($.Strings__toJsStringArray(this._buffer), ''); | |
t1 = this._buffer; | |
$.getInterceptor(t1).clear$0(t1); | |
t1 = this._buffer; | |
$.getInterceptor(t1).add$1(t1, result); | |
return result; | |
}, | |
_StringBufferImpl$1: function(content$) { | |
this.clear$0(); | |
this.add$1(content$); | |
} | |
}; | |
$$.ObjectInterceptor = {"": [], | |
"super": "Object", | |
removeLast$0: function(receiver) { return receiver.removeLast$0(); }, | |
charCodeAt$1: function(receiver, a0) { return receiver.charCodeAt$1(a0); }, | |
substring$1: function(receiver, a0) { return receiver.substring$1(a0); }, | |
clear$0: function(receiver) { return receiver.clear$0(); }, | |
add$1: function(receiver, a0) { return receiver.add$1(a0); }, | |
replaceAll$2: function(receiver, a0, a1) { return receiver.replaceAll$2(a0, a1); }, | |
endsWith$1: function(receiver, a0) { return receiver.endsWith$1(a0); }, | |
substring$2: function(receiver, a0, a1) { return receiver.substring$2(a0, a1); }, | |
forEach$1: function(receiver, a0) { return receiver.forEach$1(a0); }, | |
addLast$1: function(receiver, a0) { return receiver.addLast$1(a0); }, | |
split$1: function(receiver, a0) { return receiver.split$1(a0); } | |
}; | |
$$.JSArray = {"": [], | |
"super": "Object", | |
add$1: function(receiver, value) { | |
$.checkGrowable(receiver, 'add'); | |
receiver.push(value); | |
}, | |
removeLast$0: function(receiver) { | |
$.checkGrowable(receiver, 'removeLast'); | |
if ($.eqB($.get$length(receiver), 0)) | |
throw $.$$throw($.RangeError$value(-1)); | |
return receiver.pop(); | |
}, | |
addLast$1: function(receiver, value) { | |
$.checkGrowable(receiver, 'addLast'); | |
receiver.push(value); | |
}, | |
clear$0: function(receiver) { | |
$.set$length(receiver, 0); | |
}, | |
forEach$1: function(receiver, f) { | |
return $.Collections_forEach(receiver, f); | |
}, | |
is$List: true, | |
is$Collection: true | |
}; | |
$$.JSString = {"": [], | |
"super": "Object", | |
charCodeAt$1: function(receiver, index) { | |
if (!(typeof index === 'number')) | |
throw $.$$throw($.ArgumentError$(index)); | |
if (index < 0) | |
throw $.$$throw($.RangeError$value(index)); | |
if ($.geB(index, $.get$length(receiver))) | |
throw $.$$throw($.RangeError$value(index)); | |
return receiver.charCodeAt(index); | |
}, | |
endsWith$1: function(receiver, other) { | |
var otherLength; | |
$.checkString(other); | |
otherLength = $.get$length(other); | |
if ($.gtB(otherLength, $.get$length(receiver))) | |
return false; | |
return $.eq(other, this.substring$1(receiver, $.sub($.get$length(receiver), otherLength))); | |
}, | |
replaceAll$2: function(receiver, from, to) { | |
$.checkString(to); | |
return $.stringReplaceAllUnchecked(receiver, from, to); | |
}, | |
split$1: function(receiver, pattern) { | |
$.checkNull(pattern); | |
return $.stringSplitUnchecked(receiver, pattern); | |
}, | |
substring$2: function(receiver, startIndex, endIndex) { | |
$.checkNum(startIndex); | |
if (endIndex == null) | |
endIndex = $.get$length(receiver); | |
$.checkNum(endIndex); | |
if ($.ltB(startIndex, 0)) | |
throw $.$$throw($.RangeError$value(startIndex)); | |
if ($.gtB(startIndex, endIndex)) | |
throw $.$$throw($.RangeError$value(startIndex)); | |
if ($.gtB(endIndex, $.get$length(receiver))) | |
throw $.$$throw($.RangeError$value(endIndex)); | |
return receiver.substring(startIndex, endIndex); | |
}, | |
substring$1: function($,startIndex) { | |
return this.substring$2($,startIndex,null) | |
}, | |
is$String: true | |
}; | |
$$._Manager = {"": ["nextIsolateId=", "currentManagerId=", "nextManagerId=", "currentContext=", "rootContext=", "topEventLoop>", "fromCommandLine>", "isWorker>", "supportsWorkers", "isolates>", "mainManager>", "managers>"], | |
"super": "Object", | |
get$useWorkers: function() { | |
return this.supportsWorkers; | |
}, | |
get$needSerialization: function() { | |
return this.get$useWorkers(); | |
}, | |
_nativeDetectEnvironment$0: function() { | |
this.isWorker = $isWorker; | |
this.supportsWorkers = $supportsWorkers; | |
this.fromCommandLine = typeof(window) == 'undefined'; | |
}, | |
_nativeInitWorkerMessageHandler$0: function() { | |
$globalThis.onmessage = function (e) { | |
_IsolateNatives._processWorkerMessage(this.mainManager, e); | |
}; | |
}, | |
maybeCloseWorker$0: function() { | |
if ($.get$isEmpty(this.isolates) === true) | |
this.mainManager.postMessage$1($._serializeMessage($.makeLiteralMap(['command', 'close']))); | |
}, | |
_Manager$0: function() { | |
this._nativeDetectEnvironment$0(); | |
this.topEventLoop = $._EventLoop$(); | |
this.isolates = $.Map_Map(); | |
this.managers = $.Map_Map(); | |
if (this.isWorker === true) { | |
this.mainManager = $._MainManagerStub$(); | |
this._nativeInitWorkerMessageHandler$0(); | |
} | |
} | |
}; | |
$$._IsolateContext = {"": ["id=", "ports>", "isolateStatics"], | |
"super": "Object", | |
initGlobals$0: function() { | |
$initGlobals(this); | |
}, | |
eval$1: function(code) { | |
var old, result, t1; | |
old = $._globalState().get$currentContext(); | |
$._globalState().set$currentContext(this); | |
this._setGlobals$0(); | |
result = null; | |
try { | |
result = code.call$0(); | |
} finally { | |
t1 = old; | |
$._globalState().set$currentContext(t1); | |
if (!(old == null)) | |
old._setGlobals$0(); | |
} | |
return result; | |
}, | |
_setGlobals$0: function() { | |
$setGlobals(this); | |
}, | |
lookup$1: function(portId) { | |
return $.index(this.ports, portId); | |
}, | |
register$2: function(portId, port) { | |
if (this.ports.containsKey$1(portId) === true) | |
throw $.$$throw($._ExceptionImplementation$('Registry: ports must be registered only once.')); | |
$.indexSet(this.ports, portId, port); | |
$.indexSet($._globalState().get$isolates(), this.id, this); | |
}, | |
unregister$1: function(portId) { | |
this.ports.remove$1(portId); | |
if ($.get$isEmpty(this.ports) === true) | |
$._globalState().get$isolates().remove$1(this.id); | |
}, | |
_IsolateContext$0: function() { | |
var t1, t2; | |
t1 = $._globalState(); | |
t2 = t1.get$nextIsolateId(); | |
t1.set$nextIsolateId($.add(t2, 1)); | |
this.id = t2; | |
this.ports = $.Map_Map(); | |
this.initGlobals$0(); | |
} | |
}; | |
$$._EventLoop = {"": ["events"], | |
"super": "Object", | |
enqueue$3: function(isolate, fn, msg) { | |
var t1 = this.events; | |
$.getInterceptor(t1).addLast$1(t1, $._IsolateEvent$(isolate, fn, msg)); | |
}, | |
dequeue$0: function() { | |
var t1 = this.events; | |
if ($.get$isEmpty(t1) === true) | |
return; | |
return t1.removeFirst$0(); | |
}, | |
runIteration$0: function() { | |
var event$ = this.dequeue$0(); | |
if (event$ == null) { | |
if ($._globalState().get$isWorker() === true) | |
$._globalState().maybeCloseWorker$0(); | |
else if (!($._globalState().get$rootContext() == null) && $._globalState().get$isolates().containsKey$1($._globalState().get$rootContext().get$id()) === true && $._globalState().get$fromCommandLine() === true && $.get$isEmpty($._globalState().get$rootContext().get$ports()) === true) | |
throw $.$$throw($._ExceptionImplementation$('Program exited with open ReceivePorts.')); | |
return false; | |
} | |
event$.process$0(); | |
return true; | |
}, | |
_runHelper$0: function() { | |
if (!($._window() == null)) | |
new $._EventLoop__runHelper_next(this).call$0(); | |
else | |
for (; this.runIteration$0() === true;) | |
; | |
}, | |
run$0: function(exception) { | |
var t1, e, trace; | |
if ($._globalState().get$isWorker() !== true) | |
this._runHelper$0(); | |
else | |
try { | |
this._runHelper$0(); | |
} catch (exception) { | |
t1 = $.unwrapException(exception); | |
e = t1; | |
trace = $.getTraceFromException(exception); | |
$._globalState().get$mainManager().postMessage$1($._serializeMessage($.makeLiteralMap(['command', 'error', 'msg', $.S(e) + '\n' + $.S(trace)]))); | |
} | |
} | |
}; | |
$$._IsolateEvent = {"": ["isolate", "fn", "message"], | |
"super": "Object", | |
process$0: function() { | |
this.isolate.eval$1(this.fn); | |
} | |
}; | |
$$._MainManagerStub = {"": [], | |
"super": "Object", | |
get$id: function() { | |
return 0; | |
}, | |
set$id: function(i) { | |
throw $.$$throw($.UnimplementedError$(null)); | |
}, | |
set$onmessage: function(f) { | |
throw $.$$throw($._ExceptionImplementation$('onmessage should not be set on MainManagerStub')); | |
}, | |
postMessage$1: function(msg) { | |
$globalThis.postMessage(msg); | |
}, | |
terminate$0: function() { | |
} | |
}; | |
$$._BaseSendPort = {"": ["_isolateId>"], | |
"super": "Object", | |
_checkReplyTo$1: function(replyTo) { | |
if (!(replyTo == null) && !(typeof replyTo === 'object' && replyTo !== null && !!replyTo.is$_NativeJsSendPort) && !(typeof replyTo === 'object' && replyTo !== null && !!replyTo.is$_WorkerSendPort) && !(typeof replyTo === 'object' && replyTo !== null && !!replyTo.is$_BufferingSendPort)) | |
throw $.$$throw($._ExceptionImplementation$('SendPort.send: Illegal replyTo port type')); | |
}, | |
call$1: function(message) { | |
var completer, port; | |
completer = $.Completer_Completer(); | |
port = $._ReceivePortImpl$(); | |
this.send$2(message, port.toSendPort$0()); | |
port.receive$1(new $._BaseSendPort_call_anon(completer, port)); | |
return completer.get$future(); | |
}, | |
is$SendPort: true | |
}; | |
$$._NativeJsSendPort = {"": ["_receivePort>", "_isolateId"], | |
"super": "_BaseSendPort", | |
send$2: function(message, replyTo) { | |
$._waitForPendingPorts([message, replyTo], new $._NativeJsSendPort_send_anon(this, replyTo, message)); | |
}, | |
send$1: function(message) { | |
return this.send$2(message,null) | |
}, | |
operator$eq$1: function(other) { | |
return typeof other === 'object' && other !== null && !!other.is$_NativeJsSendPort && $.eqB(this._receivePort, other._receivePort); | |
}, | |
get$hashCode: function() { | |
return this._receivePort.get$_id(); | |
}, | |
is$_NativeJsSendPort: true, | |
is$SendPort: true | |
}; | |
$$._WorkerSendPort = {"": ["_workerId>", "_receivePortId", "_isolateId"], | |
"super": "_BaseSendPort", | |
send$2: function(message, replyTo) { | |
$._waitForPendingPorts([message, replyTo], new $._WorkerSendPort_send_anon(this, replyTo, message)); | |
}, | |
send$1: function(message) { | |
return this.send$2(message,null) | |
}, | |
operator$eq$1: function(other) { | |
var t1; | |
if (typeof other === 'object' && other !== null && !!other.is$_WorkerSendPort) | |
t1 = $.eqB(this._workerId, other._workerId) && $.eqB(this._isolateId, other._isolateId) && $.eqB(this._receivePortId, other._receivePortId); | |
else | |
t1 = false; | |
return t1; | |
}, | |
get$hashCode: function() { | |
return $.xor($.xor($.shl(this._workerId, 16), $.shl(this._isolateId, 8)), this._receivePortId); | |
}, | |
is$_WorkerSendPort: true, | |
is$SendPort: true | |
}; | |
$$._BufferingSendPort = {"": ["_id>", "_port<", "_futurePort>", "pending=", "_isolateId"], | |
"super": "_BaseSendPort", | |
send$2: function(message, replyTo) { | |
var t1 = this._port; | |
if (!(t1 == null)) | |
t1.send$2(message, replyTo); | |
else { | |
t1 = this.pending; | |
$.getInterceptor(t1).add$1(t1, $.makeLiteralMap(['message', message, 'replyTo', replyTo])); | |
} | |
}, | |
send$1: function(message) { | |
return this.send$2(message,null) | |
}, | |
operator$eq$1: function(other) { | |
return typeof other === 'object' && other !== null && !!other.is$_BufferingSendPort && $.eqB(this._id, other._id); | |
}, | |
get$hashCode: function() { | |
return this._id; | |
}, | |
_BufferingSendPort$2: function(isolateId, _futurePort) { | |
$._BufferingSendPort__idCount = $.add($._BufferingSendPort__idCount, 1); | |
this._futurePort.then$1(new $.anon(this)); | |
}, | |
is$_BufferingSendPort: true, | |
is$SendPort: true | |
}; | |
$$._ReceivePortImpl = {"": ["_id>", "_callback>"], | |
"super": "Object", | |
_callback$2: function(arg0, arg1) { return this._callback.call$2(arg0, arg1); }, | |
receive$1: function(onMessage) { | |
this._callback = onMessage; | |
}, | |
close$0: function() { | |
this._callback = null; | |
$._globalState().get$currentContext().unregister$1(this._id); | |
}, | |
toSendPort$0: function() { | |
return $._NativeJsSendPort$(this, $._globalState().get$currentContext().get$id()); | |
}, | |
_ReceivePortImpl$0: function() { | |
$._globalState().get$currentContext().register$2(this._id, this); | |
} | |
}; | |
$$._PendingSendPortFinder = {"": ["ports>", "_visited"], | |
"super": "_MessageTraverser", | |
visitPrimitive$1: function(x) { | |
}, | |
visitList$1: function(list) { | |
if (!($.index(this._visited, list) == null)) | |
return; | |
$.indexSet(this._visited, list, true); | |
$.getInterceptor(list).forEach$1(list, new $._PendingSendPortFinder_visitList_anon(this)); | |
}, | |
visitMap$1: function(map) { | |
var t1; | |
if (!($.index(this._visited, map) == null)) | |
return; | |
$.indexSet(this._visited, map, true); | |
t1 = map.get$values(); | |
$.getInterceptor(t1).forEach$1(t1, new $._PendingSendPortFinder_visitMap_anon(this)); | |
}, | |
visitSendPort$1: function(port) { | |
var t1; | |
if (!!port.is$_BufferingSendPort && port._port == null) { | |
t1 = this.ports; | |
$.getInterceptor(t1).add$1(t1, port.get$_futurePort()); | |
} | |
}, | |
_PendingSendPortFinder$0: function() { | |
this._visited = $._JsVisitedMap$(); | |
} | |
}; | |
$$._JsSerializer = {"": ["_nextFreeRefId", "_visited"], | |
"super": "_Serializer", | |
visitSendPort$1: function(x) { | |
if (typeof x === 'object' && x !== null && !!x.is$_NativeJsSendPort) | |
return this.visitNativeJsSendPort$1(x); | |
if (typeof x === 'object' && x !== null && !!x.is$_WorkerSendPort) | |
return ['sendport', x._workerId, x._isolateId, x._receivePortId]; | |
if (typeof x === 'object' && x !== null && !!x.is$_BufferingSendPort) | |
return this.visitBufferingSendPort$1(x); | |
throw $.$$throw('Illegal underlying port ' + $.S(x)); | |
}, | |
visitNativeJsSendPort$1: function(port) { | |
return ['sendport', $._globalState().get$currentManagerId(), port._isolateId, port._receivePort.get$_id()]; | |
}, | |
visitBufferingSendPort$1: function(port) { | |
var t1 = port._port; | |
if (!(t1 == null)) | |
return this.visitSendPort$1(t1); | |
else | |
throw $.$$throw('internal error: must call _waitForPendingPorts to ensure all ports are resolved at this point.'); | |
}, | |
_JsSerializer$0: function() { | |
this._visited = $._JsVisitedMap$(); | |
} | |
}; | |
$$._JsCopier = {"": ["_visited"], | |
"super": "_Copier", | |
visitSendPort$1: function(x) { | |
if (typeof x === 'object' && x !== null && !!x.is$_NativeJsSendPort) | |
return this.visitNativeJsSendPort$1(x); | |
if (typeof x === 'object' && x !== null && !!x.is$_WorkerSendPort) | |
return this.visitWorkerSendPort$1(x); | |
if (typeof x === 'object' && x !== null && !!x.is$_BufferingSendPort) | |
return this.visitBufferingSendPort$1(x); | |
throw $.$$throw('Illegal underlying port ' + $.S(this.get$p())); | |
}, | |
visitNativeJsSendPort$1: function(port) { | |
return $._NativeJsSendPort$(port._receivePort, port._isolateId); | |
}, | |
visitWorkerSendPort$1: function(port) { | |
return $._WorkerSendPort$(port._workerId, port._isolateId, port._receivePortId); | |
}, | |
visitBufferingSendPort$1: function(port) { | |
var t1 = port._port; | |
if (!(t1 == null)) | |
return this.visitSendPort$1(t1); | |
else | |
throw $.$$throw('internal error: must call _waitForPendingPorts to ensure all ports are resolved at this point.'); | |
}, | |
_JsCopier$0: function() { | |
this._visited = $._JsVisitedMap$(); | |
} | |
}; | |
$$._JsDeserializer = {"": ["_deserialized"], | |
"super": "_Deserializer", | |
deserializeSendPort$1: function(x) { | |
var managerId, isolateId, receivePortId, isolate; | |
managerId = $.index(x, 1); | |
isolateId = $.index(x, 2); | |
receivePortId = $.index(x, 3); | |
if ($.eqB(managerId, $._globalState().get$currentManagerId())) { | |
isolate = $.index($._globalState().get$isolates(), isolateId); | |
if (isolate == null) | |
return; | |
return $._NativeJsSendPort$(isolate.lookup$1(receivePortId), isolateId); | |
} else | |
return $._WorkerSendPort$(managerId, isolateId, receivePortId); | |
} | |
}; | |
$$._JsVisitedMap = {"": ["tagged"], | |
"super": "Object", | |
operator$index$1: function(object) { | |
return object['__MessageTraverser__attached_info__']; | |
}, | |
oprator$indexSet$2: function(object, info) { | |
var t1 = this.tagged; | |
$.getInterceptor(t1).add$1(t1, object); | |
object['__MessageTraverser__attached_info__'] = info; | |
}, | |
reset$0: function() { | |
this.tagged = $._ListImpl_List(null); | |
}, | |
cleanup$0: function() { | |
var length$, i; | |
length$ = $.get$length(this.tagged); | |
if (typeof length$ !== 'number') | |
return this.cleanup$0$bailout(1, length$); | |
i = 0; | |
for (; i < length$; ++i) | |
$.index(this.tagged, i)['__MessageTraverser__attached_info__'] = null; | |
this.tagged = null; | |
}, | |
cleanup$0$bailout: function(state0, length$) { | |
var i = 0; | |
for (; $.ltB(i, length$); ++i) | |
$.index(this.tagged, i)['__MessageTraverser__attached_info__'] = null; | |
this.tagged = null; | |
} | |
}; | |
$$._MessageTraverserVisitedMap = {"": [], | |
"super": "Object", | |
operator$index$1: function(object) { | |
return; | |
}, | |
oprator$indexSet$2: function(object, info) { | |
}, | |
reset$0: function() { | |
}, | |
cleanup$0: function() { | |
} | |
}; | |
$$._MessageTraverser = {"": [], | |
"super": "Object", | |
traverse$1: function(x) { | |
var t1, result; | |
t1 = x; | |
if (t1 == null || typeof t1 === 'string' || typeof t1 === 'number' || typeof t1 === 'boolean') | |
return this.visitPrimitive$1(x); | |
this._visited.reset$0(); | |
result = null; | |
try { | |
result = this._dispatch$1(x); | |
} finally { | |
this._visited.cleanup$0(); | |
} | |
return result; | |
}, | |
_dispatch$1: function(x) { | |
if (x == null || typeof x === 'string' || typeof x === 'number' || typeof x === 'boolean') | |
return this.visitPrimitive$1(x); | |
if (typeof x === 'object' && x !== null && (x.constructor === Array || !!x.is$List)) | |
return this.visitList$1(x); | |
if (typeof x === 'object' && x !== null && !!x.is$Map) | |
return this.visitMap$1(x); | |
if (typeof x === 'object' && x !== null && !!x.is$SendPort) | |
return this.visitSendPort$1(x); | |
if (typeof x === 'object' && x !== null && !!x.is$SendPortSync) | |
return this.visitSendPortSync$1(x); | |
return this.visitObject$1(x); | |
}, | |
visitObject$1: function(x) { | |
throw $.$$throw('Message serialization: Illegal value ' + $.S(x) + ' passed'); | |
} | |
}; | |
$$._Copier = {"": [], | |
"super": "_MessageTraverser", | |
visitPrimitive$1: function(x) { | |
return x; | |
}, | |
visitList$1: function(list) { | |
var copy, len, i; | |
if (typeof list !== 'object' || list === null || list.constructor !== Array && !list.is$JavaScriptIndexingBehavior) | |
return this.visitList$1$bailout(1, list); | |
copy = $.index(this._visited, list); | |
if (!(copy == null)) | |
return copy; | |
len = list.length; | |
copy = $._ListImpl_List(len); | |
$.indexSet(this._visited, list, copy); | |
for (i = 0; i < len; ++i) { | |
if (i >= list.length) | |
throw $.ioore(i); | |
copy[i] = this._dispatch$1(list[i]); | |
} | |
return copy; | |
}, | |
visitList$1$bailout: function(state0, list) { | |
var copy, len, i, t1; | |
copy = $.index(this._visited, list); | |
if (!(copy == null)) | |
return copy; | |
len = $.get$length(list); | |
copy = $._ListImpl_List(len); | |
$.indexSet(this._visited, list, copy); | |
for (i = 0; $.ltB(i, len); ++i) { | |
t1 = this._dispatch$1($.index(list, i)); | |
if (i >= copy.length) | |
throw $.ioore(i); | |
copy[i] = t1; | |
} | |
return copy; | |
}, | |
visitMap$1: function(map) { | |
var t1, t2; | |
t1 = {}; | |
t1.copy_1 = $.index(this._visited, map); | |
t2 = t1.copy_1; | |
if (!(t2 == null)) | |
return t2; | |
t1.copy_1 = $.Map_Map(); | |
$.indexSet(this._visited, map, t1.copy_1); | |
$.getInterceptor(map).forEach$1(map, new $._Copier_visitMap_anon(t1, this)); | |
return t1.copy_1; | |
} | |
}; | |
$$._Serializer = {"": [], | |
"super": "_MessageTraverser", | |
visitPrimitive$1: function(x) { | |
return x; | |
}, | |
visitList$1: function(list) { | |
var copyId, id; | |
copyId = $.index(this._visited, list); | |
if (!(copyId == null)) | |
return ['ref', copyId]; | |
id = this._nextFreeRefId; | |
this._nextFreeRefId = id + 1; | |
$.indexSet(this._visited, list, id); | |
return ['list', id, this._serializeList$1(list)]; | |
}, | |
visitMap$1: function(map) { | |
var copyId, id; | |
copyId = $.index(this._visited, map); | |
if (!(copyId == null)) | |
return ['ref', copyId]; | |
id = this._nextFreeRefId; | |
this._nextFreeRefId = id + 1; | |
$.indexSet(this._visited, map, id); | |
return ['map', id, this._serializeList$1(map.get$keys()), this._serializeList$1(map.get$values())]; | |
}, | |
_serializeList$1: function(list) { | |
var len, result, i; | |
if (typeof list !== 'string' && (typeof list !== 'object' || list === null || list.constructor !== Array && !list.is$JavaScriptIndexingBehavior)) | |
return this._serializeList$1$bailout(1, list); | |
len = list.length; | |
result = $._ListImpl_List(len); | |
for (i = 0; i < len; ++i) { | |
if (i >= list.length) | |
throw $.ioore(i); | |
result[i] = this._dispatch$1(list[i]); | |
} | |
return result; | |
}, | |
_serializeList$1$bailout: function(state0, list) { | |
var len, result, i, t1; | |
len = $.get$length(list); | |
result = $._ListImpl_List(len); | |
for (i = 0; $.ltB(i, len); ++i) { | |
t1 = this._dispatch$1($.index(list, i)); | |
if (i >= result.length) | |
throw $.ioore(i); | |
result[i] = t1; | |
} | |
return result; | |
} | |
}; | |
$$._Deserializer = {"": [], | |
"super": "Object", | |
deserialize$1: function(x) { | |
if (x == null || typeof x === 'string' || typeof x === 'number' || typeof x === 'boolean') | |
return x; | |
this._deserialized = $.HashMap_HashMap(); | |
return this._deserializeHelper$1(x); | |
}, | |
_deserializeHelper$1: function(x) { | |
if (x == null || typeof x === 'string' || typeof x === 'number' || typeof x === 'boolean') | |
return x; | |
switch ($.index(x, 0)) { | |
case 'ref': | |
return this._deserializeRef$1(x); | |
case 'list': | |
return this._deserializeList$1(x); | |
case 'map': | |
return this._deserializeMap$1(x); | |
case 'sendport': | |
return this.deserializeSendPort$1(x); | |
default: | |
return this.deserializeObject$1(x); | |
} | |
}, | |
_deserializeRef$1: function(x) { | |
var id = $.index(x, 1); | |
return $.index(this._deserialized, id); | |
}, | |
_deserializeList$1: function(x) { | |
var id, dartList, len, i, t1; | |
id = $.index(x, 1); | |
dartList = $.index(x, 2); | |
if (typeof dartList !== 'object' || dartList === null || (dartList.constructor !== Array || !!dartList.immutable$list) && !dartList.is$JavaScriptIndexingBehavior) | |
return this._deserializeList$1$bailout(1, dartList, id); | |
$.indexSet(this._deserialized, id, dartList); | |
len = dartList.length; | |
for (i = 0; i < len; ++i) { | |
if (i >= dartList.length) | |
throw $.ioore(i); | |
t1 = this._deserializeHelper$1(dartList[i]); | |
if (i >= dartList.length) | |
throw $.ioore(i); | |
dartList[i] = t1; | |
} | |
return dartList; | |
}, | |
_deserializeList$1$bailout: function(state0, dartList, id) { | |
var len, i; | |
$.indexSet(this._deserialized, id, dartList); | |
len = $.get$length(dartList); | |
for (i = 0; $.ltB(i, len); ++i) | |
$.indexSet(dartList, i, this._deserializeHelper$1($.index(dartList, i))); | |
return dartList; | |
}, | |
_deserializeMap$1: function(x) { | |
var result, id, keys, values, len, i, key; | |
result = $.Map_Map(); | |
id = $.index(x, 1); | |
$.indexSet(this._deserialized, id, result); | |
keys = $.index(x, 2); | |
if (typeof keys !== 'string' && (typeof keys !== 'object' || keys === null || keys.constructor !== Array && !keys.is$JavaScriptIndexingBehavior)) | |
return this._deserializeMap$1$bailout(1, x, result, keys); | |
values = $.index(x, 3); | |
if (typeof values !== 'string' && (typeof values !== 'object' || values === null || values.constructor !== Array && !values.is$JavaScriptIndexingBehavior)) | |
return this._deserializeMap$1$bailout(2, values, result, keys); | |
len = keys.length; | |
for (i = 0; i < len; ++i) { | |
if (i >= keys.length) | |
throw $.ioore(i); | |
key = this._deserializeHelper$1(keys[i]); | |
if (i >= values.length) | |
throw $.ioore(i); | |
$.indexSet(result, key, this._deserializeHelper$1(values[i])); | |
} | |
return result; | |
}, | |
_deserializeMap$1$bailout: function(state0, env0, env1, env2) { | |
switch (state0) { | |
case 1: | |
keys = env2; | |
result = env1; | |
x = env0; | |
break; | |
case 2: | |
keys = env2; | |
result = env1; | |
values = env0; | |
break; | |
} | |
switch (state0) { | |
case 0: | |
result = $.Map_Map(); | |
id = $.index(x, 1); | |
$.indexSet(this._deserialized, id, result); | |
keys = $.index(x, 2); | |
case 1: | |
state0 = 0; | |
values = $.index(x, 3); | |
case 2: | |
var result, id, keys, x, values, len, i; | |
state0 = 0; | |
len = $.get$length(keys); | |
for (i = 0; $.ltB(i, len); ++i) | |
$.indexSet(result, this._deserializeHelper$1($.index(keys, i)), this._deserializeHelper$1($.index(values, i))); | |
return result; | |
} | |
}, | |
deserializeObject$1: function(x) { | |
throw $.$$throw('Unexpected serialized object'); | |
} | |
}; | |
$$._Timer = {"": ["_once", "_handle"], | |
"super": "Object", | |
_Timer$repeating$2: function(milliSeconds, callback) { | |
this._handle = $._window().setInterval$2(new $.anon1(this, callback), milliSeconds); | |
}, | |
_Timer$2: function(milliSeconds, callback) { | |
this._handle = $._window().setTimeout$2(new $.anon0(callback, this), milliSeconds); | |
} | |
}; | |
$$.Uri = {"": ["scheme", "userInfo", "domain", "port", "path", "query", "fragment"], | |
"super": "Object", | |
isAbsolute$0: function() { | |
if ('' === this.scheme) | |
return false; | |
if (!('' === this.fragment)) | |
return false; | |
return true; | |
}, | |
toString$0: function() { | |
var sb, t1, t2; | |
sb = $.StringBuffer_StringBuffer(''); | |
t1 = this.scheme; | |
$.Uri__addIfNonEmpty(sb, t1, t1, ':'); | |
t2 = this.userInfo; | |
if (!$.eqB(t2, '') || !$.eqB(this.domain, '') || !$.eqB(this.port, 0) || $.eqB(t1, 'file')) { | |
$.getInterceptor(sb).add$1(sb, '//'); | |
$.Uri__addIfNonEmpty(sb, t2, t2, '@'); | |
t1 = $.getInterceptor(sb); | |
t2 = this.domain; | |
t1.add$1(sb, t2 == null ? 'null' : t2); | |
t1 = this.port; | |
if (!$.eqB(t1, 0)) { | |
$.getInterceptor(sb).add$1(sb, ':'); | |
$.getInterceptor(sb).add$1(sb, $.toString(t1)); | |
} | |
} | |
t1 = $.getInterceptor(sb); | |
t2 = this.path; | |
t1.add$1(sb, t2 == null ? 'null' : t2); | |
t1 = this.query; | |
$.Uri__addIfNonEmpty(sb, t1, '?', t1); | |
t1 = this.fragment; | |
$.Uri__addIfNonEmpty(sb, t1, '#', t1); | |
return $.toString(sb); | |
} | |
}; | |
$$.Maps__emitMap_anon = {"": ["result_3", "box_0", "visiting_2"], | |
"super": "Closure", | |
call$2: function(k, v) { | |
var t1, t2; | |
t1 = this.box_0; | |
if (t1.first_1 !== true) { | |
t2 = this.result_3; | |
$.getInterceptor(t2).add$1(t2, ', '); | |
} | |
t1.first_1 = false; | |
t1 = this.result_3; | |
t2 = this.visiting_2; | |
$.Collections__emitObject(k, t1, t2); | |
$.getInterceptor(t1).add$1(t1, ': '); | |
$.Collections__emitObject(v, t1, t2); | |
} | |
}; | |
$$.isolateCode_anon = {"": [], | |
"super": "Closure", | |
call$2: function(msg, reply) { | |
return reply.send$1('re: ' + $.S(msg)); | |
} | |
}; | |
$$._IsolateNatives__spawn_anon = {"": ["completer_1", "port_0"], | |
"super": "Closure", | |
call$2: function(msg, replyPort) { | |
this.port_0.close$0(); | |
this.completer_1.complete$1(replyPort); | |
} | |
}; | |
$$.anon = {"": ["this_0"], | |
"super": "Closure", | |
call$1: function(p) { | |
var t1, t2, t3; | |
t1 = this.this_0; | |
t1.set$_port(p); | |
for (t2 = $.iterator(t1.get$pending()); t2.get$hasNext() === true;) { | |
t3 = t2.next$0(); | |
p.send$2($.index(t3, 'message'), $.index(t3, 'replyTo')); | |
} | |
t1.set$pending(null); | |
} | |
}; | |
$$.DoubleLinkedQueue_length_anon = {"": ["box_0"], | |
"super": "Closure", | |
call$1: function(element) { | |
var t1 = this.box_0; | |
t1.counter_1 = $.add(t1.counter_1, 1); | |
} | |
}; | |
$$._LinkedHashMapImpl_forEach_anon = {"": ["f_0"], | |
"super": "Closure", | |
call$1: function(entry) { | |
this.f_0.call$2(entry.get$key(), entry.get$value()); | |
} | |
}; | |
$$._BaseSendPort_call_anon = {"": ["completer_1", "port_0"], | |
"super": "Closure", | |
call$2: function(value, ignoreReplyTo) { | |
var t1, t2; | |
this.port_0.close$0(); | |
t1 = typeof value === 'object' && value !== null && !!value.is$Exception; | |
t2 = this.completer_1; | |
if (t1) | |
t2.completeException$1(value); | |
else | |
t2.complete$1(value); | |
} | |
}; | |
$$._NativeJsSendPort_send_anon = {"": ["this_5", "replyTo_4", "message_3"], | |
"super": "Closure", | |
call$0: function() { | |
var t1, t2, t3, isolate, shouldSerialize, msg; | |
t1 = {}; | |
t2 = this.this_5; | |
t3 = this.replyTo_4; | |
t2._checkReplyTo$1(t3); | |
isolate = $.index($._globalState().get$isolates(), t2.get$_isolateId()); | |
if (isolate == null) | |
return; | |
if (t2.get$_receivePort().get$_callback() == null) | |
return; | |
shouldSerialize = !($._globalState().get$currentContext() == null) && !$.eqB($._globalState().get$currentContext().get$id(), t2.get$_isolateId()); | |
msg = this.message_3; | |
t1.msg_1 = msg; | |
t1.reply_2 = t3; | |
if (shouldSerialize) { | |
t1.msg_1 = $._serializeMessage(t1.msg_1); | |
t1.reply_2 = $._serializeMessage(t1.reply_2); | |
} | |
$._globalState().get$topEventLoop().enqueue$3(isolate, new $._NativeJsSendPort_send__anon(t2, t1, shouldSerialize), 'receive ' + $.S(msg)); | |
} | |
}; | |
$$._NativeJsSendPort_send__anon = {"": ["this_7", "box_0", "shouldSerialize_6"], | |
"super": "Closure", | |
call$0: function() { | |
var t1, t2; | |
t1 = this.this_7; | |
if (!(t1.get$_receivePort().get$_callback() == null)) { | |
if (this.shouldSerialize_6 === true) { | |
t2 = this.box_0; | |
t2.msg_1 = $._deserializeMessage(t2.msg_1); | |
t2.reply_2 = $._deserializeMessage(t2.reply_2); | |
} | |
t1 = t1.get$_receivePort(); | |
t2 = this.box_0; | |
t1._callback$2(t2.msg_1, t2.reply_2); | |
} | |
} | |
}; | |
$$._waitForPendingPorts_anon = {"": ["callback_0"], | |
"super": "Closure", | |
call$1: function(_) { | |
return this.callback_0.call$0(); | |
} | |
}; | |
$$._WorkerSendPort_send_anon = {"": ["this_2", "replyTo_1", "message_0"], | |
"super": "Closure", | |
call$0: function() { | |
var t1, t2, workerMessage, t3; | |
t1 = this.this_2; | |
t2 = this.replyTo_1; | |
t1._checkReplyTo$1(t2); | |
workerMessage = $._serializeMessage($.makeLiteralMap(['command', 'message', 'port', t1, 'msg', this.message_0, 'replyTo', t2])); | |
t2 = $._globalState().get$isWorker() === true; | |
t3 = $._globalState; | |
if (t2) | |
t3().get$mainManager().postMessage$1(workerMessage); | |
else | |
$.index(t3().get$managers(), t1.get$_workerId()).postMessage$1(workerMessage); | |
} | |
}; | |
$$._PendingSendPortFinder_visitMap_anon = {"": ["this_0"], | |
"super": "Closure", | |
call$1: function(e) { | |
return this.this_0._dispatch$1(e); | |
} | |
}; | |
$$._LinkedHashMapImpl_values_anon = {"": ["box_0", "list_2"], | |
"super": "Closure", | |
call$1: function(entry) { | |
var t1, t2, t3; | |
t1 = this.list_2; | |
t2 = this.box_0; | |
t3 = t2.index_1; | |
t2.index_1 = $.add(t3, 1); | |
$.indexSet(t1, t3, entry.get$value()); | |
} | |
}; | |
$$._HashMapImpl_values_anon = {"": ["box_0", "list_2"], | |
"super": "Closure", | |
call$2: function(key, value) { | |
var t1, t2, t3; | |
t1 = this.list_2; | |
t2 = this.box_0; | |
t3 = t2.i_1; | |
t2.i_1 = $.add(t3, 1); | |
$.indexSet(t1, t3, value); | |
} | |
}; | |
$$._LinkedHashMapImpl_keys_anon = {"": ["box_0", "list_2"], | |
"super": "Closure", | |
call$1: function(entry) { | |
var t1, t2, t3; | |
t1 = this.list_2; | |
t2 = this.box_0; | |
t3 = t2.index_10; | |
t2.index_10 = $.add(t3, 1); | |
$.indexSet(t1, t3, entry.get$key()); | |
} | |
}; | |
$$._HashMapImpl_keys_anon = {"": ["box_0", "list_2"], | |
"super": "Closure", | |
call$2: function(key, value) { | |
var t1, t2, t3; | |
t1 = this.list_2; | |
t2 = this.box_0; | |
t3 = t2.i_10; | |
t2.i_10 = $.add(t3, 1); | |
$.indexSet(t1, t3, key); | |
} | |
}; | |
$$._Copier_visitMap_anon = {"": ["box_0", "this_2"], | |
"super": "Closure", | |
call$2: function(key, val) { | |
var t1, t2; | |
t1 = this.box_0.copy_1; | |
t2 = this.this_2; | |
$.indexSet(t1, t2._dispatch$1(key), t2._dispatch$1(val)); | |
} | |
}; | |
$$._PendingSendPortFinder_visitList_anon = {"": ["this_0"], | |
"super": "Closure", | |
call$1: function(e) { | |
return this.this_0._dispatch$1(e); | |
} | |
}; | |
$$.Futures_wait_anon = {"": ["pos_5", "result_4", "completer_3", "box_0", "values_2"], | |
"super": "Closure", | |
call$1: function(value) { | |
var t1, t2, remaining; | |
t1 = this.values_2; | |
$.indexSet(t1, this.pos_5, value); | |
t2 = this.box_0; | |
remaining = $.sub(t2.remaining_1, 1); | |
t2.remaining_1 = remaining; | |
if ($.eqB(remaining, 0) && this.result_4.get$isComplete() !== true) | |
this.completer_3.complete$1(t1); | |
} | |
}; | |
$$.Futures_wait_anon0 = {"": ["future_8", "result_7", "completer_6"], | |
"super": "Closure", | |
call$1: function(exception) { | |
if (this.result_7.get$isComplete() !== true) | |
this.completer_6.completeException$2(exception, this.future_8.get$stackTrace()); | |
return true; | |
} | |
}; | |
$$.NoSuchMethodError_toString_anon = {"": ["box_0"], | |
"super": "Closure", | |
call$2: function(key, value) { | |
var t1, t2; | |
t1 = this.box_0; | |
if ($.gtB(t1.i_2, 0)) { | |
t2 = t1.sb_1; | |
$.getInterceptor(t2).add$1(t2, ', '); | |
} | |
t2 = t1.sb_1; | |
$.getInterceptor(t2).add$1(t2, key); | |
t2 = t1.sb_1; | |
$.getInterceptor(t2).add$1(t2, ': '); | |
t2 = t1.sb_1; | |
$.getInterceptor(t2).add$1(t2, $.NoSuchMethodError_safeToString(value)); | |
t1.i_2 = $.add(t1.i_2, 1); | |
} | |
}; | |
$$._IsolateNatives__startNonWorker_function = {"": ["functionName_1", "replyPort_0"], | |
"super": "Closure", | |
call$0: function() { | |
$._IsolateNatives__startIsolate($globalThis[this.functionName_1], this.replyPort_0); | |
} | |
}; | |
$$._IsolateNatives__spawnWorker_anon = {"": ["worker_0"], | |
"super": "Closure", | |
call$1: function(e) { | |
$._IsolateNatives__processWorkerMessage(this.worker_0, e); | |
} | |
}; | |
$$._IsolateNatives__processWorkerMessage_function = {"": ["replyTo_1", "entryPoint_0"], | |
"super": "Closure", | |
call$0: function() { | |
$._IsolateNatives__startIsolate(this.entryPoint_0, this.replyTo_1); | |
} | |
}; | |
$$._IsolateNatives__startIsolate_anon = {"": [], | |
"super": "Closure", | |
call$0: function() { | |
$._TimerFactory__factory = $._timerFactory; | |
return; | |
} | |
}; | |
$$.anon0 = {"": ["callback_1", "this_0"], | |
"super": "Closure", | |
call$0: function() { | |
return this.callback_1.call$1(this.this_0); | |
} | |
}; | |
$$.invokeClosure_anon = {"": ["closure_0"], | |
"super": "Closure", | |
call$0: function() { | |
return this.closure_0.call$0(); | |
} | |
}; | |
$$.invokeClosure_anon0 = {"": ["closure_2", "arg1_1"], | |
"super": "Closure", | |
call$0: function() { | |
return this.closure_2.call$1(this.arg1_1); | |
} | |
}; | |
$$.invokeClosure_anon1 = {"": ["arg2_5", "closure_4", "arg1_3"], | |
"super": "Closure", | |
call$0: function() { | |
return this.closure_4.call$2(this.arg1_3, this.arg2_5); | |
} | |
}; | |
$$.anon1 = {"": ["this_1", "callback_0"], | |
"super": "Closure", | |
call$0: function() { | |
return this.callback_0.call$1(this.this_1); | |
} | |
}; | |
$$.startRootIsolate_anon = {"": [], | |
"super": "Closure", | |
call$0: function() { | |
$._TimerFactory__factory = $._timerFactory; | |
return; | |
} | |
}; | |
$$._EventLoop__runHelper_next = {"": ["this_0"], | |
"super": "Closure", | |
call$0: function() { | |
if (this.this_0.runIteration$0() !== true) | |
return; | |
$._window().setTimeout$2(this, 0); | |
} | |
}; | |
$.Arrays_indexOf = function(a, element, startIndex, endIndex) { | |
var t1, i; | |
t1 = a.length; | |
if (startIndex >= t1) | |
return -1; | |
if (startIndex < 0) | |
startIndex = 0; | |
for (i = startIndex; i < endIndex; ++i) { | |
if (i < 0 || i >= t1) | |
throw $.ioore(i); | |
if ($.eqB(a[i], element)) | |
return i; | |
} | |
return -1; | |
}; | |
$.add = function(a, b) { | |
return typeof a === 'number' && typeof b === 'number' ? a + b : $.add$slow(a, b); | |
}; | |
$.sub = function(a, b) { | |
return typeof a === 'number' && typeof b === 'number' ? a - b : $.sub$slow(a, b); | |
}; | |
$.Arrays_lastIndexOf = function(a, element, startIndex) { | |
var t1, i; | |
if (typeof a !== 'string' && (typeof a !== 'object' || a === null || a.constructor !== Array && !a.is$JavaScriptIndexingBehavior)) | |
return $.Arrays_lastIndexOf$bailout(1, a, element, startIndex); | |
if (startIndex < 0) | |
return -1; | |
t1 = a.length; | |
if (startIndex >= t1) | |
startIndex = t1 - 1; | |
for (i = startIndex; i >= 0; --i) { | |
if (i !== (i | 0)) | |
throw $.iae(i); | |
if (i < 0 || i >= a.length) | |
throw $.ioore(i); | |
if ($.eqB(a[i], element)) | |
return i; | |
} | |
return -1; | |
}; | |
$._BufferingSendPort$ = function(isolateId, _futurePort) { | |
var t1 = new $._BufferingSendPort($._BufferingSendPort__idCount, null, _futurePort, [], isolateId); | |
t1._BufferingSendPort$2(isolateId, _futurePort); | |
return t1; | |
}; | |
$.gtB = function(a, b) { | |
return typeof a === 'number' && typeof b === 'number' ? a > b : $.gt$slow(a, b) === true; | |
}; | |
$.geB = function(a, b) { | |
return typeof a === 'number' && typeof b === 'number' ? a >= b : $.ge$slow(a, b) === true; | |
}; | |
$.ltB = function(a, b) { | |
return typeof a === 'number' && typeof b === 'number' ? a < b : $.lt$slow(a, b) === true; | |
}; | |
$.index = function(a, index) { | |
var key; | |
if (typeof a == "string" || a.constructor === Array) { | |
key = index >>> 0; | |
if (key === index && key < a.length) | |
return a[key]; | |
} | |
return $.index$slow(a, index); | |
}; | |
$.indexSet = function(a, index, value) { | |
var key; | |
if (a.constructor === Array && !a.immutable$list) { | |
key = index >>> 0; | |
if (key === index && key < a.length) { | |
a[key] = value; | |
return; | |
} | |
} | |
$.indexSet$slow(a, index, value); | |
}; | |
$.checkNumbers = function(a, b) { | |
if (typeof a === 'number') | |
if (typeof b === 'number') | |
return true; | |
else { | |
$.checkNull(b); | |
throw $.$$throw($.ArgumentError$(b)); | |
} | |
return false; | |
}; | |
$.isJsArray = function(value) { | |
return !(value == null) && value.constructor === Array; | |
}; | |
$.add$slow = function(a, b) { | |
if ($.checkNumbers(a, b)) | |
return a + b; | |
return a.operator$add$1(b); | |
}; | |
$.sub$slow = function(a, b) { | |
if ($.checkNumbers(a, b)) | |
return a - b; | |
return a.operator$sub$1(b); | |
}; | |
$.tdiv = function(a, b) { | |
if ($.checkNumbers(a, b)) | |
return $.truncate(a / b); | |
return a.operator$tdiv$1(b); | |
}; | |
$.eq = function(a, b) { | |
if (a == null) | |
return b == null; | |
if (b == null) | |
return false; | |
if (typeof a === "object") | |
if (!!a.operator$eq$1) | |
return a.operator$eq$1(b); | |
return a === b; | |
}; | |
$.eqB = function(a, b) { | |
if (a == null) | |
return b == null; | |
if (b == null) | |
return false; | |
if (typeof a === "object") | |
if (!!a.operator$eq$1) | |
return a.operator$eq$1(b) === true; | |
return a === b; | |
}; | |
$.gt$slow = function(a, b) { | |
if ($.checkNumbers(a, b)) | |
return a > b; | |
return a.operator$gt$1(b); | |
}; | |
$.ge$slow = function(a, b) { | |
if ($.checkNumbers(a, b)) | |
return a >= b; | |
return a.operator$ge$1(b); | |
}; | |
$.lt$slow = function(a, b) { | |
if ($.checkNumbers(a, b)) | |
return a < b; | |
return a.operator$lt$1(b); | |
}; | |
$.shl = function(a, b) { | |
if ($.checkNumbers(a, b)) { | |
if (b < 0) | |
throw $.$$throw($.ArgumentError$(b)); | |
if (b > 31) | |
return 0; | |
return (a << b) >>> 0; | |
} | |
return a.operator$shl$1(b); | |
}; | |
$.and = function(a, b) { | |
if ($.checkNumbers(a, b)) | |
return (a & b) >>> 0; | |
return a.operator$and$1(b); | |
}; | |
$.xor = function(a, b) { | |
if ($.checkNumbers(a, b)) | |
return (a ^ b) >>> 0; | |
return a.operator$xor$1(b); | |
}; | |
$._MessageTraverserVisitedMap$ = function() { | |
return new $._MessageTraverserVisitedMap(); | |
}; | |
$.index$slow = function(a, index) { | |
var t1; | |
if (!(typeof a === 'string')) | |
t1 = !(a == null) && a.constructor === Array; | |
else | |
t1 = true; | |
if (t1) { | |
if (!(typeof index === 'number' && Math.floor(index) === index)) { | |
if (!(typeof index === 'number')) | |
throw $.$$throw($.ArgumentError$(index)); | |
if (!($.truncate(index) === index)) | |
throw $.$$throw($.ArgumentError$(index)); | |
} | |
if ($.ltB(index, 0) || $.geB(index, $.get$length(a))) | |
throw $.$$throw($.RangeError$value(index)); | |
return a[index]; | |
} | |
return a.operator$index$1(index); | |
}; | |
$.indexSet$slow = function(a, index, value) { | |
if (!(a == null) && a.constructor === Array) { | |
if (!(typeof index === 'number' && Math.floor(index) === index)) | |
throw $.$$throw($.ArgumentError$(index)); | |
if (index < 0 || $.geB(index, $.get$length(a))) | |
throw $.$$throw($.RangeError$value(index)); | |
$.checkMutable(a, 'indexed set'); | |
a[index] = value; | |
return; | |
} | |
a.oprator$indexSet$2(index, value); | |
}; | |
$.checkMutable = function(list, reason) { | |
if (!!(list.immutable$list)) | |
throw $.$$throw($.UnsupportedError$(reason)); | |
}; | |
$.checkGrowable = function(list, reason) { | |
if (!!(list.fixed$length)) | |
throw $.$$throw($.UnsupportedError$(reason)); | |
}; | |
$.S = function(value) { | |
var res = $.toString(value); | |
if (!(typeof res === 'string')) | |
throw $.$$throw($.ArgumentError$(value)); | |
return res; | |
}; | |
$._JsCopier$ = function() { | |
var t1 = new $._JsCopier($._MessageTraverserVisitedMap$()); | |
t1._JsCopier$0(); | |
return t1; | |
}; | |
$.iae = function(argument) { | |
throw $.$$throw($.ArgumentError$(argument)); | |
}; | |
$.ioore = function(index) { | |
throw $.$$throw($.RangeError$value(index)); | |
}; | |
$.checkNull = function(object) { | |
if (object == null) | |
throw $.$$throw($.NullPointerException$(null, $.CTC3)); | |
return object; | |
}; | |
$.checkNum = function(value) { | |
if (!(typeof value === 'number')) { | |
$.checkNull(value); | |
throw $.$$throw($.ArgumentError$(value)); | |
} | |
return value; | |
}; | |
$.$$throw = function(ex) { | |
var jsError; | |
if (ex == null) | |
ex = $.CTC2; | |
jsError = new Error(); | |
jsError.name = ex; | |
jsError.description = ex; | |
jsError.dartException = ex; | |
jsError.toString = $.toStringWrapper.call$0; | |
throw jsError; | |
}; | |
$.toStringWrapper = function() { | |
return $.toString(this.dartException); | |
}; | |
$.unwrapException = function(ex) { | |
var message, type, name$, ieErrorCode, ieFacilityNumber, t1; | |
if ("dartException" in ex) | |
return ex.dartException; | |
message = ex.message; | |
if (ex instanceof TypeError) { | |
type = ex.type; | |
name$ = ex.arguments ? ex.arguments[0] : ""; | |
if ($.eqB(type, 'property_not_function') || $.eqB(type, 'called_non_callable') || $.eqB(type, 'non_object_property_call') || $.eqB(type, 'non_object_property_load')) | |
return $.NullPointerException$(null, $.CTC3); | |
else if ($.eqB(type, 'undefined_method')) | |
return $.NoSuchMethodError$('', name$, [], $.makeLiteralMap([]), null); | |
ieErrorCode = ex.number & 0xffff; | |
ieFacilityNumber = ex.number>>16 & 0x1FFF; | |
if (typeof message === 'string') | |
if ($.getInterceptor(message).endsWith$1(message, 'is null') === true || $.getInterceptor(message).endsWith$1(message, 'is undefined') === true || $.getInterceptor(message).endsWith$1(message, 'is null or undefined') === true) | |
return $.NullPointerException$(null, $.CTC3); | |
else { | |
if ($.contains$1(message, ' is not a function') !== true) | |
t1 = ieErrorCode === 438 && ieFacilityNumber === 10; | |
else | |
t1 = true; | |
if (t1) | |
return $.NoSuchMethodError$('', '<unknown>', [], $.makeLiteralMap([]), null); | |
} | |
return $._ExceptionImplementation$(typeof message === 'string' ? message : ''); | |
} | |
if (ex instanceof RangeError) { | |
if (typeof message === 'string' && $.contains$1(message, 'call stack') === true) | |
return $.StackOverflowError$(); | |
return $.ArgumentError$(null); | |
} | |
if (typeof InternalError == 'function' && ex instanceof InternalError) | |
if (typeof message === 'string' && message === 'too much recursion') | |
return $.StackOverflowError$(); | |
return ex; | |
}; | |
$.getTraceFromException = function(exception) { | |
return $.StackTrace$(exception.stack); | |
}; | |
$.makeLiteralMap = function(keyValuePairs) { | |
var iterator, result; | |
iterator = $.iterator(keyValuePairs); | |
result = $.LinkedHashMap_LinkedHashMap(); | |
for (; iterator.get$hasNext() === true;) | |
$.indexSet(result, iterator.next$0(), iterator.next$0()); | |
return result; | |
}; | |
$.invokeClosure = function(closure, isolate, numberOfArguments, arg1, arg2) { | |
if ($.eqB(numberOfArguments, 0)) | |
return $._callInIsolate(isolate, new $.invokeClosure_anon(closure)); | |
else if ($.eqB(numberOfArguments, 1)) | |
return $._callInIsolate(isolate, new $.invokeClosure_anon0(closure, arg1)); | |
else if ($.eqB(numberOfArguments, 2)) | |
return $._callInIsolate(isolate, new $.invokeClosure_anon1(arg2, closure, arg1)); | |
else | |
throw $.$$throw($._ExceptionImplementation$('Unsupported number of arguments for wrapped closure')); | |
}; | |
$._JsVisitedMap$ = function() { | |
return new $._JsVisitedMap(null); | |
}; | |
$.convertDartClosureToJS = function(closure, arity) { | |
var function$; | |
if (closure == null) | |
return; | |
function$ = closure.$identity; | |
if (!!function$) | |
return function$; | |
function$ = function() { | |
return $.invokeClosure.call$5(closure, $._currentIsolate(), arity, arguments[0], arguments[1]); | |
}; | |
closure.$identity = function$; | |
return function$; | |
}; | |
$.FormatException$ = function(message) { | |
return new $.FormatException(message); | |
}; | |
$.checkString = function(value) { | |
if (!(typeof value === 'string')) { | |
$.checkNull(value); | |
throw $.$$throw($.ArgumentError$(value)); | |
} | |
return value; | |
}; | |
$._MatchImplementation$ = function(pattern, str, start, end, _groups) { | |
return new $._MatchImplementation(pattern, str, start, end, _groups); | |
}; | |
$.throwCyclicInit = function(staticName) { | |
throw $.$$throw($.RuntimeError$('Cyclic initialization for static ' + $.S(staticName))); | |
}; | |
$.Future_Future$immediate = function(value) { | |
return $._FutureImpl__FutureImpl$immediate(value); | |
}; | |
$.typeNameInSafari = function(obj) { | |
var name$ = $.constructorNameFallback(obj); | |
if (name$ === 'Window') | |
return 'DOMWindow'; | |
if (name$ === 'CanvasPixelArray') | |
return 'Uint8ClampedArray'; | |
if (name$ === 'WebKitMutationObserver') | |
return 'MutationObserver'; | |
if (name$ === 'AudioChannelMerger') | |
return 'ChannelMergerNode'; | |
if (name$ === 'AudioChannelSplitter') | |
return 'ChannelSplitterNode'; | |
if (name$ === 'AudioGainNode') | |
return 'GainNode'; | |
if (name$ === 'AudioPannerNode') | |
return 'PannerNode'; | |
if (name$ === 'JavaScriptAudioNode') | |
return 'ScriptProcessorNode'; | |
if (name$ === 'Oscillator') | |
return 'OscillatorNode'; | |
if (name$ === 'RealtimeAnalyserNode') | |
return 'AnalyserNode'; | |
return name$; | |
}; | |
$.typeNameInOpera = function(obj) { | |
var name$ = $.constructorNameFallback(obj); | |
if (name$ === 'Window') | |
return 'DOMWindow'; | |
return name$; | |
}; | |
$.typeNameInFirefox = function(obj) { | |
var name$ = $.constructorNameFallback(obj); | |
if (name$ === 'Window') | |
return 'DOMWindow'; | |
if (name$ === 'XMLDocument') | |
return 'Document'; | |
if (name$ === 'WorkerMessageEvent') | |
return 'MessageEvent'; | |
if (name$ === 'DragEvent') | |
return 'MouseEvent'; | |
if (name$ === 'DataTransfer') | |
return 'Clipboard'; | |
if (name$ === 'MouseScrollEvent') | |
return 'WheelEvent'; | |
if (name$ === 'OfflineResourceList') | |
return 'DOMApplicationCache'; | |
return name$; | |
}; | |
$.typeNameInIE = function(obj) { | |
var name$ = $.constructorNameFallback(obj); | |
if (name$ === 'Window') | |
return 'DOMWindow'; | |
if (name$ === 'Document') { | |
if (!!obj.xmlVersion) | |
return 'Document'; | |
return 'HTMLDocument'; | |
} | |
if (name$ === 'ApplicationCache') | |
return 'DOMApplicationCache'; | |
if (name$ === 'CanvasPixelArray') | |
return 'Uint8ClampedArray'; | |
if (name$ === 'DataTransfer') | |
return 'Clipboard'; | |
if (name$ === 'DragEvent') | |
return 'MouseEvent'; | |
if (name$ === 'HTMLDDElement') | |
return 'HTMLElement'; | |
if (name$ === 'HTMLDTElement') | |
return 'HTMLElement'; | |
if (name$ === 'HTMLTableDataCellElement') | |
return 'HTMLTableCellElement'; | |
if (name$ === 'HTMLTableHeaderCellElement') | |
return 'HTMLTableCellElement'; | |
if (name$ === 'HTMLPhraseElement') | |
return 'HTMLElement'; | |
if (name$ === 'MSStyleCSSProperties') | |
return 'CSSStyleDeclaration'; | |
if (name$ === 'MouseWheelEvent') | |
return 'WheelEvent'; | |
return name$; | |
}; | |
$.constructorNameFallback = function(object) { | |
var constructor$, name$, t1, string; | |
if (object == null) | |
return 'Null'; | |
constructor$ = object.constructor; | |
if (typeof(constructor$) === 'function') { | |
name$ = constructor$.name; | |
if (typeof name$ === 'string') | |
t1 = !(name$ === '') && !(name$ === 'Object') && !(name$ === 'Function.prototype'); | |
else | |
t1 = false; | |
if (t1) | |
return name$; | |
} | |
string = Object.prototype.toString.call(object); | |
return string.substring(8, string.length - 1); | |
}; | |
$.Completer_Completer = function() { | |
return $._CompleterImpl$(); | |
}; | |
$.getFunctionForTypeNameOf = function() { | |
if (!(typeof(navigator) === 'object')) | |
return $.typeNameInChrome; | |
var userAgent = navigator.userAgent; | |
if (userAgent.indexOf('Chrome') !== -1 || userAgent.indexOf('DumpRenderTree') !== -1) | |
return $.typeNameInChrome; | |
else if (userAgent.indexOf('Firefox') !== -1) | |
return $.typeNameInFirefox; | |
else if (userAgent.indexOf('MSIE') !== -1) | |
return $.typeNameInIE; | |
else if (userAgent.indexOf('Opera') !== -1) | |
return $.typeNameInOpera; | |
else if (userAgent.indexOf('AppleWebKit') !== -1) | |
return $.typeNameInSafari; | |
else | |
return $.constructorNameFallback; | |
}; | |
$.getTypeNameOf = function(obj) { | |
if ($._getTypeNameOf == null) | |
$._getTypeNameOf = $.getFunctionForTypeNameOf(); | |
return $._getTypeNameOf.call$1(obj); | |
}; | |
$.toStringForNativeObject = function(obj) { | |
return 'Instance of ' + $.getTypeNameOf(obj); | |
}; | |
$.hashCodeForNativeObject = function(object) { | |
return $.Primitives_objectHashCode(object); | |
}; | |
$.defineProperty = function(obj, property, value) { | |
Object.defineProperty(obj, property, | |
{value: value, enumerable: false, writable: true, configurable: true}); | |
}; | |
$.dynamicBind = function(obj, name$, methods, arguments$) { | |
var tag, hasOwnProperty, method, i, entry, proto; | |
tag = $.getTypeNameOf(obj); | |
hasOwnProperty = Object.prototype.hasOwnProperty; | |
method = $.lookupDynamicClass(hasOwnProperty, methods, tag); | |
if (method == null && !($._dynamicMetadata0() == null)) | |
for (i = 0; i < $._dynamicMetadata0().length; ++i) { | |
entry = $._dynamicMetadata0()[i]; | |
if (hasOwnProperty.call(entry.get$_set(), tag)) { | |
method = $.lookupDynamicClass(hasOwnProperty, methods, entry.get$_tag()); | |
if (!(method == null)) | |
break; | |
} | |
} | |
if (method == null) | |
method = $.lookupDynamicClass(hasOwnProperty, methods, $.getTypeNameOf($.CTC5)); | |
proto = Object.getPrototypeOf(obj); | |
if (method == null) | |
method = function () {if (Object.getPrototypeOf(this) === proto) {throw new TypeError(name$ + " is not a function");} else {return Object.prototype[name$].apply(this, arguments);}}; | |
if (!hasOwnProperty.call(proto, name$)) | |
$.defineProperty(proto, name$, method); | |
return method.apply(obj, arguments$); | |
}; | |
$.lookupDynamicClass = function(hasOwnProperty, methods, className) { | |
return hasOwnProperty.call(methods, className) ? methods[className] : null; | |
}; | |
$.typeNameInChrome = function(obj) { | |
var name$ = obj.constructor.name; | |
if (name$ === 'Window') | |
return 'DOMWindow'; | |
if (name$ === 'CanvasPixelArray') | |
return 'Uint8ClampedArray'; | |
if (name$ === 'WebKitMutationObserver') | |
return 'MutationObserver'; | |
if (name$ === 'AudioChannelMerger') | |
return 'ChannelMergerNode'; | |
if (name$ === 'AudioChannelSplitter') | |
return 'ChannelSplitterNode'; | |
if (name$ === 'AudioGainNode') | |
return 'GainNode'; | |
if (name$ === 'AudioPannerNode') | |
return 'PannerNode'; | |
if (name$ === 'JavaScriptAudioNode') | |
return 'ScriptProcessorNode'; | |
if (name$ === 'Oscillator') | |
return 'OscillatorNode'; | |
if (name$ === 'RealtimeAnalyserNode') | |
return 'AnalyserNode'; | |
return name$; | |
}; | |
$.dynamicFunction = function(name$) { | |
var f, methods, dartMethod, bind; | |
f = Object.prototype[name$]; | |
if (!(f == null) && !!f.methods) | |
return f.methods; | |
methods = {}; | |
dartMethod = Object.getPrototypeOf($.CTC5)[name$]; | |
if (!(dartMethod == null)) | |
methods['Object'] = dartMethod; | |
bind = function() {return $.dynamicBind.call$4(this, name$, methods, Array.prototype.slice.call(arguments));}; | |
bind.methods = methods; | |
$.defineProperty(Object.prototype, name$, bind); | |
return methods; | |
}; | |
$.Primitives_objectHashCode = function(object) { | |
var hash = object.$identityHash; | |
if (hash == null) { | |
hash = $.add($.Primitives_hashCodeSeed, 1); | |
$.Primitives_hashCodeSeed = hash; | |
object.$identityHash = hash; | |
} | |
return hash; | |
}; | |
$.Primitives_printString = function(string) { | |
if ('\nThis program is using an experimental feature called "mirrors". As\ncurrently implemented, mirrors do not work with minification, and will\ncause spurious errors depending on how code was optimized.\n\nThe authors of this program are aware of these problems and have\ndecided the thrill of using an experimental feature is outweighing the\nrisks. Furthermore, the authors of this program understand that\nlong-term, to fix the problems mentioned above, mirrors may have\nnegative impact on size and performance of Dart programs compiled to\nJavaScript.\n' === string) | |
$.Primitives_mirrorsEnabled = true; | |
else if (typeof dartPrint == "function") { | |
dartPrint(string); | |
return; | |
} | |
if (typeof window == "object") { | |
if (typeof console == "object") | |
console.log(string); | |
return; | |
} | |
if (typeof print == "function") { | |
print(string); | |
return; | |
} | |
throw 'Unable to print message: ' + String(string); | |
}; | |
$.Primitives_parseInt = function(string) { | |
var match, base, result; | |
$.checkString(string); | |
match = /^\s*[+-]?(?:0(x)[a-f0-9]+|\d+)\s*$/i.exec(string); | |
if (match == null) | |
throw $.$$throw($.FormatException$(string)); | |
base = !($.index(match, 1) == null) ? 16 : 10; | |
result = parseInt(string, base); | |
if ($.get$isNaN(result) === true) | |
throw $.$$throw($.FormatException$(string)); | |
return result; | |
}; | |
$._dynamicMetadata = function(table) { | |
$dynamicMetadata = table; | |
}; | |
$._ReceivePortImpl$ = function() { | |
var t1 = $._ReceivePortImpl__nextFreeId; | |
$._ReceivePortImpl__nextFreeId = $.add(t1, 1); | |
t1 = new $._ReceivePortImpl(t1, null); | |
t1._ReceivePortImpl$0(); | |
return t1; | |
}; | |
$.Primitives_objectTypeName = function(object) { | |
var name$, decompiled; | |
name$ = $.constructorNameFallback(object); | |
if ($.eqB(name$, 'Object')) { | |
decompiled = String(object.constructor).match(/^\s*function\s*(\S*)\s*\(/)[1]; | |
if (typeof decompiled === 'string') | |
name$ = decompiled; | |
} | |
return $.getInterceptor(name$).charCodeAt$1(name$, 0) === 36 ? $.getInterceptor(name$).substring$1(name$, 1) : name$; | |
}; | |
$.Primitives_objectToString = function(object) { | |
return 'Instance of \'' + $.S($.Primitives_objectTypeName(object)) + '\''; | |
}; | |
$.Primitives_newList = function(length$) { | |
var result; | |
if (length$ == null) | |
return new Array(); | |
if (!(typeof length$ === 'number' && Math.floor(length$) === length$) || length$ < 0) | |
throw $.$$throw($.ArgumentError$(length$)); | |
result = new Array(length$); | |
result.fixed$length = true; | |
return result; | |
}; | |
$.regExpMakeNative = function(regExp, global, exception) { | |
var pattern, multiLine, ignoreCase, sb, t1, e; | |
pattern = regExp.get$pattern(); | |
multiLine = regExp.get$multiLine(); | |
ignoreCase = regExp.get$ignoreCase(); | |
$.checkString(pattern); | |
sb = $.StringBuffer_StringBuffer(''); | |
if (multiLine === true) { | |
t1 = sb; | |
$.getInterceptor(t1).add$1(t1, 'm'); | |
} | |
if (ignoreCase === true) { | |
t1 = sb; | |
$.getInterceptor(t1).add$1(t1, 'i'); | |
} | |
if (global === true) { | |
t1 = sb; | |
$.getInterceptor(t1).add$1(t1, 'g'); | |
} | |
try { | |
t1 = new RegExp(pattern, $.toString(sb)); | |
return t1; | |
} catch (exception) { | |
t1 = $.unwrapException(exception); | |
e = t1; | |
throw $.$$throw($.IllegalJSRegExpException$(pattern, String(e))); | |
} | |
}; | |
$.regExpExec = function(regExp, str) { | |
var result = $.regExpGetNative(regExp).exec(str); | |
if (result == null) | |
return; | |
return result; | |
}; | |
$.buildDynamicMetadata = function(inputTable) { | |
var result, i, tag, tags, set, tagNames, j; | |
result = []; | |
for (i = 0; i < inputTable.length; ++i) { | |
tag = inputTable[i][0]; | |
tags = inputTable[i][1]; | |
set = {}; | |
tagNames = $.getInterceptor(tags).split$1(tags, '|'); | |
for (j = 0; j < tagNames.length; ++j) | |
set[tagNames[j]] = true; | |
$.getInterceptor(result).add$1(result, $.MetaInfo$(tag, tags, set)); | |
} | |
return result; | |
}; | |
$.regExpGetNative = function(regExp) { | |
var r = regExp._re; | |
return r == null ? regExp._re = $.regExpMakeNative(regExp, false) : r; | |
}; | |
$._dynamicMetadata0 = function() { | |
if (typeof($dynamicMetadata) === 'undefined') { | |
var t1 = []; | |
$._dynamicMetadata(t1); | |
} | |
return $dynamicMetadata; | |
}; | |
$.MetaInfo$ = function(_tag, _tags, _set) { | |
return new $.MetaInfo(_tag, _tags, _set); | |
}; | |
$.stringContainsUnchecked = function(receiver, other, startIndex) { | |
return !$.eqB($.indexOf$2(receiver, other, startIndex), -1); | |
}; | |
$.stringReplaceJS = function(receiver, replacer, to) { | |
return receiver.replace(replacer, to.replace('$', '$$$$')); | |
}; | |
$.stringReplaceAllUnchecked = function(receiver, from, to) { | |
var result, length$, i; | |
if (typeof receiver !== 'string') | |
return $.stringReplaceAllUnchecked$bailout(1, receiver, from, to); | |
if (typeof from === 'string') | |
if (from === '') | |
if (receiver === '') | |
return to; | |
else { | |
result = $.StringBuffer_StringBuffer(''); | |
length$ = receiver.length; | |
$.getInterceptor(result).add$1(result, to); | |
for (i = 0; i < length$; ++i) { | |
$.getInterceptor(result).add$1(result, receiver[i]); | |
$.getInterceptor(result).add$1(result, to); | |
} | |
return $.toString(result); | |
} | |
else | |
return $.stringReplaceJS(receiver, $.regExpMakeNative($.JSSyntaxRegExp$(from.replace($.regExpMakeNative($.get$quoteRegExp(), true), "\\$&"), false, false), true), to); | |
else if (typeof from === 'object' && from !== null && !!from.is$JSSyntaxRegExp) | |
return $.stringReplaceJS(receiver, $.regExpMakeNative(from, true), to); | |
else { | |
$.checkNull(from); | |
throw $.$$throw('String.replaceAll(Pattern) UNIMPLEMENTED'); | |
} | |
}; | |
$.dynamicSetMetadata = function(inputTable) { | |
var t1 = $.buildDynamicMetadata(inputTable); | |
$._dynamicMetadata(t1); | |
}; | |
$.stringJoinUnchecked = function(array, separator) { | |
return array.join(separator); | |
}; | |
$.stringSplitUnchecked = function(receiver, pattern) { | |
if (typeof pattern === 'string') | |
return receiver.split(pattern); | |
else if (typeof pattern === 'object' && pattern !== null && !!pattern.is$JSSyntaxRegExp) | |
return receiver.split($.regExpGetNative(pattern)); | |
else | |
throw $.$$throw('String.split(Pattern) UNIMPLEMENTED'); | |
}; | |
$._PendingSendPortFinder$ = function() { | |
var t1 = $._MessageTraverserVisitedMap$(); | |
t1 = new $._PendingSendPortFinder([], t1); | |
t1._PendingSendPortFinder$0(); | |
return t1; | |
}; | |
$.Collections_forEach = function(iterable, f) { | |
var t1; | |
for (t1 = $.iterator(iterable); t1.get$hasNext() === true;) | |
f.call$1(t1.next$0()); | |
}; | |
$.Collections_collectionToString = function(c) { | |
var result = $.StringBuffer_StringBuffer(''); | |
$.Collections__emitCollection(c, result, $._ListImpl_List(null)); | |
return $.toString(result); | |
}; | |
$.Collections__emitCollection = function(c, result, visiting) { | |
var isList, t1, first, t2; | |
$.getInterceptor(visiting).add$1(visiting, c); | |
isList = typeof c === 'object' && c !== null && (c.constructor === Array || !!c.is$List); | |
t1 = $.getInterceptor(result); | |
t1.add$1(result, isList ? '[' : '{'); | |
for (t1 = $.iterator(c), first = true; t1.get$hasNext() === true; first = false) { | |
t2 = t1.next$0(); | |
if (!first) | |
$.getInterceptor(result).add$1(result, ', '); | |
$.Collections__emitObject(t2, result, visiting); | |
} | |
t1 = $.getInterceptor(result); | |
t1.add$1(result, isList ? ']' : '}'); | |
$.getInterceptor(visiting).removeLast$0(visiting); | |
}; | |
$.Collections__emitObject = function(o, result, visiting) { | |
var t1; | |
if (typeof o === 'object' && o !== null && (o.constructor === Array || !!o.is$Collection)) | |
if ($.Collections__containsRef(visiting, o)) { | |
t1 = $.getInterceptor(result); | |
t1.add$1(result, typeof o === 'object' && o !== null && (o.constructor === Array || !!o.is$List) ? '[...]' : '{...}'); | |
} else | |
$.Collections__emitCollection(o, result, visiting); | |
else if (typeof o === 'object' && o !== null && !!o.is$Map) | |
if ($.Collections__containsRef(visiting, o)) | |
$.getInterceptor(result).add$1(result, '{...}'); | |
else | |
$.Maps__emitMap(o, result, visiting); | |
else | |
$.getInterceptor(result).add$1(result, o); | |
}; | |
$.Collections__containsRef = function(c, ref) { | |
var t1, t2; | |
for (t1 = $.iterator(c); t1.get$hasNext() === true;) { | |
t2 = t1.next$0(); | |
if (t2 == null ? ref == null : t2 === ref) | |
return true; | |
} | |
return false; | |
}; | |
$.Futures_wait = function(futures) { | |
var t1, completer, result, values, i, future; | |
t1 = {}; | |
if (typeof futures !== 'string' && (typeof futures !== 'object' || futures === null || futures.constructor !== Array && !futures.is$JavaScriptIndexingBehavior)) | |
return $.Futures_wait$bailout(1, futures, t1); | |
if ($.get$isEmpty(futures) === true) | |
return $.Future_Future$immediate($.CTC3); | |
completer = $.Completer_Completer(); | |
result = completer.get$future(); | |
t1.remaining_1 = futures.length; | |
values = $._ListImpl_List(futures.length); | |
for (i = 0; i < futures.length; ++i) { | |
future = futures[i]; | |
future.then$1(new $.Futures_wait_anon(i, result, completer, t1, values)); | |
future.handleException$1(new $.Futures_wait_anon0(future, result, completer)); | |
} | |
return result; | |
}; | |
$.StringBuffer_StringBuffer = function(content$) { | |
return $._StringBufferImpl$(content$); | |
}; | |
$.NoSuchMethodError$ = function(_receiver, _memberName, _arguments, _namedArguments, existingArgumentNames) { | |
return new $.NoSuchMethodError(_receiver, _memberName, _arguments, _namedArguments, existingArgumentNames); | |
}; | |
$.NoSuchMethodError_safeToString = function(object) { | |
var t1; | |
if (typeof object === 'number' && Math.floor(object) === object || typeof object === 'number' || typeof object === 'boolean' || null == object) | |
return $.toString(object); | |
if (typeof object === 'string') { | |
t1 = $.getInterceptor(object).replaceAll$2(object, '\\', '\\\\'); | |
t1 = $.getInterceptor(t1).replaceAll$2(t1, '\n', '\\n'); | |
t1 = $.getInterceptor(t1).replaceAll$2(t1, '\r', '\\r'); | |
return '"' + $.S($.getInterceptor(t1).replaceAll$2(t1, '"', '\\"')) + '"'; | |
} | |
return $.Primitives_objectToString(object); | |
}; | |
$._CompleterImpl$ = function() { | |
return new $._CompleterImpl($._FutureImpl$()); | |
}; | |
$.Maps_mapToString = function(m) { | |
var result = $.StringBuffer_StringBuffer(''); | |
$.Maps__emitMap(m, result, $._ListImpl_List(null)); | |
return $.toString(result); | |
}; | |
$.Maps__emitMap = function(m, result, visiting) { | |
var t1 = {}; | |
$.getInterceptor(visiting).add$1(visiting, m); | |
$.getInterceptor(result).add$1(result, '{'); | |
t1.first_1 = true; | |
$.getInterceptor(m).forEach$1(m, new $.Maps__emitMap_anon(result, t1, visiting)); | |
$.getInterceptor(result).add$1(result, '}'); | |
$.getInterceptor(visiting).removeLast$0(visiting); | |
}; | |
$.print = function(object) { | |
if (typeof object === 'string') | |
$.Primitives_printString(object); | |
else | |
$.Primitives_printString($.toString(object)); | |
}; | |
$._FutureImpl$ = function() { | |
return new $._FutureImpl(false, null, null, null, false, [], [], []); | |
}; | |
$._FutureImpl__FutureImpl$immediate = function(value) { | |
var res = $._FutureImpl$(); | |
res._setValue$1(value); | |
return res; | |
}; | |
$.ArgumentError$ = function(message) { | |
return new $.ArgumentError(message); | |
}; | |
$._StringBufferImpl$ = function(content$) { | |
var t1 = new $._StringBufferImpl(null, null); | |
t1._StringBufferImpl$1(content$); | |
return t1; | |
}; | |
$.ListIterator$ = function(list) { | |
return new $.ListIterator(0, list); | |
}; | |
$.getInterceptor = function(object) { | |
if (typeof object === 'string') | |
return $.CTC; | |
if ($.isJsArray(object)) | |
return $.CTC0; | |
return $.CTC1; | |
}; | |
$.get$length = function(receiver) { | |
if (typeof receiver === 'string' || $.isJsArray(receiver)) | |
return receiver.length; | |
else | |
return receiver.get$length(); | |
}; | |
$.set$length = function(receiver, newLength) { | |
if ($.isJsArray(receiver)) { | |
$.checkNull(newLength); | |
if (newLength < 0) | |
throw $.$$throw($.RangeError$value(newLength)); | |
$.checkGrowable(receiver, 'set length'); | |
receiver.length = newLength; | |
} else | |
receiver.set$length(newLength); | |
return newLength; | |
}; | |
$.toString = function(value) { | |
if (typeof value == "object" && value != null) | |
if ($.isJsArray(value)) | |
return $.Collections_collectionToString(value); | |
else | |
return value.toString$0(); | |
if (value === 0 && (1 / value) < 0) | |
return '-0.0'; | |
if (value == null) | |
return 'null'; | |
if (typeof value == "function") | |
return 'Closure'; | |
return String(value); | |
}; | |
$.get$isEmpty = function(receiver) { | |
if (typeof receiver === 'string' || $.isJsArray(receiver)) | |
return receiver.length === 0; | |
return receiver.get$isEmpty(); | |
}; | |
$.iterator = function(receiver) { | |
if ($.isJsArray(receiver)) | |
return $.ListIterator$(receiver); | |
return receiver.iterator$0(); | |
}; | |
$.indexOf$2 = function(receiver, element, start) { | |
if ($.isJsArray(receiver)) | |
return $.Arrays_indexOf(receiver, element, start, receiver.length); | |
else { | |
$.checkNull(element); | |
if (start < 0) | |
return -1; | |
return receiver.indexOf(element, start); | |
} | |
return receiver.indexOf$2(element, start); | |
}; | |
$.Strings__toJsStringArray = function(strings) { | |
var length$, i, string, array; | |
if (typeof strings !== 'object' || strings === null || (strings.constructor !== Array || !!strings.immutable$list) && !strings.is$JavaScriptIndexingBehavior) | |
return $.Strings__toJsStringArray$bailout(1, strings); | |
$.checkNull(strings); | |
length$ = strings.length; | |
if ($.isJsArray(strings)) { | |
for (i = 0; i < length$; ++i) { | |
if (i >= strings.length) | |
throw $.ioore(i); | |
string = strings[i]; | |
$.checkNull(string); | |
if (!(typeof string === 'string')) | |
throw $.$$throw($.ArgumentError$(string)); | |
} | |
array = strings; | |
} else { | |
array = $._ListImpl_List(length$); | |
for (i = 0; i < length$; ++i) { | |
if (i >= strings.length) | |
throw $.ioore(i); | |
string = strings[i]; | |
$.checkNull(string); | |
if (!(typeof string === 'string')) | |
throw $.$$throw($.ArgumentError$(string)); | |
array[i] = string; | |
} | |
} | |
return array; | |
}; | |
$.UnsupportedError$ = function(message) { | |
return new $.UnsupportedError(message); | |
}; | |
$.FutureAlreadyCompleteException$ = function() { | |
return new $.FutureAlreadyCompleteException(); | |
}; | |
$.lastIndexOf$1 = function(receiver, element) { | |
if ($.isJsArray(receiver)) | |
return $.Arrays_lastIndexOf(receiver, element, receiver.length); | |
else if (typeof receiver === 'string') { | |
$.checkNull(element); | |
return receiver.lastIndexOf(element); | |
} | |
return receiver.lastIndexOf$1(element); | |
}; | |
$.FutureUnhandledException$ = function(source, stackTrace) { | |
return new $.FutureUnhandledException(source, stackTrace); | |
}; | |
$.get$isNaN = function(receiver) { | |
return isNaN(receiver); | |
}; | |
$.ceil = function(receiver) { | |
return Math.ceil(receiver); | |
}; | |
$.floor = function(receiver) { | |
return Math.floor(receiver); | |
}; | |
$.truncate = function(receiver) { | |
return receiver < 0 ? $.ceil(receiver) : $.floor(receiver); | |
}; | |
$.contains$1 = function(receiver, other) { | |
return $.contains$2(receiver, other, 0); | |
return receiver.contains$1(other); | |
}; | |
$.contains$2 = function(receiver, other, startIndex) { | |
$.checkNull(other); | |
return $.stringContainsUnchecked(receiver, other, startIndex); | |
}; | |
$.NullPointerException$ = function(functionName, arguments$) { | |
return new $.NullPointerException(functionName, arguments$); | |
}; | |
$.get$hashCode = function(receiver) { | |
var length$, i, hash, hash0, hash1; | |
if (receiver == null) | |
return 0; | |
if (typeof receiver === 'number') | |
return receiver & 536870911; | |
if (typeof receiver === 'boolean') | |
return receiver ? 1077375012 : 3247177846; | |
if ($.isJsArray(receiver)) | |
return $.Primitives_objectHashCode(receiver); | |
if (!(typeof receiver === 'string')) | |
return receiver.get$hashCode(); | |
length$ = receiver.length; | |
for (i = 0, hash = 0; i < length$; ++i, hash = hash1) { | |
hash0 = 536870911 & hash + receiver.charCodeAt(i); | |
hash1 = 536870911 & hash0 + (524287 & hash0) << 10; | |
hash1 = hash1 ^ (hash1 >> 6); | |
} | |
hash0 = 536870911 & hash + (67108863 & hash) << 3; | |
hash0 = hash0 ^ (hash0 >> 11); | |
return 536870911 & hash0 + (16383 & hash0) << 15; | |
}; | |
$.JSSyntaxRegExp$ = function(pattern, ignoreCase, multiLine) { | |
return new $.JSSyntaxRegExp(pattern, multiLine, ignoreCase); | |
}; | |
$.RegExp_RegExp = function(pattern, ignoreCase, multiLine) { | |
return $.JSSyntaxRegExp$(pattern, ignoreCase, multiLine); | |
}; | |
$.RuntimeError$ = function(message) { | |
return new $.RuntimeError(message); | |
}; | |
$.isolateCode = function() { | |
$.port().receive$1(new $.isolateCode_anon()); | |
}; | |
$.main = function() { | |
$.spawnFunction($.isolateCode).call$1('Hello World').then$1($.print); | |
}; | |
$.port = function() { | |
if ($._lazyPort == null) | |
$._lazyPort = $.ReceivePort_ReceivePort(); | |
return $._lazyPort; | |
}; | |
$.IllegalJSRegExpException$ = function(_pattern, _errmsg) { | |
return new $.IllegalJSRegExpException(_pattern, _errmsg); | |
}; | |
$.spawnFunction = function(topLevelFunction) { | |
var name$ = (topLevelFunction.$name || null); | |
if (name$ == null) | |
throw $.$$throw($.UnsupportedError$('only top-level functions can be spawned.')); | |
return $._IsolateNatives__spawn(name$, null, false); | |
}; | |
$.FutureNotCompleteException$ = function() { | |
return new $.FutureNotCompleteException(); | |
}; | |
$._currentIsolate = function() { | |
return $._globalState().get$currentContext(); | |
}; | |
$.startRootIsolate = function(entry) { | |
var t1, rootContext; | |
t1 = $._Manager$(); | |
$._globalState0(t1); | |
if ($._globalState().get$isWorker() === true) | |
return; | |
rootContext = $._IsolateContext$(); | |
$._globalState().set$rootContext(rootContext); | |
$globals = rootContext.isolateStatics; | |
$static_init(); | |
$._globalState().set$currentContext(rootContext); | |
if (!($._window() == null)) | |
rootContext.eval$1(new $.startRootIsolate_anon()); | |
rootContext.eval$1(entry); | |
$._globalState().get$topEventLoop().run$0(); | |
}; | |
$._globalState = function() { | |
return $globalState; | |
}; | |
$._globalState0 = function(val) { | |
$globalState = val; | |
}; | |
$._callInIsolate = function(isolate, function$) { | |
isolate.eval$1(function$); | |
$._globalState().get$topEventLoop().run$0(); | |
}; | |
$._ExceptionImplementation$ = function(message) { | |
return new $._ExceptionImplementation(message); | |
}; | |
$._serializeMessage = function(message) { | |
if ($._globalState().get$needSerialization() === true) | |
return $._JsSerializer$().traverse$1(message); | |
else | |
return $._JsCopier$().traverse$1(message); | |
}; | |
$._waitForPendingPorts = function(message, callback) { | |
var finder = $._PendingSendPortFinder$(); | |
finder.traverse$1(message); | |
$.Futures_wait(finder.ports).then$1(new $._waitForPendingPorts_anon(callback)); | |
}; | |
$._deserializeMessage = function(message) { | |
if ($._globalState().get$needSerialization() === true) | |
return $._JsDeserializer$().deserialize$1(message); | |
else | |
return message; | |
}; | |
$.RangeError$value = function(value) { | |
return new $.RangeError('value ' + $.S(value)); | |
}; | |
$._window = function() { | |
return typeof window != "undefined" ? window : null; | |
}; | |
$._timerFactory = function(millis, callback, repeating) { | |
return repeating === true ? $._Timer$repeating(millis, callback) : $._Timer$(millis, callback); | |
}; | |
$._JsDeserializer$ = function() { | |
return new $._JsDeserializer(null); | |
}; | |
$._IsolateContext$ = function() { | |
var t1 = new $._IsolateContext(null, null, null); | |
t1._IsolateContext$0(); | |
return t1; | |
}; | |
$._Manager$ = function() { | |
var t1 = new $._Manager(0, 0, 1, null, null, null, null, null, null, null, null, null); | |
t1._Manager$0(); | |
return t1; | |
}; | |
$._EventLoop$ = function() { | |
return new $._EventLoop($.Queue_Queue()); | |
}; | |
$.ReceivePort_ReceivePort = function() { | |
return $._ReceivePortImpl$(); | |
}; | |
$.LinkedHashMap_LinkedHashMap = function() { | |
return $._LinkedHashMapImpl$(); | |
}; | |
$._LinkedHashMapImpl$ = function() { | |
var t1 = new $._LinkedHashMapImpl(null, null); | |
t1._LinkedHashMapImpl$0(); | |
return t1; | |
}; | |
$.DoubleLinkedQueue$ = function() { | |
var t1 = new $.DoubleLinkedQueue(null); | |
t1.DoubleLinkedQueue$0(); | |
return t1; | |
}; | |
$._Timer$ = function(milliSeconds, callback) { | |
var t1 = new $._Timer(true, null); | |
t1._Timer$2(milliSeconds, callback); | |
return t1; | |
}; | |
$._Timer$repeating = function(milliSeconds, callback) { | |
var t1 = new $._Timer(false, null); | |
t1._Timer$repeating$2(milliSeconds, callback); | |
return t1; | |
}; | |
$._KeyValuePair$ = function(key, value) { | |
return new $._KeyValuePair(key, value); | |
}; | |
$._DoubleLinkedQueueEntrySentinel$ = function() { | |
var t1 = new $._DoubleLinkedQueueEntrySentinel(null, null, null); | |
t1.DoubleLinkedQueueEntry$1(null); | |
t1._DoubleLinkedQueueEntrySentinel$0(); | |
return t1; | |
}; | |
$.DoubleLinkedQueueEntry$ = function(e) { | |
var t1 = new $.DoubleLinkedQueueEntry(null, null, null); | |
t1.DoubleLinkedQueueEntry$1(e); | |
return t1; | |
}; | |
$._HashMapImpl$ = function() { | |
var t1 = new $._HashMapImpl(null, null, null, null, null); | |
t1._HashMapImpl$0(); | |
return t1; | |
}; | |
$._DoubleLinkedQueueIterator$ = function(_sentinel) { | |
var t1 = new $._DoubleLinkedQueueIterator(_sentinel, null); | |
t1._DoubleLinkedQueueIterator$1(_sentinel); | |
return t1; | |
}; | |
$._HashMapImpl__computeLoadLimit = function(capacity) { | |
return $.tdiv(capacity * 3, 4); | |
}; | |
$._HashMapImpl__nextProbe = function(currentProbe, numberOfProbes, length$) { | |
return (currentProbe + numberOfProbes & length$ - 1) >>> 0; | |
}; | |
$.StackTrace$ = function(stack) { | |
return new $.StackTrace(stack); | |
}; | |
$.HashMap_HashMap = function() { | |
return $._HashMapImpl$(); | |
}; | |
$.StackOverflowError$ = function() { | |
return new $.StackOverflowError(); | |
}; | |
$.StateError$ = function(message) { | |
return new $.StateError(message); | |
}; | |
$._ListImpl_List = function(length$) { | |
return $.Primitives_newList(length$); | |
}; | |
$.Map_Map = function() { | |
return $._HashMapImpl$(); | |
}; | |
$._IsolateNatives__thisScript = function() { | |
return $thisScriptUrl; | |
}; | |
$._IsolateNatives__processWorkerMessage = function(sender, e) { | |
var msg, t1, entryPoint, replyTo; | |
msg = $._deserializeMessage(e.data); | |
switch ($.index(msg, 'command')) { | |
case 'start': | |
t1 = $.index(msg, 'id'); | |
$._globalState().set$currentManagerId(t1); | |
entryPoint = $globalThis[$.index(msg, 'functionName')]; | |
replyTo = $._deserializeMessage($.index(msg, 'replyTo')); | |
$._globalState().get$topEventLoop().enqueue$3($._IsolateContext$(), new $._IsolateNatives__processWorkerMessage_function(replyTo, entryPoint), 'worker-start'); | |
$._globalState().get$topEventLoop().run$0(); | |
break; | |
case 'spawn-worker': | |
$._IsolateNatives__spawnWorker($.index(msg, 'functionName'), $.index(msg, 'uri'), $.index(msg, 'replyPort')); | |
break; | |
case 'message': | |
$.index(msg, 'port').send$2($.index(msg, 'msg'), $.index(msg, 'replyTo')); | |
$._globalState().get$topEventLoop().run$0(); | |
break; | |
case 'close': | |
$._IsolateNatives__log('Closing Worker'); | |
$._globalState().get$managers().remove$1(sender.get$id()); | |
sender.terminate$0(); | |
$._globalState().get$topEventLoop().run$0(); | |
break; | |
case 'log': | |
$._IsolateNatives__log($.index(msg, 'msg')); | |
break; | |
case 'print': | |
if ($._globalState().get$isWorker() === true) | |
$._globalState().get$mainManager().postMessage$1($._serializeMessage($.makeLiteralMap(['command', 'print', 'msg', msg]))); | |
else | |
$.print($.index(msg, 'msg')); | |
break; | |
case 'error': | |
throw $.$$throw($.index(msg, 'msg')); | |
} | |
}; | |
$._IsolateNatives__log = function(msg, exception) { | |
var trace; | |
if ($._globalState().get$isWorker() === true) | |
$._globalState().get$mainManager().postMessage$1($._serializeMessage($.makeLiteralMap(['command', 'log', 'msg', msg]))); | |
else | |
try { | |
$globalThis.console.log(msg); | |
} catch (exception) { | |
$.unwrapException(exception); | |
trace = $.getTraceFromException(exception); | |
throw $.$$throw($._ExceptionImplementation$(trace)); | |
} | |
}; | |
$._IsolateNatives__spawn = function(functionName, uri, isLight) { | |
var completer, port, signalReply; | |
completer = $.Completer_Completer(); | |
port = $.ReceivePort_ReceivePort(); | |
port.receive$1(new $._IsolateNatives__spawn_anon(completer, port)); | |
signalReply = port.toSendPort$0(); | |
if ($._globalState().get$useWorkers() === true && !isLight) | |
$._IsolateNatives__startWorker(functionName, uri, signalReply); | |
else | |
$._IsolateNatives__startNonWorker(functionName, uri, signalReply); | |
return $._BufferingSendPort$($._globalState().get$currentContext().get$id(), completer.get$future()); | |
}; | |
$._IsolateNatives__startWorker = function(functionName, uri, replyPort) { | |
if ($._globalState().get$isWorker() === true) | |
$._globalState().get$mainManager().postMessage$1($._serializeMessage($.makeLiteralMap(['command', 'spawn-worker', 'functionName', functionName, 'uri', uri, 'replyPort', replyPort]))); | |
else | |
$._IsolateNatives__spawnWorker(functionName, uri, replyPort); | |
}; | |
$._IsolateNatives__startNonWorker = function(functionName, uri, replyPort) { | |
if (!(uri == null)) | |
throw $.$$throw($.UnsupportedError$('Currently spawnUri is not supported without web workers.')); | |
$._globalState().get$topEventLoop().enqueue$3($._IsolateContext$(), new $._IsolateNatives__startNonWorker_function(functionName, replyPort), 'nonworker start'); | |
}; | |
$._IsolateNatives__startIsolate = function(topLevel, replyTo) { | |
$globals = $._globalState().get$currentContext().isolateStatics; | |
$static_init(); | |
$._lazyPort = $.ReceivePort_ReceivePort(); | |
replyTo.send$2('spawned', $.port().toSendPort$0()); | |
if (!($._window() == null)) | |
$._globalState().get$currentContext().eval$1(new $._IsolateNatives__startIsolate_anon()); | |
topLevel.call$0(); | |
}; | |
$._IsolateNatives__spawnWorker = function(functionName, uri, replyPort) { | |
var t1, uri0, worker, workerId; | |
if (functionName == null) | |
functionName = 'main'; | |
if (uri == null) | |
uri = $._IsolateNatives__thisScript(); | |
if ($.Uri$fromString(uri).isAbsolute$0() !== true) { | |
t1 = $._IsolateNatives__thisScript(); | |
uri0 = $.S($.getInterceptor(t1).substring$2(t1, 0, $.lastIndexOf$1($._IsolateNatives__thisScript(), '/'))) + '/' + $.S(uri); | |
uri = uri0; | |
} | |
worker = new Worker(uri); | |
worker.set$onmessage(new $._IsolateNatives__spawnWorker_anon(worker)); | |
t1 = $._globalState(); | |
workerId = t1.get$nextManagerId(); | |
t1.set$nextManagerId($.add(workerId, 1)); | |
worker.set$id(workerId); | |
$.indexSet($._globalState().get$managers(), workerId, worker); | |
worker.postMessage$1($._serializeMessage($.makeLiteralMap(['command', 'start', 'id', workerId, 'replyTo', $._serializeMessage(replyPort), 'functionName', functionName]))); | |
}; | |
$.int_parse = function(source) { | |
return $.Primitives_parseInt(source); | |
}; | |
$.Queue_Queue = function() { | |
return $.DoubleLinkedQueue$(); | |
}; | |
$.Uri$fromString = function(uri) { | |
var t1 = $.get$Uri__splitRe().firstMatch$1(uri); | |
return new $.Uri($.Uri__emptyIfNull($.index(t1, 1)), $.Uri__emptyIfNull($.index(t1, 2)), $.Uri__emptyIfNull($.index(t1, 3)), $.Uri__parseIntOrZero($.index(t1, 4)), $.Uri__emptyIfNull($.index(t1, 5)), $.Uri__emptyIfNull($.index(t1, 6)), $.Uri__emptyIfNull($.index(t1, 7))); | |
}; | |
$.Uri__emptyIfNull = function(val) { | |
return !(val == null) ? val : ''; | |
}; | |
$.Uri__parseIntOrZero = function(val) { | |
if (!(val == null) && !$.eqB(val, '')) | |
return $.int_parse(val); | |
else | |
return 0; | |
}; | |
$._IsolateEvent$ = function(isolate, fn, message) { | |
return new $._IsolateEvent(isolate, fn, message); | |
}; | |
$._MainManagerStub$ = function() { | |
return new $._MainManagerStub(); | |
}; | |
$.Uri__addIfNonEmpty = function(sb, test, first, second) { | |
var t1; | |
if (!('' === test)) { | |
t1 = $.getInterceptor(sb); | |
t1.add$1(sb, first == null ? 'null' : first); | |
t1 = $.getInterceptor(sb); | |
t1.add$1(sb, second == null ? 'null' : second); | |
} | |
}; | |
$.UnimplementedError$ = function(message) { | |
return new $.UnimplementedError(message); | |
}; | |
$._JsSerializer$ = function() { | |
var t1 = new $._JsSerializer(0, $._MessageTraverserVisitedMap$()); | |
t1._JsSerializer$0(); | |
return t1; | |
}; | |
$._NativeJsSendPort$ = function(_receivePort, isolateId) { | |
return new $._NativeJsSendPort(_receivePort, isolateId); | |
}; | |
$._WorkerSendPort$ = function(_workerId, isolateId, _receivePortId) { | |
return new $._WorkerSendPort(_workerId, _receivePortId, isolateId); | |
}; | |
$.Arrays_lastIndexOf$bailout = function(state0, a, element, startIndex) { | |
var i; | |
if (startIndex < 0) | |
return -1; | |
if ($.geB(startIndex, $.get$length(a))) | |
startIndex = $.sub($.get$length(a), 1); | |
for (i = startIndex; $.geB(i, 0); i = $.sub(i, 1)) | |
if ($.eqB($.index(a, i), element)) | |
return i; | |
return -1; | |
}; | |
$.stringReplaceAllUnchecked$bailout = function(state0, receiver, from, to) { | |
var result, length$, i; | |
if (typeof from === 'string') | |
if (from === '') | |
if ($.eqB(receiver, '')) | |
return to; | |
else { | |
result = $.StringBuffer_StringBuffer(''); | |
length$ = $.get$length(receiver); | |
$.getInterceptor(result).add$1(result, to); | |
for (i = 0; $.ltB(i, length$); ++i) { | |
$.getInterceptor(result).add$1(result, $.index(receiver, i)); | |
$.getInterceptor(result).add$1(result, to); | |
} | |
return $.toString(result); | |
} | |
else | |
return $.stringReplaceJS(receiver, $.regExpMakeNative($.JSSyntaxRegExp$(from.replace($.regExpMakeNative($.get$quoteRegExp(), true), "\\$&"), false, false), true), to); | |
else if (typeof from === 'object' && from !== null && !!from.is$JSSyntaxRegExp) | |
return $.stringReplaceJS(receiver, $.regExpMakeNative(from, true), to); | |
else { | |
$.checkNull(from); | |
throw $.$$throw('String.replaceAll(Pattern) UNIMPLEMENTED'); | |
} | |
}; | |
$.Futures_wait$bailout = function(state0, futures, t1) { | |
var completer, result, values, i, future; | |
if ($.get$isEmpty(futures) === true) | |
return $.Future_Future$immediate($.CTC3); | |
completer = $.Completer_Completer(); | |
result = completer.get$future(); | |
t1.remaining_1 = $.get$length(futures); | |
values = $._ListImpl_List($.get$length(futures)); | |
for (i = 0; $.ltB(i, $.get$length(futures)); ++i) { | |
future = $.index(futures, i); | |
future.then$1(new $.Futures_wait_anon(i, result, completer, t1, values)); | |
future.handleException$1(new $.Futures_wait_anon0(future, result, completer)); | |
} | |
return result; | |
}; | |
$.Strings__toJsStringArray$bailout = function(state0, strings) { | |
var length$, i, string, array; | |
$.checkNull(strings); | |
length$ = $.get$length(strings); | |
if ($.isJsArray(strings)) { | |
for (i = 0; $.ltB(i, length$); ++i) { | |
string = $.index(strings, i); | |
$.checkNull(string); | |
if (!(typeof string === 'string')) | |
throw $.$$throw($.ArgumentError$(string)); | |
} | |
array = strings; | |
} else { | |
array = $._ListImpl_List(length$); | |
for (i = 0; $.ltB(i, length$); ++i) { | |
string = $.index(strings, i); | |
$.checkNull(string); | |
if (!(typeof string === 'string')) | |
throw $.$$throw($.ArgumentError$(string)); | |
if (i >= array.length) | |
throw $.ioore(i); | |
array[i] = string; | |
} | |
} | |
return array; | |
}; | |
$.typeNameInSafari.call$1 = $.typeNameInSafari; | |
$.typeNameInSafari.$name = "typeNameInSafari"; | |
$.typeNameInOpera.call$1 = $.typeNameInOpera; | |
$.typeNameInOpera.$name = "typeNameInOpera"; | |
$.typeNameInFirefox.call$1 = $.typeNameInFirefox; | |
$.typeNameInFirefox.$name = "typeNameInFirefox"; | |
$.invokeClosure.call$5 = $.invokeClosure; | |
$.invokeClosure.$name = "invokeClosure"; | |
$.typeNameInIE.call$1 = $.typeNameInIE; | |
$.typeNameInIE.$name = "typeNameInIE"; | |
$.constructorNameFallback.call$1 = $.constructorNameFallback; | |
$.constructorNameFallback.$name = "constructorNameFallback"; | |
$.print.call$1 = $.print; | |
$.print.$name = "print"; | |
$.isolateCode.call$0 = $.isolateCode; | |
$.isolateCode.$name = "isolateCode"; | |
$.dynamicBind.call$4 = $.dynamicBind; | |
$.dynamicBind.$name = "dynamicBind"; | |
$._timerFactory.call$3 = $._timerFactory; | |
$._timerFactory.$name = "_timerFactory"; | |
$.toStringWrapper.call$0 = $.toStringWrapper; | |
$.toStringWrapper.$name = "toStringWrapper"; | |
$.typeNameInChrome.call$1 = $.typeNameInChrome; | |
$.typeNameInChrome.$name = "typeNameInChrome"; | |
Isolate.$finishClasses($$); | |
$$ = {}; | |
Isolate.makeConstantList = function(list) { | |
list.immutable$list = true; | |
list.fixed$length = true; | |
return list; | |
}; | |
$.CTC3 = Isolate.makeConstantList([]); | |
$.CTC1 = new Isolate.$isolateProperties.ObjectInterceptor(); | |
$.CTC0 = new Isolate.$isolateProperties.JSArray(); | |
$.CTC = new Isolate.$isolateProperties.JSString(); | |
$.CTC4 = new Isolate.$isolateProperties._DeletedKeySentinel(); | |
$.CTC2 = new Isolate.$isolateProperties.NullPointerException(null, Isolate.$isolateProperties.CTC3); | |
$.CTC5 = new Isolate.$isolateProperties.Object(); | |
$._TimerFactory__factory = null; | |
$._getTypeNameOf = null; | |
$.Primitives_hashCodeSeed = 0; | |
$.Primitives_mirrorsEnabled = false; | |
$._ReceivePortImpl__nextFreeId = 1; | |
$.Primitives_DOLLAR_CHAR_VALUE = 36; | |
$.Uri__COMPONENT_SCHEME = 1; | |
$.Uri__COMPONENT_USER_INFO = 2; | |
$.Uri__COMPONENT_DOMAIN = 3; | |
$._HashMapImpl__DELETED_KEY = Isolate.$isolateProperties.CTC4; | |
$.Uri__COMPONENT_PORT = 4; | |
$._HashMapImpl__INITIAL_CAPACITY = 8; | |
$.Uri__COMPONENT_PATH = 5; | |
$.Uri__COMPONENT_QUERY_DATA = 6; | |
$._lazyPort = null; | |
$.MIRROR_OPT_IN_MESSAGE = '\nThis program is using an experimental feature called "mirrors". As\ncurrently implemented, mirrors do not work with minification, and will\ncause spurious errors depending on how code was optimized.\n\nThe authors of this program are aware of these problems and have\ndecided the thrill of using an experimental feature is outweighing the\nrisks. Furthermore, the authors of this program understand that\nlong-term, to fix the problems mentioned above, mirrors may have\nnegative impact on size and performance of Dart programs compiled to\nJavaScript.\n'; | |
$.Uri__COMPONENT_FRAGMENT = 7; | |
$._SPAWNED_SIGNAL = 'spawned'; | |
$._BufferingSendPort__idCount = 0; | |
Isolate.$lazy($, 'quoteRegExp', 'quoteRegExp', 'get$quoteRegExp', function() { | |
return $.JSSyntaxRegExp$('[-[\\]{}()*+?.,\\\\^$|#\\s]', false, false); | |
}); | |
Isolate.$lazy($, '_splitRe', 'Uri__splitRe', 'get$Uri__splitRe', function() { | |
return $.RegExp_RegExp('^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$', false, false); | |
}); | |
var $ = null; | |
Isolate.$finishClasses($$); | |
$$ = {}; | |
Isolate = Isolate.$finishIsolateConstructor(Isolate); | |
var $ = new Isolate(); | |
$.$defineNativeClass = function(cls, desc) { | |
var fields = desc[''] || []; | |
var generateGetterSetter = function(field, prototype) { | |
var len = field.length; | |
var lastCharCode = field.charCodeAt(len - 1); | |
var needsAccessor = (lastCharCode & 63) >= 60; | |
if (needsAccessor) { | |
var needsGetter = (lastCharCode & 3) > 0; | |
var needsSetter = (lastCharCode & 2) == 0; | |
var renaming = (lastCharCode & 64) != 0; | |
var accessorName = field = field.substring(0, len - 1); | |
if (renaming) { | |
var divider = field.indexOf(":"); | |
accessorName = field.substring(0, divider); | |
field = field.substring(divider + 1); | |
} | |
if (needsGetter) { | |
var getterString = "return this." + field + ";"; | |
prototype["get$" + accessorName] = new Function(getterString); | |
} | |
if (needsSetter) { | |
var setterString = "this." + field + " = v;"; | |
prototype["set$" + accessorName] = new Function("v", setterString); | |
} | |
} | |
return field; | |
}; | |
for (var i = 0; i < fields.length; i++) { | |
generateGetterSetter(fields[i], desc); | |
} | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
for (var method in desc) { | |
if (method !== '') { | |
if (hasOwnProperty.call(desc, method)) { | |
$.dynamicFunction(method)[cls] = desc[method]; | |
} | |
} | |
} | |
}; | |
(function(table) { | |
for (var key in table) { | |
$.defineProperty(Object.prototype, key, table[key]); | |
} | |
})({ | |
toString$0: function() { return $.toStringForNativeObject(this); }, | |
get$hashCode: function() { return $.hashCodeForNativeObject(this); } | |
}); | |
$.$defineNativeClass('Worker', {"": [], | |
get$id: function() { | |
return this.id; | |
}, | |
set$id: function(i) { | |
this.id = i; | |
}, | |
set$onmessage: function(f) { | |
this.onmessage = f; | |
}, | |
postMessage$1: function(msg) { | |
return this.postMessage(msg); | |
} | |
}); | |
$.$defineNativeClass('DOMWindow', {"": [], | |
setTimeout$2: function(handler, timeout) { | |
return this.setTimeout($.convertDartClosureToJS(handler, 0),timeout); | |
}, | |
setInterval$2: function(handler, timeout) { | |
return this.setInterval($.convertDartClosureToJS(handler, 0),timeout); | |
} | |
}); | |
// 2 dynamic classes. | |
// 2 classes | |
// 0 !leaf | |
var $globalThis = $; | |
var $globalState; | |
var $globals; | |
var $isWorker = false; | |
var $supportsWorkers = false; | |
var $thisScriptUrl; | |
function $static_init(){}; | |
function $initGlobals(context) { | |
context.isolateStatics = new Isolate(); | |
} | |
function $setGlobals(context) { | |
$ = context.isolateStatics; | |
$globalThis = $; | |
} | |
$.main.call$0 = $.main | |
// | |
// BEGIN invoke [main]. | |
// | |
if (typeof document !== 'undefined' && document.readyState != 'complete') { | |
document.addEventListener('readystatechange', function () { | |
if (document.readyState == 'complete') { | |
if (typeof dartMainRunner === 'function') { | |
dartMainRunner(function() { $.startRootIsolate($.main); }); | |
} else { | |
$.startRootIsolate($.main); | |
} | |
} | |
}, false); | |
} else { | |
if (typeof dartMainRunner === 'function') { | |
dartMainRunner(function() { $.startRootIsolate($.main); }); | |
} else { | |
$.startRootIsolate($.main); | |
} | |
} | |
// | |
// END invoke [main]. | |
// | |
function init() { | |
Isolate.$isolateProperties = {}; | |
Isolate.$defineClass = function(cls, fields, prototype) { | |
var generateGetterSetter = function(field, prototype) { | |
var len = field.length; | |
var lastCharCode = field.charCodeAt(len - 1); | |
var needsAccessor = (lastCharCode & 63) >= 60; | |
if (needsAccessor) { | |
var needsGetter = (lastCharCode & 3) > 0; | |
var needsSetter = (lastCharCode & 2) == 0; | |
var renaming = (lastCharCode & 64) != 0; | |
var accessorName = field = field.substring(0, len - 1); | |
if (renaming) { | |
var divider = field.indexOf(":"); | |
accessorName = field.substring(0, divider); | |
field = field.substring(divider + 1); | |
} | |
if (needsGetter) { | |
var getterString = "return this." + field + ";"; | |
prototype["get$" + accessorName] = new Function(getterString); | |
} | |
if (needsSetter) { | |
var setterString = "this." + field + " = v;"; | |
prototype["set$" + accessorName] = new Function("v", setterString); | |
} | |
} | |
return field; | |
}; | |
var constructor; | |
if (typeof fields == 'function') { | |
constructor = fields; | |
} else { | |
var str = "function " + cls + "("; | |
var body = ""; | |
for (var i = 0; i < fields.length; i++) { | |
if (i != 0) str += ", "; | |
var field = fields[i]; | |
field = generateGetterSetter(field, prototype); | |
str += field; | |
body += "this." + field + " = " + field + ";\n"; | |
} | |
str += ") {" + body + "}\n"; | |
str += "return " + cls + ";"; | |
constructor = new Function(str)(); | |
} | |
constructor.prototype = prototype; | |
return constructor; | |
}; | |
var supportsProto = false; | |
var tmp = Isolate.$defineClass('c', ['f?'], {}).prototype; | |
if (tmp.__proto__) { | |
tmp.__proto__ = {}; | |
if (typeof tmp.get$f !== 'undefined') supportsProto = true; | |
} | |
Isolate.$pendingClasses = {}; | |
Isolate.$finishClasses = function(collectedClasses) { | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
for (var cls in collectedClasses) { | |
if (hasOwnProperty.call(collectedClasses, cls)) { | |
var desc = collectedClasses[cls]; | |
Isolate.$isolateProperties[cls] = Isolate.$defineClass(cls, desc[''], desc); | |
if (desc['super'] !== "") Isolate.$pendingClasses[cls] = desc['super']; | |
} | |
} | |
var pendingClasses = Isolate.$pendingClasses; | |
Isolate.$pendingClasses = {}; | |
var finishedClasses = {}; | |
function finishClass(cls) { | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
if (hasOwnProperty.call(finishedClasses, cls)) return; | |
finishedClasses[cls] = true; | |
var superclass = pendingClasses[cls]; | |
if (!superclass) return; | |
finishClass(superclass); | |
var constructor = Isolate.$isolateProperties[cls]; | |
var superConstructor = Isolate.$isolateProperties[superclass]; | |
var prototype = constructor.prototype; | |
if (supportsProto) { | |
prototype.__proto__ = superConstructor.prototype; | |
prototype.constructor = constructor; | |
} else { | |
function tmp() {}; | |
tmp.prototype = superConstructor.prototype; | |
var newPrototype = new tmp(); | |
constructor.prototype = newPrototype; | |
newPrototype.constructor = constructor; | |
for (var member in prototype) { | |
if (member == '' || member == 'super') continue; | |
if (hasOwnProperty.call(prototype, member)) { | |
newPrototype[member] = prototype[member]; | |
} | |
} | |
} | |
} | |
for (var cls in pendingClasses) finishClass(cls); | |
}; | |
Isolate.$lazy = function(prototype, staticName, fieldName, getterName, lazyValue) { | |
var sentinelUndefined = {}; | |
var sentinelInProgress = {}; | |
prototype[fieldName] = sentinelUndefined; | |
var getter = new Function("{ return $." + fieldName + ";}"); | |
prototype[getterName] = function() { | |
var result = $[fieldName]; | |
try { | |
if (result === sentinelUndefined) { | |
$[fieldName] = sentinelInProgress; | |
try { | |
result = $[fieldName] = lazyValue(); | |
} catch (e) { | |
if ($[fieldName] === sentinelInProgress) { | |
$[fieldName] = null; | |
} | |
throw e; | |
} | |
} else if (result === sentinelInProgress) { | |
$.throwCyclicInit(staticName); | |
} | |
return result; | |
} finally { | |
$[getterName] = getter; | |
} | |
}; | |
}; | |
Isolate.$finishIsolateConstructor = function(oldIsolate) { | |
var isolateProperties = oldIsolate.$isolateProperties; | |
var isolatePrototype = oldIsolate.prototype; | |
var str = "{\n"; | |
str += "var properties = Isolate.$isolateProperties;\n"; | |
for (var staticName in isolateProperties) { | |
if (Object.prototype.hasOwnProperty.call(isolateProperties, staticName)) { | |
str += "this." + staticName + "= properties." + staticName + ";\n"; | |
} | |
} | |
str += "}\n"; | |
var newIsolate = new Function(str); | |
newIsolate.prototype = isolatePrototype; | |
isolatePrototype.constructor = newIsolate; | |
newIsolate.$isolateProperties = isolateProperties; | |
return newIsolate; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment