|
// Generated by dart2js, the Dart to JavaScript compiler. |
|
// The code supports the following hooks: |
|
// dartPrint(message) - if this function is defined it is called |
|
// instead of the Dart [print] method. |
|
// dartMainRunner(main) - if this function is defined, the Dart [main] |
|
// method will not be invoked directly. |
|
// Instead, a closure that will invoke [main] is |
|
// passed to [dartMainRunner]. |
|
function Isolate() {} |
|
init(); |
|
|
|
var $$ = {}; |
|
var $ = Isolate.$isolateProperties; |
|
$$.StringBufferImpl = {"": |
|
["_buffer", "_length"], |
|
"super": "Object", |
|
get$length: function() { |
|
return this._length; |
|
}, |
|
isEmpty$0: function() { |
|
return this._length === 0; |
|
}, |
|
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; |
|
}, |
|
clear$0: function() { |
|
this._buffer = $.ListImplementation_List(null); |
|
this._length = 0; |
|
return this; |
|
}, |
|
toString$0: function() { |
|
if ($.get$length(this._buffer) === 0) |
|
return ''; |
|
if ($.get$length(this._buffer) === 1) |
|
return $.index(this._buffer, 0); |
|
var result = $.StringImplementation_concatAll(this._buffer); |
|
$.clear(this._buffer); |
|
$.add$1(this._buffer, result); |
|
return result; |
|
}, |
|
StringBufferImpl$1: function(content$) { |
|
this.clear$0(); |
|
this.add$1(content$); |
|
} |
|
}; |
|
|
|
$$.ArgumentError = {"": |
|
["message"], |
|
"super": "Object", |
|
toString$0: function() { |
|
var t1 = this.message; |
|
if (!(t1 == null)) |
|
return 'Illegal argument(s): ' + $.S(t1); |
|
return 'Illegal argument(s)'; |
|
} |
|
}; |
|
|
|
$$.IndexOutOfRangeException = {"": |
|
["_value"], |
|
"super": "Object", |
|
toString$0: function() { |
|
return 'IndexOutOfRangeException: ' + $.S(this._value); |
|
} |
|
}; |
|
|
|
$$.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'; |
|
} |
|
}; |
|
|
|
$$.NoMoreElementsException = {"": |
|
[], |
|
"super": "Object", |
|
toString$0: function() { |
|
return 'NoMoreElementsException'; |
|
} |
|
}; |
|
|
|
$$.UnsupportedOperationException = {"": |
|
["_message"], |
|
"super": "Object", |
|
toString$0: function() { |
|
return 'UnsupportedOperationException: ' + this._message; |
|
} |
|
}; |
|
|
|
$$.Object = {"": |
|
[], |
|
"super": "", |
|
operator$eq$1: function(other) { |
|
return this === other; |
|
}, |
|
toString$0: function() { |
|
return $.Primitives_objectToString(this); |
|
} |
|
}; |
|
|
|
$$.ListIterator = {"": |
|
["i", "list"], |
|
"super": "Object", |
|
hasNext$0: function() { |
|
return this.i < this.list.length; |
|
}, |
|
next$0: function() { |
|
if (this.hasNext$0() !== true) |
|
throw $.$$throw($.NoMoreElementsException$()); |
|
var value = this.list[this.i]; |
|
this.i = this.i + 1; |
|
return value; |
|
} |
|
}; |
|
|
|
$$.Closure = {"": |
|
[], |
|
"super": "Object", |
|
toString$0: function() { |
|
return 'Closure'; |
|
} |
|
}; |
|
|
|
$$.Simple = {"": |
|
["name"], |
|
"super": "Object", |
|
greet$1: function(who) { |
|
return 'Greetings ' + who + ', I\'m ' + this.name + '!'; |
|
} |
|
}; |
|
|
|
$$.Maps__emitMap_anon = {"": |
|
["result_3", "box_0", "visiting_2"], |
|
"super": "Closure", |
|
call$2: function(k, v) { |
|
var t1 = this.box_0; |
|
if (t1.first_1 !== true) |
|
$.add$1(this.result_3, ', '); |
|
t1.first_1 = false; |
|
t1 = this.result_3; |
|
var t2 = this.visiting_2; |
|
$.Collections__emitObject(k, t1, t2); |
|
$.add$1(t1, ': '); |
|
$.Collections__emitObject(v, t1, t2); |
|
} |
|
}; |
|
|
|
$.S = function(value) { |
|
var res = $.toString(value); |
|
if (!(typeof res === 'string')) |
|
throw $.$$throw($.ArgumentError$(value)); |
|
return res; |
|
}; |
|
|
|
$.StringBuffer_StringBuffer = function(content$) { |
|
return $.StringBufferImpl$(content$); |
|
}; |
|
|
|
$.gt$slow = function(a, b) { |
|
if ($.checkNumbers(a, b)) |
|
return a > b; |
|
return a.operator$gt$1(b); |
|
}; |
|
|
|
$.checkGrowable = function(list, reason) { |
|
if (!!(list.fixed$length)) |
|
throw $.$$throw($.UnsupportedOperationException$(reason)); |
|
}; |
|
|
|
$.$$throw = function(ex) { |
|
if (ex == null) |
|
ex = $.CTC; |
|
var jsError = new Error(); |
|
jsError.name = ex; |
|
jsError.description = ex; |
|
jsError.dartException = ex; |
|
jsError.toString = $.toStringWrapper.call$0; |
|
throw jsError; |
|
}; |
|
|
|
$.iterator = function(receiver) { |
|
if ($.isJsArray(receiver)) |
|
return $.ListIterator$(receiver); |
|
return receiver.iterator$0(); |
|
}; |
|
|
|
$.ArgumentError$ = function(message) { |
|
return new $.ArgumentError(message); |
|
}; |
|
|
|
$.NullPointerException$ = function(functionName, arguments$) { |
|
return new $.NullPointerException(functionName, arguments$); |
|
}; |
|
|
|
$.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; |
|
}; |
|
|
|
$.add$1 = function(receiver, value) { |
|
if ($.isJsArray(receiver)) { |
|
$.checkGrowable(receiver, 'add'); |
|
receiver.push(value); |
|
return; |
|
} |
|
return receiver.add$1(value); |
|
}; |
|
|
|
$.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(); |
|
if (!first) |
|
$.add$1(result, ', '); |
|
$.Collections__emitObject(t2, result, visiting); |
|
first = false; |
|
} |
|
$.add$1(result, isList ? ']' : '}'); |
|
$.removeLast(visiting); |
|
}; |
|
|
|
$.Primitives_newList = function(length$) { |
|
if (length$ == null) |
|
return new Array(); |
|
if (!(typeof length$ === 'number' && Math.floor(length$) === length$) || length$ < 0) |
|
throw $.$$throw($.ArgumentError$(length$)); |
|
var result = new Array(length$); |
|
result.fixed$length = true; |
|
return result; |
|
}; |
|
|
|
$.set$length = function(receiver, newLength) { |
|
if ($.isJsArray(receiver)) { |
|
$.checkNull(newLength); |
|
if (newLength < 0) |
|
throw $.$$throw($.IndexOutOfRangeException$(newLength)); |
|
$.checkGrowable(receiver, 'set length'); |
|
receiver.length = newLength; |
|
} else |
|
receiver.set$length(newLength); |
|
return newLength; |
|
}; |
|
|
|
$.Primitives_printString = function(string) { |
|
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); |
|
}; |
|
|
|
$.toStringWrapper = function() { |
|
return $.toString(this.dartException); |
|
}; |
|
|
|
$.checkNum = function(value) { |
|
if (!(typeof value === 'number')) { |
|
$.checkNull(value); |
|
throw $.$$throw($.ArgumentError$(value)); |
|
} |
|
return value; |
|
}; |
|
|
|
$.get$length = function(receiver) { |
|
if (typeof receiver === 'string' || $.isJsArray(receiver)) |
|
return receiver.length; |
|
else |
|
return receiver.get$length(); |
|
}; |
|
|
|
$.constructorNameFallback = function(object) { |
|
var constructor$ = object.constructor; |
|
if (typeof(constructor$) === 'function') { |
|
var name$ = constructor$.name; |
|
if (typeof name$ === 'string') |
|
var t1 = !(name$ === '') && !(name$ === 'Object') && !(name$ === 'Function.prototype'); |
|
else |
|
t1 = false; |
|
if (t1) |
|
return name$; |
|
} |
|
var string = Object.prototype.toString.call(object); |
|
return string.substring(8, string.length - 1); |
|
}; |
|
|
|
$.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); |
|
}; |
|
|
|
$.IndexOutOfRangeException$ = function(_value) { |
|
return new $.IndexOutOfRangeException(_value); |
|
}; |
|
|
|
$.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); |
|
}; |
|
|
|
$.substring$2 = function(receiver, startIndex, endIndex) { |
|
$.checkNum(startIndex); |
|
var length$ = receiver.length; |
|
if (endIndex == null) |
|
endIndex = length$; |
|
$.checkNum(endIndex); |
|
if (startIndex < 0) |
|
throw $.$$throw($.IndexOutOfRangeException$(startIndex)); |
|
if ($.gtB(startIndex, endIndex)) |
|
throw $.$$throw($.IndexOutOfRangeException$(startIndex)); |
|
if ($.gtB(endIndex, length$)) |
|
throw $.$$throw($.IndexOutOfRangeException$(endIndex)); |
|
return $.substringUnchecked(receiver, startIndex, endIndex); |
|
}; |
|
|
|
$.StringBufferImpl$ = function(content$) { |
|
var t1 = new $.StringBufferImpl(null, null); |
|
t1.StringBufferImpl$1(content$); |
|
return t1; |
|
}; |
|
|
|
$.UnsupportedOperationException$ = function(_message) { |
|
return new $.UnsupportedOperationException(_message); |
|
}; |
|
|
|
$.removeLast = function(receiver) { |
|
if ($.isJsArray(receiver)) { |
|
$.checkGrowable(receiver, 'removeLast'); |
|
if ($.get$length(receiver) === 0) |
|
throw $.$$throw($.IndexOutOfRangeException$(-1)); |
|
return receiver.pop(); |
|
} |
|
return receiver.removeLast$0(); |
|
}; |
|
|
|
$.gtB = function(a, b) { |
|
return typeof a === 'number' && typeof b === 'number' ? a > b : $.gt$slow(a, b) === true; |
|
}; |
|
|
|
$.Simple$ = function(name$) { |
|
return new $.Simple(name$); |
|
}; |
|
|
|
$.ltB = function(a, b) { |
|
return typeof a === 'number' && typeof b === 'number' ? a < b : $.lt$slow(a, b) === true; |
|
}; |
|
|
|
$.isJsArray = function(value) { |
|
return !(value == null) && value.constructor === Array; |
|
}; |
|
|
|
$.StringImplementation_concatAll = function(strings) { |
|
return $.stringJoinUnchecked($.StringImplementation__toJsStringArray(strings), ''); |
|
}; |
|
|
|
$.substring$1 = function(receiver, startIndex) { |
|
if (!(typeof receiver === 'string')) |
|
return receiver.substring$1(startIndex); |
|
return $.substring$2(receiver, startIndex, null); |
|
}; |
|
|
|
$.clear = function(receiver) { |
|
if (!$.isJsArray(receiver)) |
|
return receiver.clear$0(); |
|
$.set$length(receiver, 0); |
|
}; |
|
|
|
$.checkNull = function(object) { |
|
if (object == null) |
|
throw $.$$throw($.NullPointerException$(null, $.CTC0)); |
|
return object; |
|
}; |
|
|
|
$.charCodeAt = function(receiver, index) { |
|
if (typeof receiver === 'string') { |
|
if (index < 0) |
|
throw $.$$throw($.IndexOutOfRangeException$(index)); |
|
if (index >= receiver.length) |
|
throw $.$$throw($.IndexOutOfRangeException$(index)); |
|
return receiver.charCodeAt(index); |
|
} else |
|
return receiver.charCodeAt$1(index); |
|
}; |
|
|
|
$.Primitives_objectToString = function(object) { |
|
return 'Instance of \'' + $.S($.Primitives_objectTypeName(object)) + '\''; |
|
}; |
|
|
|
$.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$; |
|
}; |
|
|
|
$.lt$slow = function(a, b) { |
|
if ($.checkNumbers(a, b)) |
|
return a < b; |
|
return a.operator$lt$1(b); |
|
}; |
|
|
|
$.Collections__emitObject = function(o, result, visiting) { |
|
if (typeof o === 'object' && o !== null && (o.constructor === Array || !!o.is$Collection)) |
|
if ($.Collections__containsRef(visiting, o)) |
|
$.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)) |
|
$.add$1(result, '{...}'); |
|
else |
|
$.Maps__emitMap(o, result, visiting); |
|
else |
|
$.add$1(result, o); |
|
}; |
|
|
|
$.Maps__emitMap = function(m, result, visiting) { |
|
var t1 = {}; |
|
$.add$1(visiting, m); |
|
$.add$1(result, '{'); |
|
t1.first_1 = true; |
|
m.forEach$1(new $.Maps__emitMap_anon(result, t1, visiting)); |
|
$.add$1(result, '}'); |
|
$.removeLast(visiting); |
|
}; |
|
|
|
$.checkNumbers = function(a, b) { |
|
if (typeof a === 'number') |
|
if (typeof b === 'number') |
|
return true; |
|
else { |
|
$.checkNull(b); |
|
throw $.$$throw($.ArgumentError$(b)); |
|
} |
|
return false; |
|
}; |
|
|
|
$.main = function() { |
|
$.print($.Simple$('Flyn').greet$1('Program')); |
|
}; |
|
|
|
$.StringImplementation__toJsStringArray = function(strings) { |
|
if (typeof strings !== 'object' || strings === null || (strings.constructor !== Array || !!strings.immutable$list) && !strings.is$JavaScriptIndexingBehavior) |
|
return $.StringImplementation__toJsStringArray$bailout(1, strings); |
|
$.checkNull(strings); |
|
var length$ = strings.length; |
|
if ($.isJsArray(strings)) { |
|
for (var i = 0; i < length$; ++i) { |
|
if (i >= strings.length) |
|
throw $.ioore(i); |
|
var string = strings[i]; |
|
$.checkNull(string); |
|
if (!(typeof string === 'string')) |
|
throw $.$$throw($.ArgumentError$(string)); |
|
} |
|
var array = strings; |
|
} else { |
|
array = $.ListImplementation_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; |
|
}; |
|
|
|
$.ListImplementation_List = function(length$) { |
|
return $.Primitives_newList(length$); |
|
}; |
|
|
|
$.index$slow = function(a, index) { |
|
if (typeof a === 'string' || $.isJsArray(a)) { |
|
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($.IndexOutOfRangeException$(index)); |
|
return a[index]; |
|
} |
|
return a.operator$index$1(index); |
|
}; |
|
|
|
$.add = function(a, b) { |
|
return typeof a === 'number' && typeof b === 'number' ? a + b : $.add$slow(a, b); |
|
}; |
|
|
|
$.truncate = function(receiver) { |
|
return receiver < 0 ? $.ceil(receiver) : $.floor(receiver); |
|
}; |
|
|
|
$.print = function(object) { |
|
if (typeof object === 'string') |
|
$.Primitives_printString(object); |
|
else |
|
$.Primitives_printString($.toString(object)); |
|
}; |
|
|
|
$.ceil = function(receiver) { |
|
return Math.ceil(receiver); |
|
}; |
|
|
|
$.ListIterator$ = function(list) { |
|
return new $.ListIterator(0, list); |
|
}; |
|
|
|
$.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; |
|
}; |
|
|
|
$.Collections_collectionToString = function(c) { |
|
var result = $.StringBuffer_StringBuffer(''); |
|
$.Collections__emitCollection(c, result, $.ListImplementation_List(null)); |
|
return $.toString(result); |
|
}; |
|
|
|
$.NoMoreElementsException$ = function() { |
|
return new $.NoMoreElementsException(); |
|
}; |
|
|
|
$.isEmpty = function(receiver) { |
|
if (typeof receiver === 'string' || $.isJsArray(receiver)) |
|
return receiver.length === 0; |
|
return receiver.isEmpty$0(); |
|
}; |
|
|
|
$.stringJoinUnchecked = function(array, separator) { |
|
return array.join(separator); |
|
}; |
|
|
|
$.geB = function(a, b) { |
|
return typeof a === 'number' && typeof b === 'number' ? a >= b : $.ge$slow(a, b) === true; |
|
}; |
|
|
|
$.ge$slow = function(a, b) { |
|
if ($.checkNumbers(a, b)) |
|
return a >= b; |
|
return a.operator$ge$1(b); |
|
}; |
|
|
|
$.substringUnchecked = function(receiver, startIndex, endIndex) { |
|
return receiver.substring(startIndex, endIndex); |
|
}; |
|
|
|
$.ioore = function(index) { |
|
throw $.$$throw($.IndexOutOfRangeException$(index)); |
|
}; |
|
|
|
$.floor = function(receiver) { |
|
return Math.floor(receiver); |
|
}; |
|
|
|
$.add$slow = function(a, b) { |
|
if ($.checkNumbers(a, b)) |
|
return a + b; |
|
return a.operator$add$1(b); |
|
}; |
|
|
|
$.StringImplementation__toJsStringArray$bailout = function(state0, strings) { |
|
$.checkNull(strings); |
|
var length$ = $.get$length(strings); |
|
if ($.isJsArray(strings)) { |
|
for (var i = 0; $.ltB(i, length$); ++i) { |
|
var string = $.index(strings, i); |
|
$.checkNull(string); |
|
if (!(typeof string === 'string')) |
|
throw $.$$throw($.ArgumentError$(string)); |
|
} |
|
var array = strings; |
|
} else { |
|
array = $.ListImplementation_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; |
|
}; |
|
|
|
$.toStringWrapper.call$0 = $.toStringWrapper; |
|
$.toStringWrapper.$name = "toStringWrapper"; |
|
Isolate.$finishClasses($$); |
|
$$ = {}; |
|
Isolate.makeConstantList = function(list) { |
|
list.immutable$list = true; |
|
list.fixed$length = true; |
|
return list; |
|
}; |
|
$.CTC0 = Isolate.makeConstantList([]); |
|
$.CTC1 = null; |
|
$.CTC = new Isolate.$isolateProperties.NullPointerException(null, Isolate.$isolateProperties.CTC0); |
|
$.Primitives_DOLLAR_CHAR_VALUE = 36; |
|
var $ = null; |
|
Isolate.$finishClasses($$); |
|
$$ = {}; |
|
Isolate = Isolate.$finishIsolateConstructor(Isolate); |
|
var $ = new Isolate(); |
|
|
|
// |
|
// BEGIN invoke [main]. |
|
// |
|
if (typeof document != 'undefined' && document.readyState != 'complete') { |
|
document.addEventListener('readystatechange', function () { |
|
if (document.readyState == 'complete') { |
|
if (typeof dartMainRunner == 'function') { |
|
dartMainRunner(function() { $.main(); }); |
|
} else { |
|
$.main(); |
|
} |
|
} |
|
}, false); |
|
} else { |
|
if (typeof dartMainRunner == 'function') { |
|
dartMainRunner(function() { $.main(); }); |
|
} else { |
|
$.main(); |
|
} |
|
} |
|
// |
|
// END invoke [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) { |
|
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.$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; |
|
}; |
|
} |
|
|
|
//@ sourceMappingURL=dart.js.map |
typescript's output is the best.
Dart's the ugliest.