Created
March 7, 2014 08:19
-
-
Save rolaveric/9407509 to your computer and use it in GitHub Desktop.
The result from building gopherjsIntroMain.go with GopherJS
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
"use strict"; | |
(function() { | |
Error.stackTraceLimit = -1; | |
var go$reservedKeywords = ["abstract", "arguments", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "eval", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with", "yield"]; | |
var go$global; | |
if (typeof window !== "undefined") { | |
go$global = window; | |
} else if (typeof GLOBAL !== "undefined") { | |
go$global = GLOBAL; | |
} | |
var go$idCounter = 0; | |
var go$keys = function(m) { return m ? Object.keys(m) : []; }; | |
var go$min = Math.min; | |
var go$parseInt = parseInt; | |
var go$parseFloat = parseFloat; | |
var go$toString = String; | |
var go$reflect, go$newStringPtr; | |
var Go$Array = Array; | |
var Go$Error = Error; | |
var go$floatKey = function(f) { | |
if (f !== f) { | |
go$idCounter++; | |
return "NaN$" + go$idCounter; | |
} | |
return String(f); | |
}; | |
var go$mapArray = function(array, f) { | |
var newArray = new array.constructor(array.length), i; | |
for (i = 0; i < array.length; i++) { | |
newArray[i] = f(array[i]); | |
} | |
return newArray; | |
}; | |
var go$newType = function(size, kind, string, name, pkgPath, constructor) { | |
var typ; | |
switch(kind) { | |
case "Bool": | |
case "Int": | |
case "Int8": | |
case "Int16": | |
case "Int32": | |
case "Uint": | |
case "Uint8" : | |
case "Uint16": | |
case "Uint32": | |
case "Uintptr": | |
case "String": | |
case "UnsafePointer": | |
typ = function(v) { this.go$val = v; }; | |
typ.prototype.go$key = function() { return string + "$" + this.go$val; }; | |
break; | |
case "Float32": | |
case "Float64": | |
typ = function(v) { this.go$val = v; }; | |
typ.prototype.go$key = function() { return string + "$" + go$floatKey(this.go$val); }; | |
break; | |
case "Int64": | |
typ = function(high, low) { | |
this.high = (high + Math.floor(Math.ceil(low) / 4294967296)) >> 0; | |
this.low = low >>> 0; | |
this.go$val = this; | |
}; | |
typ.prototype.go$key = function() { return string + "$" + this.high + "$" + this.low; }; | |
break; | |
case "Uint64": | |
typ = function(high, low) { | |
this.high = (high + Math.floor(Math.ceil(low) / 4294967296)) >>> 0; | |
this.low = low >>> 0; | |
this.go$val = this; | |
}; | |
typ.prototype.go$key = function() { return string + "$" + this.high + "$" + this.low; }; | |
break; | |
case "Complex64": | |
case "Complex128": | |
typ = function(real, imag) { | |
this.real = real; | |
this.imag = imag; | |
this.go$val = this; | |
}; | |
typ.prototype.go$key = function() { return string + "$" + this.real + "$" + this.imag; }; | |
break; | |
case "Array": | |
typ = function(v) { this.go$val = v; }; | |
typ.Ptr = go$newType(4, "Ptr", "*" + string, "", "", function(array) { | |
this.go$get = function() { return array; }; | |
this.go$val = array; | |
}); | |
typ.init = function(elem, len) { | |
typ.elem = elem; | |
typ.len = len; | |
typ.prototype.go$key = function() { | |
return string + "$" + go$mapArray(this.go$val, function(e) { | |
var key = e.go$key ? e.go$key() : String(e); | |
return key.replace(/\\/g, "\\\\").replace(/\$/g, "\\$"); | |
}).join("$"); | |
}; | |
typ.extendReflectType = function(rt) { | |
rt.arrayType = new go$reflect.arrayType(rt, elem.reflectType(), undefined, len); | |
}; | |
typ.Ptr.init(typ); | |
}; | |
break; | |
case "Chan": | |
typ = function() { this.go$val = this; }; | |
typ.prototype.go$key = function() { | |
if (this.go$id === undefined) { | |
go$idCounter++; | |
this.go$id = go$idCounter; | |
} | |
return String(this.go$id); | |
}; | |
typ.init = function(elem, sendOnly, recvOnly) { | |
typ.nil = new typ(); | |
typ.extendReflectType = function(rt) { | |
rt.chanType = new go$reflect.chanType(rt, elem.reflectType(), sendOnly ? go$reflect.SendDir : (recvOnly ? go$reflect.RecvDir : go$reflect.BothDir)); | |
}; | |
}; | |
break; | |
case "Func": | |
typ = function(v) { this.go$val = v; }; | |
typ.init = function(params, results, variadic) { | |
typ.params = params; | |
typ.results = results; | |
typ.variadic = variadic; | |
typ.extendReflectType = function(rt) { | |
var typeSlice = (go$sliceType(go$ptrType(go$reflect.rtype))); | |
rt.funcType = new go$reflect.funcType(rt, variadic, new typeSlice(go$mapArray(params, function(p) { return p.reflectType(); })), new typeSlice(go$mapArray(results, function(p) { return p.reflectType(); }))); | |
}; | |
}; | |
break; | |
case "Interface": | |
typ = { implementedBy: [] }; | |
typ.init = function(methods) { | |
typ.extendReflectType = function(rt) { | |
var imethods = go$mapArray(methods, function(m) { | |
return new go$reflect.imethod(go$newStringPtr(m[0]), go$newStringPtr(m[1]), m[2].reflectType()); | |
}); | |
var methodSlice = (go$sliceType(go$ptrType(go$reflect.imethod))); | |
rt.interfaceType = new go$reflect.interfaceType(rt, new methodSlice(imethods)); | |
}; | |
}; | |
break; | |
case "Map": | |
typ = function(v) { this.go$val = v; }; | |
typ.init = function(key, elem) { | |
typ.key = key; | |
typ.elem = elem; | |
typ.extendReflectType = function(rt) { | |
rt.mapType = new go$reflect.mapType(rt, key.reflectType(), elem.reflectType(), undefined, undefined); | |
}; | |
}; | |
break; | |
case "Ptr": | |
typ = constructor || function(getter, setter) { | |
this.go$get = getter; | |
this.go$set = setter; | |
this.go$val = this; | |
}; | |
typ.prototype.go$key = function() { | |
if (this.go$id === undefined) { | |
go$idCounter++; | |
this.go$id = go$idCounter; | |
} | |
return String(this.go$id); | |
}; | |
typ.init = function(elem) { | |
typ.nil = new typ(go$throwNilPointerError, go$throwNilPointerError); | |
typ.extendReflectType = function(rt) { | |
rt.ptrType = new go$reflect.ptrType(rt, elem.reflectType()); | |
}; | |
}; | |
break; | |
case "Slice": | |
var nativeArray; | |
typ = function(array) { | |
if (array.constructor !== nativeArray) { | |
array = new nativeArray(array); | |
} | |
this.array = array; | |
this.offset = 0; | |
this.length = array.length; | |
this.capacity = array.length; | |
this.go$val = this; | |
}; | |
typ.make = function(length, capacity, zero) { | |
capacity = capacity || length; | |
var array = new nativeArray(capacity), i; | |
for (i = 0; i < capacity; i++) { | |
array[i] = zero(); | |
} | |
var slice = new typ(array); | |
slice.length = length; | |
return slice; | |
}; | |
typ.init = function(elem) { | |
typ.elem = elem; | |
nativeArray = go$nativeArray(elem.kind); | |
typ.nil = new typ([]); | |
typ.extendReflectType = function(rt) { | |
rt.sliceType = new go$reflect.sliceType(rt, elem.reflectType()); | |
}; | |
}; | |
break; | |
case "Struct": | |
typ = function(v) { this.go$val = v; }; | |
typ.Ptr = go$newType(4, "Ptr", "*" + string, "", "", constructor); | |
typ.Ptr.Struct = typ; | |
typ.init = function(fields) { | |
var i; | |
typ.fields = fields; | |
typ.Ptr.init(typ); | |
// nil value | |
typ.Ptr.nil = new constructor(); | |
for (i = 0; i < fields.length; i++) { | |
var field = fields[i]; | |
Object.defineProperty(typ.Ptr.nil, field[1], { get: go$throwNilPointerError, set: go$throwNilPointerError }); | |
} | |
// methods for embedded fields | |
for (i = 0; i < typ.methods.length; i++) { | |
var method = typ.methods[i]; | |
if (method[5] != -1) { | |
(function(field, methodName) { | |
typ.prototype[methodName] = function() { | |
var v = this.go$val[field[0]]; | |
return v[methodName].apply(v, arguments); | |
}; | |
})(fields[method[5]], method[0]); | |
} | |
} | |
for (i = 0; i < typ.Ptr.methods.length; i++) { | |
var method = typ.Ptr.methods[i]; | |
if (method[5] != -1) { | |
(function(field, methodName) { | |
typ.Ptr.prototype[methodName] = function() { | |
var v = this[field[0]]; | |
if (v.go$val === undefined) { | |
v = new field[3](v); | |
} | |
return v[methodName].apply(v, arguments); | |
}; | |
})(fields[method[5]], method[0]); | |
} | |
} | |
// map key | |
typ.prototype.go$key = function() { | |
var keys = new Array(fields.length); | |
for (i = 0; i < fields.length; i++) { | |
var v = this.go$val[fields[i][0]]; | |
var key = v.go$key ? v.go$key() : String(v); | |
keys[i] = key.replace(/\\/g, "\\\\").replace(/\$/g, "\\$"); | |
} | |
return string + "$" + keys.join("$"); | |
}; | |
// reflect type | |
typ.extendReflectType = function(rt) { | |
var reflectFields = new Array(fields.length), i; | |
for (i = 0; i < fields.length; i++) { | |
var field = fields[i]; | |
reflectFields[i] = new go$reflect.structField(go$newStringPtr(field[1]), go$newStringPtr(field[2]), field[3].reflectType(), go$newStringPtr(field[4]), i); | |
} | |
rt.structType = new go$reflect.structType(rt, new (go$sliceType(go$reflect.structField))(reflectFields)); | |
}; | |
}; | |
break; | |
default: | |
throw go$panic(new Go$String("invalid kind: " + kind)); | |
} | |
typ.kind = kind; | |
typ.string = string; | |
typ.typeName = name; | |
typ.pkgPath = pkgPath; | |
typ.methods = []; | |
var rt = null; | |
typ.reflectType = function() { | |
if (rt === null) { | |
rt = new go$reflect.rtype(size, 0, 0, 0, 0, go$reflect.kinds[kind], undefined, undefined, go$newStringPtr(string), undefined, undefined); | |
rt.jsType = typ; | |
var methods = []; | |
if (typ.methods !== undefined) { | |
var i; | |
for (i = 0; i < typ.methods.length; i++) { | |
var m = typ.methods[i]; | |
methods.push(new go$reflect.method(go$newStringPtr(m[0]), go$newStringPtr(m[1]), go$funcType(m[2], m[3], m[4]).reflectType(), go$funcType([typ].concat(m[2]), m[3], m[4]).reflectType(), undefined, undefined)); | |
} | |
} | |
if (name !== "" || methods.length !== 0) { | |
var methodSlice = (go$sliceType(go$ptrType(go$reflect.method))); | |
rt.uncommonType = new go$reflect.uncommonType(go$newStringPtr(name), go$newStringPtr(pkgPath), new methodSlice(methods)); | |
} | |
if (typ.extendReflectType !== undefined) { | |
typ.extendReflectType(rt); | |
} | |
} | |
return rt; | |
}; | |
return typ; | |
}; | |
var Go$Bool = go$newType( 1, "Bool", "bool", "bool", "", null); | |
var Go$Int = go$newType( 4, "Int", "int", "int", "", null); | |
var Go$Int8 = go$newType( 1, "Int8", "int8", "int8", "", null); | |
var Go$Int16 = go$newType( 2, "Int16", "int16", "int16", "", null); | |
var Go$Int32 = go$newType( 4, "Int32", "int32", "int32", "", null); | |
var Go$Int64 = go$newType( 8, "Int64", "int64", "int64", "", null); | |
var Go$Uint = go$newType( 4, "Uint", "uint", "uint", "", null); | |
var Go$Uint8 = go$newType( 1, "Uint8", "uint8", "uint8", "", null); | |
var Go$Uint16 = go$newType( 2, "Uint16", "uint16", "uint16", "", null); | |
var Go$Uint32 = go$newType( 4, "Uint32", "uint32", "uint32", "", null); | |
var Go$Uint64 = go$newType( 8, "Uint64", "uint64", "uint64", "", null); | |
var Go$Uintptr = go$newType( 4, "Uintptr", "uintptr", "uintptr", "", null); | |
var Go$Float32 = go$newType( 4, "Float32", "float32", "float32", "", null); | |
var Go$Float64 = go$newType( 8, "Float64", "float64", "float64", "", null); | |
var Go$Complex64 = go$newType( 8, "Complex64", "complex64", "complex64", "", null); | |
var Go$Complex128 = go$newType(16, "Complex128", "complex128", "complex128", "", null); | |
var Go$String = go$newType( 0, "String", "string", "string", "", null); | |
var Go$UnsafePointer = go$newType( 4, "UnsafePointer", "unsafe.Pointer", "Pointer", "", null); | |
var go$nativeArray = function(elemKind) { | |
return ({ Int: Int32Array, Int8: Int8Array, Int16: Int16Array, Int32: Int32Array, Uint: Uint32Array, Uint8: Uint8Array, Uint16: Uint16Array, Uint32: Uint32Array, Uintptr: Uint32Array, Float32: Float32Array, Float64: Float64Array })[elemKind] || Array; | |
}; | |
var go$toNativeArray = function(elemKind, array) { | |
var nativeArray = go$nativeArray(elemKind); | |
if (nativeArray === Array) { | |
return array; | |
} | |
return new nativeArray(array); | |
}; | |
var go$makeNativeArray = function(elemKind, length, zero) { | |
var array = new (go$nativeArray(elemKind))(length), i; | |
for (i = 0; i < length; i++) { | |
array[i] = zero(); | |
} | |
return array; | |
}; | |
var go$arrayTypes = {}; | |
var go$arrayType = function(elem, len) { | |
var string = "[" + len + "]" + elem.string; | |
var typ = go$arrayTypes[string]; | |
if (typ === undefined) { | |
typ = go$newType(0, "Array", string, "", "", null); | |
typ.init(elem, len); | |
go$arrayTypes[string] = typ; | |
} | |
return typ; | |
}; | |
var go$chanType = function(elem, sendOnly, recvOnly) { | |
var string = (recvOnly ? "<-" : "") + "chan" + (sendOnly ? "<- " : " ") + elem.string; | |
var field = sendOnly ? "SendChan" : (recvOnly ? "RecvChan" : "Chan"); | |
var typ = elem[field]; | |
if (typ === undefined) { | |
typ = go$newType(0, "Chan", string, "", "", null); | |
typ.init(elem, sendOnly, recvOnly); | |
elem[field] = typ; | |
} | |
return typ; | |
}; | |
var go$funcTypes = {}; | |
var go$funcType = function(params, results, variadic) { | |
var paramTypes = go$mapArray(params, function(p) { return p.string; }); | |
if (variadic) { | |
paramTypes[paramTypes.length - 1] = "..." + paramTypes[paramTypes.length - 1].substr(2); | |
} | |
var string = "func(" + paramTypes.join(", ") + ")"; | |
if (results.length === 1) { | |
string += " " + results[0].string; | |
} else if (results.length > 1) { | |
string += " (" + go$mapArray(results, function(r) { return r.string; }).join(", ") + ")"; | |
} | |
var typ = go$funcTypes[string]; | |
if (typ === undefined) { | |
typ = go$newType(0, "Func", string, "", "", null); | |
typ.init(params, results, variadic); | |
go$funcTypes[string] = typ; | |
} | |
return typ; | |
}; | |
var go$interfaceTypes = {}; | |
var go$interfaceType = function(methods) { | |
var string = "interface {}"; | |
if (methods.length !== 0) { | |
string = "interface { " + go$mapArray(methods, function(m) { | |
return (m[1] !== "" ? m[1] + "." : "") + m[0] + m[2].string.substr(4); | |
}).join("; ") + " }"; | |
} | |
var typ = go$interfaceTypes[string]; | |
if (typ === undefined) { | |
typ = go$newType(0, "Interface", string, "", "", null); | |
typ.init(methods); | |
go$interfaceTypes[string] = typ; | |
} | |
return typ; | |
}; | |
var go$emptyInterface = go$interfaceType([]); | |
var go$interfaceNil = { go$key: function() { return "nil"; } }; | |
var go$error = go$newType(8, "Interface", "error", "error", "", null); | |
go$error.init([["Error", "", go$funcType([], [Go$String], false)]]); | |
var Go$Map = function() {}; | |
(function() { | |
var names = Object.getOwnPropertyNames(Object.prototype), i; | |
for (i = 0; i < names.length; i++) { | |
Go$Map.prototype[names[i]] = undefined; | |
} | |
})(); | |
var go$mapTypes = {}; | |
var go$mapType = function(key, elem) { | |
var string = "map[" + key.string + "]" + elem.string; | |
var typ = go$mapTypes[string]; | |
if (typ === undefined) { | |
typ = go$newType(0, "Map", string, "", "", null); | |
typ.init(key, elem); | |
go$mapTypes[string] = typ; | |
} | |
return typ; | |
}; | |
var go$throwNilPointerError = function() { go$throwRuntimeError("invalid memory address or nil pointer dereference"); }; | |
var go$ptrType = function(elem) { | |
var typ = elem.Ptr; | |
if (typ === undefined) { | |
typ = go$newType(0, "Ptr", "*" + elem.string, "", "", null); | |
typ.init(elem); | |
elem.Ptr = typ; | |
} | |
return typ; | |
}; | |
var go$sliceType = function(elem) { | |
var typ = elem.Slice; | |
if (typ === undefined) { | |
typ = go$newType(0, "Slice", "[]" + elem.string, "", "", null); | |
typ.init(elem); | |
elem.Slice = typ; | |
} | |
return typ; | |
}; | |
var go$structTypes = {}; | |
var go$structType = function(fields) { | |
var string = "struct { " + go$mapArray(fields, function(f) { | |
return f[1] + " " + f[3].string + (f[4] !== "" ? (' "' + f[4].replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"') : ""); | |
}).join("; ") + " }"; | |
var typ = go$structTypes[string]; | |
if (typ === undefined) { | |
typ = go$newType(0, "Struct", string, "", "", function() { | |
this.go$val = this; | |
var i; | |
for (i = 0; i < fields.length; i++) { | |
this[fields[i][0]] = arguments[i]; | |
} | |
}); | |
typ.init(fields); | |
go$structTypes[string] = typ; | |
} | |
return typ; | |
}; | |
var go$stringPtrMap = new Go$Map(); | |
go$newStringPtr = function(str) { | |
if (str === undefined || str === "") { | |
return go$ptrType(Go$String).nil; | |
} | |
var ptr = go$stringPtrMap[str]; | |
if (ptr === undefined) { | |
ptr = new (go$ptrType(Go$String))(function() { return str; }, function(v) { str = v; }); | |
go$stringPtrMap[str] = ptr; | |
} | |
return ptr; | |
}; | |
var go$newDataPointer = function(data, constructor) { | |
return new constructor(function() { return data; }, function(v) { data = v; }); | |
}; | |
var go$ldexp = function(frac, exp) { | |
if (frac === 0) { return frac; } | |
if (exp >= 1024) { return frac * Math.pow(2, 1023) * Math.pow(2, exp - 1023); } | |
if (exp <= -1024) { return frac * Math.pow(2, -1023) * Math.pow(2, exp + 1023); } | |
return frac * Math.pow(2, exp); | |
}; | |
var go$float32bits = function(f) { | |
var s, e, r; | |
if (f === 0) { | |
if (f === 0 && 1 / f === 1 / -0) { | |
return 2147483648; | |
} | |
return 0; | |
} | |
if (f !== f) { | |
return 2143289344; | |
} | |
s = 0; | |
if (f < 0) { | |
s = 2147483648; | |
f = -f; | |
} | |
e = 150; | |
while (f >= 1.6777216e+07) { | |
f = f / 2; | |
if (e === 255) { | |
break; | |
} | |
e = e + 1 >>> 0; | |
} | |
while (f < 8.388608e+06) { | |
e = e - 1 >>> 0; | |
if (e === 0) { | |
break; | |
} | |
f = f * 2; | |
} | |
r = f % 2; | |
if ((r > 0.5 && r < 1) || r >= 1.5) { | |
f++; | |
} | |
return (((s | (e << 23 >>> 0)) >>> 0) | (((f >> 0) & ~8388608))) >>> 0; | |
}; | |
var go$float32frombits = function(b) { | |
var s, e, m; | |
s = 1; | |
if (((b & 2147483648) >>> 0) !== 0) { | |
s = -1; | |
} | |
e = (((b >>> 23 >>> 0)) & 255) >>> 0; | |
m = (b & 8388607) >>> 0; | |
if (e === 255) { | |
if (m === 0) { | |
return s / 0; | |
} | |
return 0/0; | |
} | |
if (e !== 0) { | |
m = m + 8388608 >>> 0; | |
} | |
if (e === 0) { | |
e = 1; | |
} | |
return go$ldexp(m, e - 127 - 23) * s; | |
}; | |
var go$flatten64 = function(x) { | |
return x.high * 4294967296 + x.low; | |
}; | |
var go$shiftLeft64 = function(x, y) { | |
if (y === 0) { | |
return x; | |
} | |
if (y < 32) { | |
return new x.constructor(x.high << y | x.low >>> (32 - y), (x.low << y) >>> 0); | |
} | |
if (y < 64) { | |
return new x.constructor(x.low << (y - 32), 0); | |
} | |
return new x.constructor(0, 0); | |
}; | |
var go$shiftRightInt64 = function(x, y) { | |
if (y === 0) { | |
return x; | |
} | |
if (y < 32) { | |
return new x.constructor(x.high >> y, (x.low >>> y | x.high << (32 - y)) >>> 0); | |
} | |
if (y < 64) { | |
return new x.constructor(x.high >> 31, (x.high >> (y - 32)) >>> 0); | |
} | |
if (x.high < 0) { | |
return new x.constructor(-1, 4294967295); | |
} | |
return new x.constructor(0, 0); | |
}; | |
var go$shiftRightUint64 = function(x, y) { | |
if (y === 0) { | |
return x; | |
} | |
if (y < 32) { | |
return new x.constructor(x.high >>> y, (x.low >>> y | x.high << (32 - y)) >>> 0); | |
} | |
if (y < 64) { | |
return new x.constructor(0, x.high >>> (y - 32)); | |
} | |
return new x.constructor(0, 0); | |
}; | |
var go$mul64 = function(x, y) { | |
var high = 0, low = 0, i; | |
if ((y.low & 1) !== 0) { | |
high = x.high; | |
low = x.low; | |
} | |
for (i = 1; i < 32; i++) { | |
if ((y.low & 1<<i) !== 0) { | |
high += x.high << i | x.low >>> (32 - i); | |
low += (x.low << i) >>> 0; | |
} | |
} | |
for (i = 0; i < 32; i++) { | |
if ((y.high & 1<<i) !== 0) { | |
high += x.low << i; | |
} | |
} | |
return new x.constructor(high, low); | |
}; | |
var go$div64 = function(x, y, returnRemainder) { | |
if (y.high === 0 && y.low === 0) { | |
go$throwRuntimeError("integer divide by zero"); | |
} | |
var s = 1; | |
var rs = 1; | |
var xHigh = x.high; | |
var xLow = x.low; | |
if (xHigh < 0) { | |
s = -1; | |
rs = -1; | |
xHigh = -xHigh; | |
if (xLow !== 0) { | |
xHigh--; | |
xLow = 4294967296 - xLow; | |
} | |
} | |
var yHigh = y.high; | |
var yLow = y.low; | |
if (y.high < 0) { | |
s *= -1; | |
yHigh = -yHigh; | |
if (yLow !== 0) { | |
yHigh--; | |
yLow = 4294967296 - yLow; | |
} | |
} | |
var high = 0, low = 0, n = 0, i; | |
while (yHigh < 2147483648 && ((xHigh > yHigh) || (xHigh === yHigh && xLow > yLow))) { | |
yHigh = (yHigh << 1 | yLow >>> 31) >>> 0; | |
yLow = (yLow << 1) >>> 0; | |
n++; | |
} | |
for (i = 0; i <= n; i++) { | |
high = high << 1 | low >>> 31; | |
low = (low << 1) >>> 0; | |
if ((xHigh > yHigh) || (xHigh === yHigh && xLow >= yLow)) { | |
xHigh = xHigh - yHigh; | |
xLow = xLow - yLow; | |
if (xLow < 0) { | |
xHigh--; | |
xLow += 4294967296; | |
} | |
low++; | |
if (low === 4294967296) { | |
high++; | |
low = 0; | |
} | |
} | |
yLow = (yLow >>> 1 | yHigh << (32 - 1)) >>> 0; | |
yHigh = yHigh >>> 1; | |
} | |
if (returnRemainder) { | |
return new x.constructor(xHigh * rs, xLow * rs); | |
} | |
return new x.constructor(high * s, low * s); | |
}; | |
var go$divComplex = function(n, d) { | |
var ninf = n.real === 1/0 || n.real === -1/0 || n.imag === 1/0 || n.imag === -1/0; | |
var dinf = d.real === 1/0 || d.real === -1/0 || d.imag === 1/0 || d.imag === -1/0; | |
var nnan = !ninf && (n.real !== n.real || n.imag !== n.imag); | |
var dnan = !dinf && (d.real !== d.real || d.imag !== d.imag); | |
if(nnan || dnan) { | |
return new n.constructor(0/0, 0/0); | |
} | |
if (ninf && !dinf) { | |
return new n.constructor(1/0, 1/0); | |
} | |
if (!ninf && dinf) { | |
return new n.constructor(0, 0); | |
} | |
if (d.real === 0 && d.imag === 0) { | |
if (n.real === 0 && n.imag === 0) { | |
return new n.constructor(0/0, 0/0); | |
} | |
return new n.constructor(1/0, 1/0); | |
} | |
var a = Math.abs(d.real); | |
var b = Math.abs(d.imag); | |
if (a <= b) { | |
var ratio = d.real / d.imag; | |
var denom = d.real * ratio + d.imag; | |
return new n.constructor((n.real * ratio + n.imag) / denom, (n.imag * ratio - n.real) / denom); | |
} | |
var ratio = d.imag / d.real; | |
var denom = d.imag * ratio + d.real; | |
return new n.constructor((n.imag * ratio + n.real) / denom, (n.imag - n.real * ratio) / denom); | |
}; | |
var go$subslice = function(slice, low, high, max) { | |
if (low < 0 || high < low || max < high || high > slice.capacity || max > slice.capacity) { | |
go$throwRuntimeError("slice bounds out of range"); | |
} | |
var s = new slice.constructor(slice.array); | |
s.offset = slice.offset + low; | |
s.length = slice.length - low; | |
s.capacity = slice.capacity - low; | |
if (high !== undefined) { | |
s.length = high - low; | |
} | |
if (max !== undefined) { | |
s.capacity = max - low; | |
} | |
return s; | |
}; | |
var go$sliceToArray = function(slice) { | |
if (slice.length === 0) { | |
return []; | |
} | |
if (slice.array.constructor !== Array) { | |
return slice.array.subarray(slice.offset, slice.offset + slice.length); | |
} | |
return slice.array.slice(slice.offset, slice.offset + slice.length); | |
}; | |
var go$decodeRune = function(str, pos) { | |
var c0 = str.charCodeAt(pos); | |
if (c0 < 0x80) { | |
return [c0, 1]; | |
} | |
if (c0 !== c0 || c0 < 0xC0) { | |
return [0xFFFD, 1]; | |
} | |
var c1 = str.charCodeAt(pos + 1); | |
if (c1 !== c1 || c1 < 0x80 || 0xC0 <= c1) { | |
return [0xFFFD, 1]; | |
} | |
if (c0 < 0xE0) { | |
var r = (c0 & 0x1F) << 6 | (c1 & 0x3F); | |
if (r <= 0x7F) { | |
return [0xFFFD, 1]; | |
} | |
return [r, 2]; | |
} | |
var c2 = str.charCodeAt(pos + 2); | |
if (c2 !== c2 || c2 < 0x80 || 0xC0 <= c2) { | |
return [0xFFFD, 1]; | |
} | |
if (c0 < 0xF0) { | |
var r = (c0 & 0x0F) << 12 | (c1 & 0x3F) << 6 | (c2 & 0x3F); | |
if (r <= 0x7FF) { | |
return [0xFFFD, 1]; | |
} | |
if (0xD800 <= r && r <= 0xDFFF) { | |
return [0xFFFD, 1]; | |
} | |
return [r, 3]; | |
} | |
var c3 = str.charCodeAt(pos + 3); | |
if (c3 !== c3 || c3 < 0x80 || 0xC0 <= c3) { | |
return [0xFFFD, 1]; | |
} | |
if (c0 < 0xF8) { | |
var r = (c0 & 0x07) << 18 | (c1 & 0x3F) << 12 | (c2 & 0x3F) << 6 | (c3 & 0x3F); | |
if (r <= 0xFFFF || 0x10FFFF < r) { | |
return [0xFFFD, 1]; | |
} | |
return [r, 4]; | |
} | |
return [0xFFFD, 1]; | |
}; | |
var go$encodeRune = function(r) { | |
if (r < 0 || r > 0x10FFFF || (0xD800 <= r && r <= 0xDFFF)) { | |
r = 0xFFFD; | |
} | |
if (r <= 0x7F) { | |
return String.fromCharCode(r); | |
} | |
if (r <= 0x7FF) { | |
return String.fromCharCode(0xC0 | r >> 6, 0x80 | (r & 0x3F)); | |
} | |
if (r <= 0xFFFF) { | |
return String.fromCharCode(0xE0 | r >> 12, 0x80 | (r >> 6 & 0x3F), 0x80 | (r & 0x3F)); | |
} | |
return String.fromCharCode(0xF0 | r >> 18, 0x80 | (r >> 12 & 0x3F), 0x80 | (r >> 6 & 0x3F), 0x80 | (r & 0x3F)); | |
}; | |
var go$stringToBytes = function(str, terminateWithNull) { | |
var array = new Uint8Array(terminateWithNull ? str.length + 1 : str.length), i; | |
for (i = 0; i < str.length; i++) { | |
array[i] = str.charCodeAt(i); | |
} | |
if (terminateWithNull) { | |
array[str.length] = 0; | |
} | |
return array; | |
}; | |
var go$bytesToString = function(slice) { | |
if (slice.length === 0) { | |
return ""; | |
} | |
var str = "", i; | |
for (i = 0; i < slice.length; i += 10000) { | |
str += String.fromCharCode.apply(null, slice.array.subarray(slice.offset + i, slice.offset + Math.min(slice.length, i + 10000))); | |
} | |
return str; | |
}; | |
var go$stringToRunes = function(str) { | |
var array = new Int32Array(str.length); | |
var rune, i, j = 0; | |
for (i = 0; i < str.length; i += rune[1], j++) { | |
rune = go$decodeRune(str, i); | |
array[j] = rune[0]; | |
} | |
return array.subarray(0, j); | |
}; | |
var go$runesToString = function(slice) { | |
if (slice.length === 0) { | |
return ""; | |
} | |
var str = "", i; | |
for (i = 0; i < slice.length; i++) { | |
str += go$encodeRune(slice.array[slice.offset + i]); | |
} | |
return str; | |
}; | |
var go$needsExternalization = function(t) { | |
switch (t.kind) { | |
case "Int64": | |
case "Uint64": | |
case "Array": | |
case "Func": | |
case "Interface": | |
case "Map": | |
case "Slice": | |
case "String": | |
return true; | |
default: | |
return false; | |
} | |
}; | |
var go$externalize = function(v, t) { | |
switch (t.kind) { | |
case "Int64": | |
case "Uint64": | |
return go$flatten64(v); | |
case "Array": | |
if (go$needsExternalization(t.elem)) { | |
return go$mapArray(v, function(e) { return go$externalize(e, t.elem); }); | |
} | |
return v; | |
case "Func": | |
if (v === go$throwNilPointerError) { | |
return null; | |
} | |
var convert = false; | |
var i; | |
for (i = 0; i < t.params.length; i++) { | |
convert = convert || (t.params[i] !== go$packages["github.com/gopherjs/gopherjs/js"].Object); | |
} | |
for (i = 0; i < t.results.length; i++) { | |
convert = convert || go$needsExternalization(t.results[i]); | |
} | |
if (!convert) { | |
return v; | |
} | |
return function() { | |
var args = [], i; | |
for (i = 0; i < t.params.length; i++) { | |
if (t.variadic && i === t.params.length - 1) { | |
var vt = t.params[i].elem, varargs = [], j; | |
for (j = i; j < arguments.length; j++) { | |
varargs.push(go$internalize(arguments[j], vt)); | |
} | |
args.push(new (t.params[i])(varargs)); | |
break; | |
} | |
args.push(go$internalize(arguments[i], t.params[i])); | |
} | |
var result = v.apply(undefined, args); | |
switch (t.results.length) { | |
case 0: | |
return; | |
case 1: | |
return go$externalize(result, t.results[0]); | |
default: | |
for (i = 0; i < t.results.length; i++) { | |
result[i] = go$externalize(result[i], t.results[i]); | |
} | |
return result; | |
} | |
}; | |
case "Interface": | |
if (v === null) { | |
return null; | |
} | |
if (v.constructor.kind === undefined) { | |
return v; // js.Object | |
} | |
return go$externalize(v.go$val, v.constructor); | |
case "Map": | |
var m = {}; | |
var keys = go$keys(v), i; | |
for (i = 0; i < keys.length; i++) { | |
var entry = v[keys[i]]; | |
m[go$externalize(entry.k, t.key)] = go$externalize(entry.v, t.elem); | |
} | |
return m; | |
case "Slice": | |
if (go$needsExternalization(t.elem)) { | |
return go$mapArray(go$sliceToArray(v), function(e) { return go$externalize(e, t.elem); }); | |
} | |
return go$sliceToArray(v); | |
case "String": | |
var s = "", r, i, j = 0; | |
for (i = 0; i < v.length; i += r[1], j++) { | |
r = go$decodeRune(v, i); | |
s += String.fromCharCode(r[0]); | |
} | |
return s; | |
case "Struct": | |
var timePkg = go$packages["time"]; | |
if (timePkg && v.constructor === timePkg.Time.Ptr) { | |
var milli = go$div64(v.UnixNano(), new Go$Int64(0, 1000000)); | |
return new Date(go$flatten64(milli)); | |
} | |
return v; | |
default: | |
return v; | |
} | |
}; | |
var go$internalize = function(v, t, recv) { | |
switch (t.kind) { | |
case "Bool": | |
return !!v; | |
case "Int": | |
return parseInt(v); | |
case "Int8": | |
return parseInt(v) << 24 >> 24; | |
case "Int16": | |
return parseInt(v) << 16 >> 16; | |
case "Int32": | |
return parseInt(v) >> 0; | |
case "Uint": | |
return parseInt(v); | |
case "Uint8" : | |
return parseInt(v) << 24 >>> 24; | |
case "Uint16": | |
return parseInt(v) << 16 >>> 16; | |
case "Uint32": | |
case "Uintptr": | |
return parseInt(v) >>> 0; | |
case "Int64": | |
case "Uint64": | |
return new t(0, v); | |
case "Float32": | |
case "Float64": | |
return parseFloat(v); | |
case "Array": | |
if (v.length !== t.len) { | |
go$throwRuntimeError("got array with wrong size from JavaScript native"); | |
} | |
return go$mapArray(v, function(e) { return go$internalize(e, t.elem); }); | |
case "Func": | |
return function() { | |
var args = [], i; | |
for (i = 0; i < t.params.length; i++) { | |
if (t.variadic && i === t.params.length - 1) { | |
var vt = t.params[i].elem, varargs = arguments[i], j; | |
for (j = 0; j < varargs.length; j++) { | |
args.push(go$externalize(varargs.array[varargs.offset + j], vt)); | |
} | |
break; | |
} | |
args.push(go$externalize(arguments[i], t.params[i])); | |
} | |
var result = v.apply(recv, args); | |
switch (t.results.length) { | |
case 0: | |
return; | |
case 1: | |
return go$internalize(result, t.results[0]); | |
default: | |
for (i = 0; i < t.results.length; i++) { | |
result[i] = go$internalize(result[i], t.results[i]); | |
} | |
return result; | |
} | |
}; | |
case "Interface": | |
if (t === go$packages["github.com/gopherjs/gopherjs/js"].Object) { | |
return v; | |
} | |
switch (v.constructor) { | |
case Int8Array: | |
return new (go$sliceType(Go$Int8))(v); | |
case Int16Array: | |
return new (go$sliceType(Go$Int16))(v); | |
case Int32Array: | |
return new (go$sliceType(Go$Int))(v); | |
case Uint8Array: | |
return new (go$sliceType(Go$Uint8))(v); | |
case Uint16Array: | |
return new (go$sliceType(Go$Uint16))(v); | |
case Uint32Array: | |
return new (go$sliceType(Go$Uint))(v); | |
case Float32Array: | |
return new (go$sliceType(Go$Float32))(v); | |
case Float64Array: | |
return new (go$sliceType(Go$Float64))(v); | |
case Array: | |
return go$internalize(v, go$sliceType(go$emptyInterface)); | |
case Boolean: | |
return new Go$Bool(!!v); | |
case Date: | |
var timePkg = go$packages["time"]; | |
if (timePkg) { | |
return new timePkg.Time(timePkg.Unix(new Go$Int64(0, 0), new Go$Int64(0, v.getTime() * 1000000))); | |
} | |
case Function: | |
var funcType = go$funcType([go$sliceType(go$emptyInterface)], [go$packages["github.com/gopherjs/gopherjs/js"].Object], true); | |
return new funcType(go$internalize(v, funcType)); | |
case Number: | |
return new Go$Float64(parseFloat(v)); | |
case Object: | |
var mapType = go$mapType(Go$String, go$emptyInterface); | |
return new mapType(go$internalize(v, mapType)); | |
case String: | |
return new Go$String(go$internalize(v, Go$String)); | |
} | |
return v; | |
case "Map": | |
var m = new Go$Map(); | |
var keys = go$keys(v), i; | |
for (i = 0; i < keys.length; i++) { | |
var key = go$internalize(keys[i], t.key); | |
m[key.go$key ? key.go$key() : key] = { k: key, v: go$internalize(v[keys[i]], t.elem) }; | |
} | |
return m; | |
case "Slice": | |
return new t(go$mapArray(v, function(e) { return go$internalize(e, t.elem); })); | |
case "String": | |
v = String(v); | |
var s = "", i; | |
for (i = 0; i < v.length; i++) { | |
s += go$encodeRune(v.charCodeAt(i)); | |
} | |
return s; | |
default: | |
return v; | |
} | |
}; | |
var go$copySlice = function(dst, src) { | |
var n = Math.min(src.length, dst.length), i; | |
if (dst.array.constructor !== Array && n !== 0) { | |
dst.array.set(src.array.subarray(src.offset, src.offset + n), dst.offset); | |
return n; | |
} | |
for (i = 0; i < n; i++) { | |
dst.array[dst.offset + i] = src.array[src.offset + i]; | |
} | |
return n; | |
}; | |
var go$copyString = function(dst, src) { | |
var n = Math.min(src.length, dst.length), i; | |
for (i = 0; i < n; i++) { | |
dst.array[dst.offset + i] = src.charCodeAt(i); | |
} | |
return n; | |
}; | |
var go$copyArray = function(dst, src) { | |
var i; | |
for (i = 0; i < src.length; i++) { | |
dst[i] = src[i]; | |
} | |
}; | |
var go$growSlice = function(slice, length) { | |
var newCapacity = Math.max(length, slice.capacity < 1024 ? slice.capacity * 2 : Math.floor(slice.capacity * 5 / 4)); | |
var newArray; | |
if (slice.array.constructor === Array) { | |
newArray = slice.array; | |
if (slice.offset !== 0 || newArray.length !== slice.offset + slice.capacity) { | |
newArray = newArray.slice(slice.offset); | |
} | |
newArray.length = newCapacity; | |
} else { | |
newArray = new slice.array.constructor(newCapacity); | |
newArray.set(slice.array.subarray(slice.offset)); | |
} | |
var newSlice = new slice.constructor(newArray); | |
newSlice.length = slice.length; | |
newSlice.capacity = newCapacity; | |
return newSlice; | |
}; | |
var go$append = function(slice) { | |
if (arguments.length === 1) { | |
return slice; | |
} | |
var newLength = slice.length + arguments.length - 1; | |
if (newLength > slice.capacity) { | |
slice = go$growSlice(slice, newLength); | |
} | |
var array = slice.array; | |
var leftOffset = slice.offset + slice.length - 1, i; | |
for (i = 1; i < arguments.length; i++) { | |
array[leftOffset + i] = arguments[i]; | |
} | |
var newSlice = new slice.constructor(array); | |
newSlice.offset = slice.offset; | |
newSlice.length = newLength; | |
newSlice.capacity = slice.capacity; | |
return newSlice; | |
}; | |
var go$appendSlice = function(slice, toAppend) { | |
if (toAppend.length === 0) { | |
return slice; | |
} | |
var newLength = slice.length + toAppend.length; | |
if (newLength > slice.capacity) { | |
slice = go$growSlice(slice, newLength); | |
} | |
var array = slice.array; | |
var leftOffset = slice.offset + slice.length, rightOffset = toAppend.offset, i; | |
for (i = 0; i < toAppend.length; i++) { | |
array[leftOffset + i] = toAppend.array[rightOffset + i]; | |
} | |
var newSlice = new slice.constructor(array); | |
newSlice.offset = slice.offset; | |
newSlice.length = newLength; | |
newSlice.capacity = slice.capacity; | |
return newSlice; | |
}; | |
var go$panic = function(value) { | |
var message; | |
if (value.constructor === Go$String) { | |
message = value.go$val; | |
} else if (value.Error !== undefined) { | |
message = value.Error(); | |
} else if (value.String !== undefined) { | |
message = value.String(); | |
} else { | |
message = value; | |
} | |
var err = new Error(message); | |
err.go$panicValue = value; | |
return err; | |
}; | |
var go$notSupported = function(feature) { | |
var err = new Error("not supported by GopherJS: " + feature); | |
err.go$notSupported = feature; | |
throw err; | |
}; | |
var go$throwRuntimeError; // set by package "runtime" | |
var go$errorStack = [], go$jsErr = null; | |
var go$pushErr = function(err) { | |
if (err.go$panicValue === undefined) { | |
var jsPkg = go$packages["github.com/gopherjs/gopherjs/js"]; | |
if (err.go$notSupported !== undefined || jsPkg === undefined) { | |
go$jsErr = err; | |
return; | |
} | |
err.go$panicValue = new jsPkg.Error.Ptr(err); | |
} | |
go$errorStack.push({ frame: go$getStackDepth(), error: err }); | |
}; | |
var go$callDeferred = function(deferred) { | |
if (go$jsErr !== null) { | |
throw go$jsErr; | |
} | |
var i; | |
for (i = deferred.length - 1; i >= 0; i--) { | |
var call = deferred[i]; | |
try { | |
if (call.recv !== undefined) { | |
call.recv[call.method].apply(call.recv, call.args); | |
continue; | |
} | |
call.fun.apply(undefined, call.args); | |
} catch (err) { | |
go$errorStack.push({ frame: go$getStackDepth(), error: err }); | |
} | |
} | |
var err = go$errorStack[go$errorStack.length - 1]; | |
if (err !== undefined && err.frame === go$getStackDepth()) { | |
go$errorStack.pop(); | |
throw err.error; | |
} | |
}; | |
var go$recover = function() { | |
var err = go$errorStack[go$errorStack.length - 1]; | |
if (err === undefined || err.frame !== go$getStackDepth()) { | |
return null; | |
} | |
go$errorStack.pop(); | |
return err.error.go$panicValue; | |
}; | |
var go$getStack = function() { | |
return (new Error()).stack.split("\n"); | |
}; | |
var go$getStackDepth = function() { | |
var s = go$getStack(), d = 0, i; | |
for (i = 0; i < s.length; i++) { | |
if (s[i].indexOf("go$") === -1) { | |
d++; | |
} | |
} | |
return d; | |
}; | |
var go$interfaceIsEqual = function(a, b) { | |
if (a === null || b === null) { | |
return a === null && b === null; | |
} | |
if (a.constructor !== b.constructor) { | |
return false; | |
} | |
switch (a.constructor.kind) { | |
case "Float32": | |
return go$float32IsEqual(a.go$val, b.go$val); | |
case "Complex64": | |
return go$float32IsEqual(a.go$val.real, b.go$val.real) && go$float32IsEqual(a.go$val.imag, b.go$val.imag); | |
case "Complex128": | |
return a.go$val.real === b.go$val.real && a.go$val.imag === b.go$val.imag; | |
case "Int64": | |
case "Uint64": | |
return a.go$val.high === b.go$val.high && a.go$val.low === b.go$val.low; | |
case "Array": | |
return go$arrayIsEqual(a.go$val, b.go$val); | |
case "Ptr": | |
if (a.constructor.Struct) { | |
return a === b; | |
} | |
return go$pointerIsEqual(a, b); | |
case "Func": | |
case "Map": | |
case "Slice": | |
case "Struct": | |
go$throwRuntimeError("comparing uncomparable type " + a.constructor); | |
case undefined: // js.Object | |
return a === b; | |
default: | |
return a.go$val === b.go$val; | |
} | |
}; | |
var go$float32IsEqual = function(a, b) { | |
return a === a && b === b && go$float32bits(a) === go$float32bits(b); | |
} | |
var go$arrayIsEqual = function(a, b) { | |
if (a.length != b.length) { | |
return false; | |
} | |
var i; | |
for (i = 0; i < a.length; i++) { | |
if (a[i] !== b[i]) { | |
return false; | |
} | |
} | |
return true; | |
}; | |
var go$sliceIsEqual = function(a, ai, b, bi) { | |
return a.array === b.array && a.offset + ai === b.offset + bi; | |
}; | |
var go$pointerIsEqual = function(a, b) { | |
if (a === b) { | |
return true; | |
} | |
if (a.go$get === go$throwNilPointerError || b.go$get === go$throwNilPointerError) { | |
return a.go$get === go$throwNilPointerError && b.go$get === go$throwNilPointerError; | |
} | |
var old = a.go$get(); | |
var dummy = new Object(); | |
a.go$set(dummy); | |
var equal = b.go$get() === dummy; | |
a.go$set(old); | |
return equal; | |
}; | |
var go$typeAssertionFailed = function(obj, expected) { | |
var got = ""; | |
if (obj !== null) { | |
got = obj.constructor.string; | |
} | |
throw go$panic(new go$packages["runtime"].TypeAssertionError.Ptr("", got, expected.string, "")); | |
}; | |
var go$now = function() { var msec = (new Date()).getTime(); return [new Go$Int64(0, Math.floor(msec / 1000)), (msec % 1000) * 1000000]; }; | |
var go$packages = {}; | |
go$packages["runtime"] = (function() { | |
var go$pkg = {}, TypeAssertionError, errorString, sizeof_C_MStats; | |
TypeAssertionError = go$pkg.TypeAssertionError = go$newType(0, "Struct", "runtime.TypeAssertionError", "TypeAssertionError", "runtime", function(interfaceString_, concreteString_, assertedString_, missingMethod_) { | |
this.go$val = this; | |
this.interfaceString = interfaceString_ !== undefined ? interfaceString_ : ""; | |
this.concreteString = concreteString_ !== undefined ? concreteString_ : ""; | |
this.assertedString = assertedString_ !== undefined ? assertedString_ : ""; | |
this.missingMethod = missingMethod_ !== undefined ? missingMethod_ : ""; | |
}); | |
errorString = go$pkg.errorString = go$newType(0, "String", "runtime.errorString", "errorString", "runtime", null); | |
TypeAssertionError.Ptr.prototype.RuntimeError = function() { | |
}; | |
TypeAssertionError.prototype.RuntimeError = function() { return this.go$val.RuntimeError(); }; | |
TypeAssertionError.Ptr.prototype.Error = function() { | |
var e, inter; | |
e = this; | |
inter = e.interfaceString; | |
if (inter === "") { | |
inter = "interface"; | |
} | |
if (e.concreteString === "") { | |
return "interface conversion: " + inter + " is nil, not " + e.assertedString; | |
} | |
if (e.missingMethod === "") { | |
return "interface conversion: " + inter + " is " + e.concreteString + ", not " + e.assertedString; | |
} | |
return "interface conversion: " + e.concreteString + " is not " + e.assertedString + ": missing method " + e.missingMethod; | |
}; | |
TypeAssertionError.prototype.Error = function() { return this.go$val.Error(); }; | |
errorString.prototype.RuntimeError = function() { | |
var e; | |
e = this.go$val; | |
}; | |
go$ptrType(errorString).prototype.RuntimeError = function() { return new errorString(this.go$get()).RuntimeError(); }; | |
errorString.prototype.Error = function() { | |
var e; | |
e = this.go$val; | |
return "runtime error: " + e; | |
}; | |
go$ptrType(errorString).prototype.Error = function() { return new errorString(this.go$get()).Error(); }; | |
go$throwRuntimeError = function(msg) { throw go$panic(new errorString(msg)); }; | |
go$pkg.init = function() { | |
(go$ptrType(TypeAssertionError)).methods = [["Error", "", [], [Go$String], false, -1], ["RuntimeError", "", [], [], false, -1]]; | |
TypeAssertionError.init([["interfaceString", "interfaceString", "runtime", Go$String, ""], ["concreteString", "concreteString", "runtime", Go$String, ""], ["assertedString", "assertedString", "runtime", Go$String, ""], ["missingMethod", "missingMethod", "runtime", Go$String, ""]]); | |
errorString.methods = [["Error", "", [], [Go$String], false, -1], ["RuntimeError", "", [], [], false, -1]]; | |
(go$ptrType(errorString)).methods = [["Error", "", [], [Go$String], false, -1], ["RuntimeError", "", [], [], false, -1]]; | |
sizeof_C_MStats = 3712; | |
if (!((sizeof_C_MStats === 3712))) { | |
console.log(sizeof_C_MStats, 3712); | |
throw go$panic(new Go$String("MStats vs MemStatsType size mismatch")); | |
} | |
} | |
return go$pkg; | |
})(); | |
go$packages["github.com/gopherjs/gopherjs/js"] = (function() { | |
var go$pkg = {}, Object, Error; | |
Object = go$pkg.Object = go$newType(0, "Interface", "js.Object", "Object", "github.com/gopherjs/gopherjs/js", null); | |
Error = go$pkg.Error = go$newType(0, "Struct", "js.Error", "Error", "github.com/gopherjs/gopherjs/js", function(Object_) { | |
this.go$val = this; | |
this.Object = Object_ !== undefined ? Object_ : null; | |
}); | |
Error.Ptr.prototype.Error = function() { | |
var err; | |
err = this; | |
return "JavaScript error: " + go$internalize(err.Object.message, Go$String); | |
}; | |
Error.prototype.Error = function() { return this.go$val.Error(); }; | |
go$pkg.init = function() { | |
Object.init([["Bool", "", (go$funcType([], [Go$Bool], false))], ["Call", "", (go$funcType([Go$String, (go$sliceType(go$emptyInterface))], [Object], true))], ["Float", "", (go$funcType([], [Go$Float64], false))], ["Get", "", (go$funcType([Go$String], [Object], false))], ["Index", "", (go$funcType([Go$Int], [Object], false))], ["Int", "", (go$funcType([], [Go$Int], false))], ["Interface", "", (go$funcType([], [go$emptyInterface], false))], ["Invoke", "", (go$funcType([(go$sliceType(go$emptyInterface))], [Object], true))], ["IsNull", "", (go$funcType([], [Go$Bool], false))], ["IsUndefined", "", (go$funcType([], [Go$Bool], false))], ["Length", "", (go$funcType([], [Go$Int], false))], ["New", "", (go$funcType([(go$sliceType(go$emptyInterface))], [Object], true))], ["Set", "", (go$funcType([Go$String, go$emptyInterface], [], false))], ["SetIndex", "", (go$funcType([Go$Int, go$emptyInterface], [], false))], ["String", "", (go$funcType([], [Go$String], false))]]); | |
Error.methods = [["Bool", "", [], [Go$Bool], false, 0], ["Call", "", [Go$String, (go$sliceType(go$emptyInterface))], [Object], true, 0], ["Float", "", [], [Go$Float64], false, 0], ["Get", "", [Go$String], [Object], false, 0], ["Index", "", [Go$Int], [Object], false, 0], ["Int", "", [], [Go$Int], false, 0], ["Interface", "", [], [go$emptyInterface], false, 0], ["Invoke", "", [(go$sliceType(go$emptyInterface))], [Object], true, 0], ["IsNull", "", [], [Go$Bool], false, 0], ["IsUndefined", "", [], [Go$Bool], false, 0], ["Length", "", [], [Go$Int], false, 0], ["New", "", [(go$sliceType(go$emptyInterface))], [Object], true, 0], ["Set", "", [Go$String, go$emptyInterface], [], false, 0], ["SetIndex", "", [Go$Int, go$emptyInterface], [], false, 0], ["String", "", [], [Go$String], false, 0]]; | |
(go$ptrType(Error)).methods = [["Bool", "", [], [Go$Bool], false, 0], ["Call", "", [Go$String, (go$sliceType(go$emptyInterface))], [Object], true, 0], ["Error", "", [], [Go$String], false, -1], ["Float", "", [], [Go$Float64], false, 0], ["Get", "", [Go$String], [Object], false, 0], ["Index", "", [Go$Int], [Object], false, 0], ["Int", "", [], [Go$Int], false, 0], ["Interface", "", [], [go$emptyInterface], false, 0], ["Invoke", "", [(go$sliceType(go$emptyInterface))], [Object], true, 0], ["IsNull", "", [], [Go$Bool], false, 0], ["IsUndefined", "", [], [Go$Bool], false, 0], ["Length", "", [], [Go$Int], false, 0], ["New", "", [(go$sliceType(go$emptyInterface))], [Object], true, 0], ["Set", "", [Go$String, go$emptyInterface], [], false, 0], ["SetIndex", "", [Go$Int, go$emptyInterface], [], false, 0], ["String", "", [], [Go$String], false, 0]]; | |
Error.init([["Object", "", "", Object, ""]]); | |
} | |
return go$pkg; | |
})(); | |
go$packages["github.com/rolaveric/gopherjs/pet"] = (function() { | |
var go$pkg = {}, Pet, New; | |
Pet = go$pkg.Pet = go$newType(0, "Struct", "pet.Pet", "Pet", "github.com/rolaveric/gopherjs/pet", function(name_) { | |
this.go$val = this; | |
this.name = name_ !== undefined ? name_ : ""; | |
}); | |
Pet.Ptr.prototype.Name = function() { | |
var p; | |
p = this; | |
return p.name; | |
}; | |
Pet.prototype.Name = function() { return this.go$val.Name(); }; | |
Pet.Ptr.prototype.SetName = function(newName) { | |
var p; | |
p = this; | |
p.name = newName; | |
}; | |
Pet.prototype.SetName = function(newName) { return this.go$val.SetName(newName); }; | |
New = go$pkg.New = function(name) { | |
return new Pet.Ptr(name); | |
}; | |
go$pkg.init = function() { | |
(go$ptrType(Pet)).methods = [["Name", "", [], [Go$String], false, -1], ["SetName", "", [Go$String], [], false, -1]]; | |
Pet.init([["name", "name", "github.com/rolaveric/gopherjs/pet", Go$String, ""]]); | |
} | |
return go$pkg; | |
})(); | |
go$packages["C:\GoCode\src\github.com\rolaveric\gopherjs"] = (function() { | |
var go$pkg = {}, js = go$packages["github.com/gopherjs/gopherjs/js"], pet = go$packages["github.com/rolaveric/gopherjs/pet"], main; | |
main = go$pkg.main = function() { | |
var _map, _key; | |
go$global.pet = go$externalize((_map = new Go$Map(), _key = "New", _map[_key] = { k: _key, v: new (go$funcType([Go$String], [(go$ptrType(pet.Pet))], false))(pet.New) }, _map), (go$mapType(Go$String, go$emptyInterface))); | |
}; | |
go$pkg.init = function() { | |
} | |
return go$pkg; | |
})(); | |
go$error.implementedBy = [go$packages["github.com/gopherjs/gopherjs/js"].Error.Ptr, go$packages["runtime"].TypeAssertionError.Ptr, go$packages["runtime"].errorString, go$ptrType(go$packages["runtime"].errorString)]; | |
go$packages["github.com/gopherjs/gopherjs/js"].Object.implementedBy = [go$packages["github.com/gopherjs/gopherjs/js"].Error, go$packages["github.com/gopherjs/gopherjs/js"].Error.Ptr]; | |
go$packages["runtime"].init(); | |
go$packages["github.com/gopherjs/gopherjs/js"].init(); | |
go$packages["github.com/rolaveric/gopherjs/pet"].init(); | |
go$packages["C:\GoCode\src\github.com\rolaveric\gopherjs"].init(); | |
go$packages["C:\GoCode\src\github.com\rolaveric\gopherjs"].main(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment