Skip to content

Instantly share code, notes, and snippets.

@kevinwestern
Created July 31, 2012 18:29
Show Gist options
  • Save kevinwestern/3219268 to your computer and use it in GitHub Desktop.
Save kevinwestern/3219268 to your computer and use it in GitHub Desktop.
function Isolate() {}
init();
var $$ = {};
var $ = Isolate.$isolateProperties;
$$.HashMapImplementation = {"":
["_numberOfDeleted", "_numberOfEntries", "_loadLimit", "_values", "_keys"],
super: "Object",
toString$0: function() {
return $.Maps_mapToString(this);
},
forEach$1: function(f) {
var length$ = $.get$length(this._keys);
if (typeof length$ !== 'number') return this.forEach$1$bailout(1, f, length$);
for (var i = 0; i < length$; ++i) {
var key = $.index(this._keys, i);
!(key == null) && !(key === $.CTC1) && f.$call$2(key, $.index(this._values, i));
}
},
forEach$1$bailout: function(state, f, length$) {
for (var i = 0; $.ltB(i, length$); ++i) {
var key = $.index(this._keys, i);
!(key == null) && !(key === $.CTC1) && f.$call$2(key, $.index(this._values, i));
}
},
get$length: function() {
return this._numberOfEntries;
},
isEmpty$0: function() {
return $.eq(this._numberOfEntries, 0);
},
operator$index$1: function(key) {
var index = this._probeForLookup$1(key);
if ($.ltB(index, 0)) return;
return $.index(this._values, index);
},
operator$indexSet$2: function(key, value) {
this._ensureCapacity$0();
var index = this._probeForAdding$1(key);
if ($.index(this._keys, index) == null || $.index(this._keys, index) === $.CTC1) this._numberOfEntries = $.add(this._numberOfEntries, 1);
$.indexSet(this._keys, index, key);
$.indexSet(this._values, index, value);
},
clear$0: function() {
this._numberOfEntries = 0;
this._numberOfDeleted = 0;
var length$ = $.get$length(this._keys);
if (typeof length$ !== 'number') return this.clear$0$bailout(1, length$);
for (var i = 0; i < length$; ++i) {
$.indexSet(this._keys, i, null);
$.indexSet(this._values, i, null);
}
},
clear$0$bailout: function(state, length$) {
for (var i = 0; $.ltB(i, length$); ++i) {
$.indexSet(this._keys, i, null);
$.indexSet(this._values, i, null);
}
},
_grow$1: function(newCapacity) {
var capacity = $.get$length(this._keys);
if (typeof capacity !== 'number') return this._grow$1$bailout(1, newCapacity, capacity, 0, 0);
this._loadLimit = $.HashMapImplementation__computeLoadLimit(newCapacity);
var oldKeys = this._keys;
if (typeof oldKeys !== 'string' && (typeof oldKeys !== 'object' || oldKeys === null || (oldKeys.constructor !== Array && !oldKeys.is$JavaScriptIndexingBehavior))) return this._grow$1$bailout(2, newCapacity, oldKeys, capacity, 0);
var oldValues = this._values;
if (typeof oldValues !== 'string' && (typeof oldValues !== 'object' || oldValues === null || (oldValues.constructor !== Array && !oldValues.is$JavaScriptIndexingBehavior))) return this._grow$1$bailout(3, newCapacity, oldKeys, oldValues, capacity);
this._keys = $.ListFactory_List(newCapacity);
var t4 = $.ListFactory_List(newCapacity);
$.setRuntimeTypeInfo(t4, ({E: 'V'}));
this._values = t4;
for (var i = 0; i < capacity; ++i) {
var t1 = oldKeys.length;
if (i < 0 || i >= t1) throw $.ioore(i);
var key = oldKeys[i];
if (key == null || key === $.CTC1) continue;
t1 = oldValues.length;
if (i < 0 || i >= t1) throw $.ioore(i);
var value = oldValues[i];
var newIndex = this._probeForAdding$1(key);
$.indexSet(this._keys, newIndex, key);
$.indexSet(this._values, newIndex, value);
}
this._numberOfDeleted = 0;
},
_grow$1$bailout: function(state, env0, env1, env2, env3) {
switch (state) {
case 1:
var newCapacity = env0;
capacity = env1;
break;
case 2:
newCapacity = env0;
oldKeys = env1;
capacity = env2;
break;
case 3:
newCapacity = env0;
oldKeys = env1;
oldValues = env2;
capacity = env3;
break;
}
switch (state) {
case 0:
var capacity = $.get$length(this._keys);
case 1:
state = 0;
this._loadLimit = $.HashMapImplementation__computeLoadLimit(newCapacity);
var oldKeys = this._keys;
case 2:
state = 0;
var oldValues = this._values;
case 3:
state = 0;
this._keys = $.ListFactory_List(newCapacity);
var t4 = $.ListFactory_List(newCapacity);
$.setRuntimeTypeInfo(t4, ({E: 'V'}));
this._values = t4;
for (var i = 0; $.ltB(i, capacity); ++i) {
var key = $.index(oldKeys, i);
if (key == null || key === $.CTC1) continue;
var value = $.index(oldValues, i);
var newIndex = this._probeForAdding$1(key);
$.indexSet(this._keys, newIndex, key);
$.indexSet(this._values, newIndex, value);
}
this._numberOfDeleted = 0;
}
},
_ensureCapacity$0: function() {
var newNumberOfEntries = $.add(this._numberOfEntries, 1);
if ($.geB(newNumberOfEntries, this._loadLimit)) {
this._grow$1($.mul($.get$length(this._keys), 2));
return;
}
var numberOfFree = $.sub($.sub($.get$length(this._keys), newNumberOfEntries), this._numberOfDeleted);
$.gtB(this._numberOfDeleted, numberOfFree) && this._grow$1($.get$length(this._keys));
},
_probeForLookup$1: function(key) {
var hash = $.HashMapImplementation__firstProbe($.hashCode(key), $.get$length(this._keys));
for (var numberOfProbes = 1; true; ) {
var existingKey = $.index(this._keys, hash);
if (existingKey == null) return -1;
if ($.eqB(existingKey, key)) return hash;
var numberOfProbes0 = numberOfProbes + 1;
hash = $.HashMapImplementation__nextProbe(hash, numberOfProbes, $.get$length(this._keys));
numberOfProbes = numberOfProbes0;
}
},
_probeForAdding$1: function(key) {
var hash = $.HashMapImplementation__firstProbe($.hashCode(key), $.get$length(this._keys));
if (hash !== (hash | 0)) return this._probeForAdding$1$bailout(1, key, hash, 0, 0, 0);
for (var numberOfProbes = 1, insertionIndex = -1; true; ) {
var t1 = this._keys;
if (typeof t1 !== 'string' && (typeof t1 !== 'object' || t1 === null || (t1.constructor !== Array && !t1.is$JavaScriptIndexingBehavior))) return this._probeForAdding$1$bailout(2, numberOfProbes, hash, key, insertionIndex, t1);
var t3 = t1.length;
if (hash < 0 || hash >= t3) throw $.ioore(hash);
var existingKey = t1[hash];
if (existingKey == null) {
if (insertionIndex < 0) return hash;
return insertionIndex;
}
if ($.eqB(existingKey, key)) return hash;
if (insertionIndex < 0 && $.CTC1 === existingKey) insertionIndex = hash;
var numberOfProbes0 = numberOfProbes + 1;
hash = $.HashMapImplementation__nextProbe(hash, numberOfProbes, $.get$length(this._keys));
if (hash !== (hash | 0)) return this._probeForAdding$1$bailout(3, key, numberOfProbes0, insertionIndex, hash, 0);
numberOfProbes = numberOfProbes0;
}
},
_probeForAdding$1$bailout: function(state, env0, env1, env2, env3, env4) {
switch (state) {
case 1:
var key = env0;
hash = env1;
break;
case 2:
numberOfProbes = env0;
hash = env1;
key = env2;
insertionIndex = env3;
t1 = env4;
break;
case 3:
key = env0;
numberOfProbes0 = env1;
insertionIndex = env2;
hash = env3;
break;
}
switch (state) {
case 0:
var hash = $.HashMapImplementation__firstProbe($.hashCode(key), $.get$length(this._keys));
case 1:
state = 0;
var numberOfProbes = 1;
var insertionIndex = -1;
default:
L0: while (true) {
switch (state) {
case 0:
if (!true) break L0;
var t1 = this._keys;
case 2:
state = 0;
var existingKey = $.index(t1, hash);
if (existingKey == null) {
if ($.ltB(insertionIndex, 0)) return hash;
return insertionIndex;
}
if ($.eqB(existingKey, key)) return hash;
if ($.ltB(insertionIndex, 0) && $.CTC1 === existingKey) insertionIndex = hash;
var numberOfProbes0 = numberOfProbes + 1;
hash = $.HashMapImplementation__nextProbe(hash, numberOfProbes, $.get$length(this._keys));
case 3:
state = 0;
numberOfProbes = numberOfProbes0;
}
}
}
},
HashMapImplementation$0: function() {
this._numberOfEntries = 0;
this._numberOfDeleted = 0;
this._loadLimit = $.HashMapImplementation__computeLoadLimit(8);
this._keys = $.ListFactory_List(8);
var t1 = $.ListFactory_List(8);
$.setRuntimeTypeInfo(t1, ({E: 'V'}));
this._values = t1;
},
is$Map: true
};
$$._DeletedKeySentinel = {"":
[],
super: "Object"
};
$$.StringBufferImpl = {"":
["_length", "_buffer"],
super: "Object",
toString$0: function() {
if ($.get$length(this._buffer) === 0) return '';
if ($.get$length(this._buffer) === 1) return $.index(this._buffer, 0);
var result = $.StringBase_concatAll(this._buffer);
$.clear(this._buffer);
$.add$1(this._buffer, result);
return result;
},
clear$0: function() {
var t1 = $.ListFactory_List(null);
$.setRuntimeTypeInfo(t1, ({E: 'String'}));
this._buffer = t1;
this._length = 0;
return this;
},
add$1: function(obj) {
var str = $.toString(obj);
if (str == null || $.isEmpty(str) === true) return this;
$.add$1(this._buffer, str);
this._length = $.add(this._length, $.get$length(str));
return this;
},
isEmpty$0: function() {
return this._length === 0;
},
get$length: function() {
return this._length;
},
StringBufferImpl$1: function(content$) {
this.clear$0();
this.add$1(content$);
}
};
$$.ListIterator = {"":
["list", "i"],
super: "Object",
next$0: function() {
if (this.hasNext$0() !== true) throw $.captureStackTrace($.NoMoreElementsException$());
var value = (this.list[this.i]);
var t1 = this.i;
if (typeof t1 !== 'number') return this.next$0$bailout(1, t1, value);
this.i = t1 + 1;
return value;
},
next$0$bailout: function(state, t1, value) {
this.i = $.add(t1, 1);
return value;
},
hasNext$0: function() {
var t1 = this.i;
if (typeof t1 !== 'number') return this.hasNext$0$bailout(1, t1);
return t1 < (this.list.length);
},
hasNext$0$bailout: function(state, t1) {
return $.lt(t1, (this.list.length));
}
};
$$.Closure = {"":
[],
super: "Object",
toString$0: function() {
return 'Closure';
}
};
$$.Object = {"":
[],
super: "",
toString$0: function() {
return $.Primitives_objectToString(this);
}
};
$$.IndexOutOfRangeException = {"":
["_value"],
super: "Object",
toString$0: function() {
return 'IndexOutOfRangeException: ' + $.S(this._value);
}
};
$$.IllegalArgumentException = {"":
["_arg"],
super: "Object",
toString$0: function() {
return 'Illegal argument(s): ' + $.S(this._arg);
}
};
$$.NullPointerException = {"":
["arguments", "functionName"],
super: "Object",
get$exceptionName: function() {
return 'NullPointerException';
},
toString$0: function() {
var t1 = this.functionName;
if (t1 == null) return this.get$exceptionName();
return $.S(this.get$exceptionName()) + ' : method: \'' + $.S(t1) + '\'\n' + 'Receiver: null\n' + 'Arguments: ' + $.S(this.arguments);
}
};
$$.NoMoreElementsException = {"":
[],
super: "Object",
toString$0: function() {
return 'NoMoreElementsException';
}
};
$$.UnsupportedOperationException = {"":
["_message"],
super: "Object",
toString$0: function() {
return 'UnsupportedOperationException: ' + $.S(this._message);
}
};
$$.Model = {"":
["data"],
super: "Object",
updateModel$0: function() {
$.print('model updated');
return this;
},
createModel$0: function() {
$.print('model created');
this.set$2('id', 1);
return this;
},
save$0: function() {
if (this.get$1('id') == null) return this.createModel$0();
return this.updateModel$0();
},
set$2: function(field, value) {
this._setVoid$2(field, value);
return this;
},
_setVoid$2: function(field, value) {
$.indexSet(this.data, field, value);
},
operator$indexSet$2: function(field, value) {
return this._setVoid$2(field, value);
},
get$1: function(field) {
return $.index(this.data, field);
},
operator$index$1: function(field) {
return this.get$1(field);
}
};
$$.Maps__emitMap_anon = {"":
["result_3", "box_0", "visiting_2"],
super: "Closure",
$call$2: function(k, v) {
this.box_0.first_1 !== true && $.add$1(this.result_3, ', ');
this.box_0.first_1 = false;
$.Collections__emitObject(k, this.result_3, this.visiting_2);
$.add$1(this.result_3, ': ');
$.Collections__emitObject(v, this.result_3, this.visiting_2);
}
};
$.S = function(value) {
var res = $.toString(value);
if (!(typeof res === 'string')) throw $.captureStackTrace($.IllegalArgumentException$(value));
return res;
};
$.mul$slow = function(a, b) {
if ($.checkNumbers(a, b) === true) return a * b;
return a.operator$mul$1(b);
};
$.Maps__emitMap = function(m, result, visiting) {
var t1 = ({});
$.add$1(visiting, m);
$.add$1(result, '{');
t1.first_1 = true;
$.forEach(m, new $.Maps__emitMap_anon(result, t1, visiting));
$.add$1(result, '}');
$.removeLast(visiting);
};
$.Collections__emitObject = function(o, result, visiting) {
if (typeof o === 'object' && o !== null && (o.constructor === Array || !!o.is$Collection)) {
if ($.Collections__containsRef(visiting, o) === true) {
$.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) === true) $.add$1(result, '{...}');
else $.Maps__emitMap(o, result, visiting);
} else {
$.add$1(result, o == null ? 'null' : o);
}
}
};
$.floor = function(receiver) {
if (!(typeof receiver === 'number')) return receiver.floor$0();
return Math.floor(receiver);
};
$.shr = function(a, b) {
if ($.checkNumbers(a, b) === true) {
a = (a);
b = (b);
if (b < 0) throw $.captureStackTrace($.IllegalArgumentException$(b));
if (a > 0) {
if (b > 31) return 0;
return a >>> b;
}
if (b > 31) b = 31;
return (a >> b) >>> 0;
}
return a.operator$shr$1(b);
};
$.truncate = function(receiver) {
if (!(typeof receiver === 'number')) return receiver.truncate$0();
return receiver < 0 ? $.ceil(receiver) : $.floor(receiver);
};
$.charCodeAt = function(receiver, index) {
if (typeof receiver === 'string') {
if (!(typeof index === 'number')) throw $.captureStackTrace($.IllegalArgumentException$(index));
if (index < 0) throw $.captureStackTrace($.IndexOutOfRangeException$(index));
if (index >= receiver.length) throw $.captureStackTrace($.IndexOutOfRangeException$(index));
return receiver.charCodeAt(index);
}
return receiver.charCodeAt$1(index);
};
$.checkNull = function(object) {
if (object == null) throw $.captureStackTrace($.NullPointerException$(null, $.CTC));
return object;
};
$.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;
};
$.and = function(a, b) {
if ($.checkNumbers(a, b) === true) return (a & b) >>> 0;
return a.operator$and$1(b);
};
$.indexSet = function(a, index, value) {
if (a.constructor === Array && !a.immutable$list) {
var key = (index >>> 0);
if (key === index && key < (a.length)) {
a[key] = value;
return;
}
}
$.indexSet$slow(a, index, value);
};
$.Collections__containsRef = function(c, ref) {
for (var t1 = $.iterator(c); t1.hasNext$0() === true; ) {
var t2 = t1.next$0();
if (t2 == null ? ref == null : t2 === ref) return true;
}
return false;
};
$.substring$2 = function(receiver, startIndex, endIndex) {
if (!(typeof receiver === 'string')) return receiver.substring$2(startIndex, endIndex);
$.checkNum(startIndex);
var length$ = receiver.length;
if (endIndex == null) endIndex = length$;
$.checkNum(endIndex);
if ($.ltB(startIndex, 0)) throw $.captureStackTrace($.IndexOutOfRangeException$(startIndex));
if ($.gtB(startIndex, endIndex)) throw $.captureStackTrace($.IndexOutOfRangeException$(startIndex));
if ($.gtB(endIndex, length$)) throw $.captureStackTrace($.IndexOutOfRangeException$(endIndex));
return $.substringUnchecked(receiver, startIndex, endIndex);
};
$.checkGrowable = function(list, reason) {
if (!!(list.fixed$length)) throw $.captureStackTrace($.UnsupportedOperationException$(reason));
};
$.index = function(a, index) {
if (typeof a == "string" || a.constructor === Array) {
var key = (index >>> 0);
if (key === index && key < (a.length)) return a[key];
}
return $.index$slow(a, index);
};
$.stringJoinUnchecked = function(array, separator) {
return array.join(separator);
};
$.isJsArray = function(value) {
return !(value == null) && (value.constructor === Array);
};
$.indexSet$slow = function(a, index, value) {
if ($.isJsArray(a) === true) {
if (!((typeof index === 'number') && (index === (index | 0)))) throw $.captureStackTrace($.IllegalArgumentException$(index));
if (index < 0 || $.geB(index, $.get$length(a))) throw $.captureStackTrace($.IndexOutOfRangeException$(index));
$.checkMutable(a, 'indexed set');
a[index] = value;
return;
}
a.operator$indexSet$2(index, value);
};
$.HashMapImplementation__nextProbe = function(currentProbe, numberOfProbes, length$) {
return $.and($.add(currentProbe, numberOfProbes), $.sub(length$, 1));
};
$.Collections_collectionToString = function(c) {
var result = $.StringBufferImpl$('');
$.Collections__emitCollection(c, result, $.ListFactory_List(null));
return result.toString$0();
};
$.add$1 = function(receiver, value) {
if ($.isJsArray(receiver) === true) {
$.checkGrowable(receiver, 'add');
receiver.push(value);
return;
}
return receiver.add$1(value);
};
$.print = function(obj) {
return $.Primitives_printString($.toString(obj));
};
$.substringUnchecked = function(receiver, startIndex, endIndex) {
return receiver.substring(startIndex, endIndex);
};
$.ListFactory_List = function(length$) {
return $.Primitives_newList(length$);
};
$.add = function(a, b) {
return typeof a === 'number' && typeof b === 'number' ? (a + b) : $.add$slow(a, b);
};
$.checkNumbers = function(a, b) {
if (typeof a === 'number') {
if (typeof b === 'number') return true;
$.checkNull(b);
throw $.captureStackTrace($.IllegalArgumentException$(b));
}
return false;
};
$.UnsupportedOperationException$ = function(_message) {
return new $.UnsupportedOperationException(_message);
};
$.get$length = function(receiver) {
if (typeof receiver === 'string' || $.isJsArray(receiver) === true) return receiver.length;
return receiver.get$length();
};
$.mul = function(a, b) {
return typeof a === 'number' && typeof b === 'number' ? (a * b) : $.mul$slow(a, b);
};
$.ge$slow = function(a, b) {
if ($.checkNumbers(a, b) === true) return a >= b;
return a.operator$ge$1(b);
};
$.geB = function(a, b) {
return typeof a === 'number' && typeof b === 'number' ? (a >= b) : $.ge$slow(a, b) === true;
};
$.captureStackTrace = function(ex) {
if (ex == null) ex = $.CTC0;
var jsError = (new Error());
jsError.dartException = ex;
jsError.toString = $.toStringWrapper.$call$0;
return jsError;
};
$.ListIterator$ = function(list) {
return new $.ListIterator(list, 0);
};
$.lt$slow = function(a, b) {
if ($.checkNumbers(a, b) === true) return a < b;
return a.operator$lt$1(b);
};
$.Model$ = function(data) {
return new $.Model(data);
};
$.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;
};
$.StringBufferImpl$ = function(content$) {
var t1 = new $.StringBufferImpl(null, null);
t1.StringBufferImpl$1(content$);
return t1;
};
$.index$slow = function(a, index) {
if (typeof a === 'string' || $.isJsArray(a) === true) {
if (!((typeof index === 'number') && (index === (index | 0)))) {
if (!(typeof index === 'number')) throw $.captureStackTrace($.IllegalArgumentException$(index));
if (!($.truncate(index) === index)) throw $.captureStackTrace($.IllegalArgumentException$(index));
}
if ($.ltB(index, 0) || $.geB(index, $.get$length(a))) throw $.captureStackTrace($.IndexOutOfRangeException$(index));
return a[index];
}
return a.operator$index$1(index);
};
$.Primitives_objectToString = function(object) {
return 'Instance of \'' + $.S($.Primitives_objectTypeName(object)) + '\'';
};
$.substring$1 = function(receiver, startIndex) {
if (!(typeof receiver === 'string')) return receiver.substring$1(startIndex);
return $.substring$2(receiver, startIndex, null);
};
$.Collections__emitCollection = function(c, result, visiting) {
$.add$1(visiting, c);
var isList = typeof c === 'object' && c !== null && (c.constructor === Array || !!c.is$List);
$.add$1(result, isList ? '[' : '{');
for (var t1 = $.iterator(c), first = true; t1.hasNext$0() === true; ) {
var t2 = t1.next$0();
!first && $.add$1(result, ', ');
$.Collections__emitObject(t2, result, visiting);
first = false;
}
$.add$1(result, isList ? ']' : '}');
$.removeLast(visiting);
};
$.clear = function(receiver) {
if ($.isJsArray(receiver) !== true) return receiver.clear$0();
$.set$length(receiver, 0);
};
$.HashMapImplementation__firstProbe = function(hashCode, length$) {
return $.and(hashCode, $.sub(length$, 1));
};
$.checkMutable = function(list, reason) {
if (!!(list.immutable$list)) throw $.captureStackTrace($.UnsupportedOperationException$(reason));
};
$.Primitives_objectTypeName = function(object) {
var name$ = $.constructorNameFallback(object);
if ($.eqB(name$, 'Object')) {
var decompiled = (String(object.constructor).match(/^\s*function\s*(\S*)\s*\(/)[1]);
if (typeof decompiled === 'string') name$ = decompiled;
}
return $.charCodeAt(name$, 0) === 36 ? $.substring$1(name$, 1) : name$;
};
$.checkNum = function(value) {
if (!(typeof value === 'number')) {
$.checkNull(value);
throw $.captureStackTrace($.IllegalArgumentException$(value));
}
return value;
};
$.toString = function(value) {
if (typeof value == "object" && value !== null) {
if ($.isJsArray(value) === true) return $.Collections_collectionToString(value);
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);
};
$.set$length = function(receiver, newLength) {
if ($.isJsArray(receiver) === true) {
$.checkNull(newLength);
if (!((typeof newLength === 'number') && (newLength === (newLength | 0)))) throw $.captureStackTrace($.IllegalArgumentException$(newLength));
if (newLength < 0) throw $.captureStackTrace($.IndexOutOfRangeException$(newLength));
$.checkGrowable(receiver, 'set length');
receiver.length = newLength;
} else receiver.set$length(newLength);
return newLength;
};
$.ioore = function(index) {
throw $.captureStackTrace($.IndexOutOfRangeException$(index));
};
$.constructorNameFallback = function(obj) {
var constructor$ = (obj.constructor);
if ((typeof(constructor$)) === 'function') {
var name$ = (constructor$.name);
if ((typeof(name$)) === 'string' && ($.isEmpty(name$) !== true && (!(name$ === 'Object') && !(name$ === 'Function.prototype')))) return name$;
}
var string = (Object.prototype.toString.call(obj));
return $.substring$2(string, 8, string.length - 1);
};
$.forEach = function(receiver, f) {
if ($.isJsArray(receiver) !== true) return receiver.forEach$1(f);
return $.Collections_forEach(receiver, f);
};
$.gt$slow = function(a, b) {
if ($.checkNumbers(a, b) === true) return a > b;
return a.operator$gt$1(b);
};
$.sub$slow = function(a, b) {
if ($.checkNumbers(a, b) === true) return a - b;
return a.operator$sub$1(b);
};
$.ltB = function(a, b) {
return typeof a === 'number' && typeof b === 'number' ? (a < b) : $.lt$slow(a, b) === true;
};
$.toStringWrapper = function() {
return $.toString((this.dartException));
};
$.NullPointerException$ = function(functionName, arguments$) {
return new $.NullPointerException(arguments$, functionName);
};
$.setRuntimeTypeInfo = function(target, typeInfo) {
!(target == null) && (target.builtin$typeInfo = typeInfo);
};
$.gtB = function(a, b) {
return typeof a === 'number' && typeof b === 'number' ? (a > b) : $.gt$slow(a, b) === true;
};
$.removeLast = function(receiver) {
if ($.isJsArray(receiver) === true) {
$.checkGrowable(receiver, 'removeLast');
if ($.get$length(receiver) === 0) throw $.captureStackTrace($.IndexOutOfRangeException$(-1));
return receiver.pop();
}
return receiver.removeLast$0();
};
$.NoMoreElementsException$ = function() {
return new $.NoMoreElementsException();
};
$.Collections_forEach = function(iterable, f) {
for (var t1 = $.iterator(iterable); t1.hasNext$0() === true; ) {
f.$call$1(t1.next$0());
}
};
$.tdiv = function(a, b) {
if ($.checkNumbers(a, b) === true) return $.truncate((a) / (b));
return a.operator$tdiv$1(b);
};
$.Primitives_printString = function(string) {
if (typeof dartPrint == "function") {
dartPrint(string);
return;
}
if (typeof console == "object") {
console.log(string);
return;
}
if (typeof write == "function") {
write(string);
write("\n");
}
};
$.add$slow = function(a, b) {
if ($.checkNumbers(a, b) === true) return a + b;
return a.operator$add$1(b);
};
$.Primitives_newList = function(length$) {
if (length$ == null) return new Array();
if (!((typeof length$ === 'number') && (length$ === (length$ | 0))) || length$ < 0) throw $.captureStackTrace($.IllegalArgumentException$(length$));
var result = (new Array(length$));
result.fixed$length = true;
return result;
};
$.main = function() {
var m = $.HashMapImplementation$();
m.operator$indexSet$2('name', 'Kevin');
$.Model$(m).set$2('name', 'kevin').set$2('age', 24).save$0().save$0();
$.print('done');
};
$.lt = function(a, b) {
return typeof a === 'number' && typeof b === 'number' ? (a < b) : $.lt$slow(a, b);
};
$.isEmpty = function(receiver) {
if (typeof receiver === 'string' || $.isJsArray(receiver) === true) return receiver.length === 0;
return receiver.isEmpty$0();
};
$.ceil = function(receiver) {
if (!(typeof receiver === 'number')) return receiver.ceil$0();
return Math.ceil(receiver);
};
$.HashMapImplementation$ = function() {
var t1 = new $.HashMapImplementation(null, null, null, null, null);
t1.HashMapImplementation$0();
return t1;
};
$.StringBase_concatAll = function(strings) {
return $.stringJoinUnchecked($.StringBase__toJsStringArray(strings), '');
};
$.hashCode = function(receiver) {
if (typeof receiver === 'number') return receiver & 0x1FFFFFFF;
if (!(typeof receiver === 'string')) return receiver.hashCode$0();
var length$ = (receiver.length);
for (var hash = 0, i = 0; i < length$; ++i) {
var hash0 = 536870911 & hash + (receiver.charCodeAt(i));
var hash1 = 536870911 & hash0 + (524287 & hash0 << 10);
hash1 = (hash1 ^ $.shr(hash1, 6)) >>> 0;
hash = hash1;
}
hash0 = 536870911 & hash + (67108863 & hash << 3);
hash0 = (hash0 ^ $.shr(hash0, 11)) >>> 0;
return 536870911 & hash0 + (16383 & hash0 << 15);
};
$.HashMapImplementation__computeLoadLimit = function(capacity) {
return $.tdiv($.mul(capacity, 3), 4);
};
$.Maps_mapToString = function(m) {
var result = $.StringBufferImpl$('');
$.Maps__emitMap(m, result, $.ListFactory_List(null));
return result.toString$0();
};
$.IllegalArgumentException$ = function(arg) {
return new $.IllegalArgumentException(arg);
};
$.iterator = function(receiver) {
if ($.isJsArray(receiver) === true) return $.ListIterator$(receiver);
return receiver.iterator$0();
};
$.StringBase__toJsStringArray = function(strings) {
if (typeof strings !== 'object' || strings === null || ((strings.constructor !== Array || !!strings.immutable$list) && !strings.is$JavaScriptIndexingBehavior)) return $.StringBase__toJsStringArray$bailout(1, strings);
$.checkNull(strings);
var length$ = strings.length;
if ($.isJsArray(strings) === true) {
for (var i = 0; i < length$; ++i) {
var t1 = strings.length;
if (i < 0 || i >= t1) throw $.ioore(i);
var string = strings[i];
$.checkNull(string);
if (!(typeof string === 'string')) throw $.captureStackTrace($.IllegalArgumentException$(string));
}
var array = strings;
} else {
array = $.ListFactory_List(length$);
for (i = 0; i < length$; ++i) {
t1 = strings.length;
if (i < 0 || i >= t1) throw $.ioore(i);
string = strings[i];
$.checkNull(string);
if (!(typeof string === 'string')) throw $.captureStackTrace($.IllegalArgumentException$(string));
t1 = array.length;
if (i < 0 || i >= t1) throw $.ioore(i);
array[i] = string;
}
}
return array;
};
$.sub = function(a, b) {
return typeof a === 'number' && typeof b === 'number' ? (a - b) : $.sub$slow(a, b);
};
$.IndexOutOfRangeException$ = function(_value) {
return new $.IndexOutOfRangeException(_value);
};
$.StringBase__toJsStringArray$bailout = function(state, strings) {
$.checkNull(strings);
var length$ = $.get$length(strings);
if ($.isJsArray(strings) === true) {
for (var i = 0; $.ltB(i, length$); ++i) {
var string = $.index(strings, i);
$.checkNull(string);
if (!(typeof string === 'string')) throw $.captureStackTrace($.IllegalArgumentException$(string));
}
var array = strings;
} else {
array = $.ListFactory_List(length$);
for (i = 0; $.ltB(i, length$); ++i) {
string = $.index(strings, i);
$.checkNull(string);
if (!(typeof string === 'string')) throw $.captureStackTrace($.IllegalArgumentException$(string));
var t1 = array.length;
if (i < 0 || i >= t1) throw $.ioore(i);
array[i] = string;
}
}
return array;
};
$.toStringWrapper.$call$0 = $.toStringWrapper;
$.toStringWrapper.$name = "toStringWrapper";
Isolate.$finishClasses($$);
$$ = {};
Isolate.makeConstantList = function(list) {
list.immutable$list = true;
list.fixed$length = true;
return list;
};
$.CTC = Isolate.makeConstantList([]);
$.CTC1 = new Isolate.$isolateProperties._DeletedKeySentinel();
$.CTC0 = new Isolate.$isolateProperties.NullPointerException(Isolate.$isolateProperties.CTC, null);
var $ = null;
Isolate.$finishClasses($$);
$$ = {};
Isolate = Isolate.$finishIsolateConstructor(Isolate);
var $ = new Isolate();
if (typeof document != 'undefined' && document.readyState != 'complete') {
document.addEventListener('readystatechange', function () {
if (document.readyState == 'complete') {
$.main();
}
}, false);
} else {
$.main();
}
function init() {
Isolate.$isolateProperties = {};
Isolate.$defineClass = function(cls, fields, prototype) {
var generateGetterSetter = function(field, prototype) {
var len = field.length;
var lastChar = field[len - 1];
var needsGetter = lastChar == '?' || lastChar == '=';
var needsSetter = lastChar == '!' || lastChar == '=';
if (needsGetter || needsSetter) field = field.substring(0, len - 1);
if (needsGetter) {
var getterString = "return this." + field + ";";
prototype["get$" + field] = new Function(getterString);
}
if (needsSetter) {
var setterString = "this." + field + " = v;";
prototype["set$" + field] = 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) {
for (var cls in collectedClasses) {
if (Object.prototype.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) {
if (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;
var hasOwnProperty = Object.prototype.hasOwnProperty;
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.$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