Skip to content

Instantly share code, notes, and snippets.

@suntong
Forked from anonymous/simplest.js
Last active February 11, 2018 04:37
Show Gist options
  • Save suntong/eda37f2f6273b70f2a8505b4d3af49f9 to your computer and use it in GitHub Desktop.
Save suntong/eda37f2f6273b70f2a8505b4d3af49f9 to your computer and use it in GitHub Desktop.
gopherjs bare bone js code base
"use strict";
(function() {
Error.stackTraceLimit = Infinity;
var $global, $module;
if (typeof window !== "undefined") { /* web page */
$global = window;
} else if (typeof self !== "undefined") { /* web worker */
$global = self;
} else if (typeof global !== "undefined") { /* Node.js */
$global = global;
$global.require = require;
} else { /* others (e.g. Nashorn) */
$global = this;
}
if ($global === undefined || $global.Array === undefined) {
throw new Error("no global object found");
}
if (typeof module !== "undefined") {
$module = module;
}
var $packages = {}, $idCounter = 0;
var $keys = function(m) { return m ? Object.keys(m) : []; };
var $flushConsole = function() {};
var $throwRuntimeError; /* set by package "runtime" */
var $throwNilPointerError = function() { $throwRuntimeError("invalid memory address or nil pointer dereference"); };
var $call = function(fn, rcvr, args) { return fn.apply(rcvr, args); };
var $makeFunc = function(fn) { return function() { return $externalize(fn(this, new ($sliceType($jsObjectPtr))($global.Array.prototype.slice.call(arguments, []))), $emptyInterface); }; };
var $unused = function(v) {};
var $mapArray = function(array, f) {
var newArray = new array.constructor(array.length);
for (var i = 0; i < array.length; i++) {
newArray[i] = f(array[i]);
}
return newArray;
};
var $methodVal = function(recv, name) {
var vals = recv.$methodVals || {};
recv.$methodVals = vals; /* noop for primitives */
var f = vals[name];
if (f !== undefined) {
return f;
}
var method = recv[name];
f = function() {
$stackDepthOffset--;
try {
return method.apply(recv, arguments);
} finally {
$stackDepthOffset++;
}
};
vals[name] = f;
return f;
};
var $methodExpr = function(typ, name) {
var method = typ.prototype[name];
if (method.$expr === undefined) {
method.$expr = function() {
$stackDepthOffset--;
try {
if (typ.wrapped) {
arguments[0] = new typ(arguments[0]);
}
return Function.call.apply(method, arguments);
} finally {
$stackDepthOffset++;
}
};
}
return method.$expr;
};
var $ifaceMethodExprs = {};
var $ifaceMethodExpr = function(name) {
var expr = $ifaceMethodExprs["$" + name];
if (expr === undefined) {
expr = $ifaceMethodExprs["$" + name] = function() {
$stackDepthOffset--;
try {
return Function.call.apply(arguments[0][name], arguments);
} finally {
$stackDepthOffset++;
}
};
}
return expr;
};
var $subslice = function(slice, low, high, max) {
if (low < 0 || high < low || max < high || high > slice.$capacity || max > slice.$capacity) {
$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 $substring = function(str, low, high) {
if (low < 0 || high < low || high > str.length) {
$throwRuntimeError("slice bounds out of range");
}
return str.substring(low, high);
};
var $sliceToArray = function(slice) {
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 $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 $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 $stringToBytes = function(str) {
var array = new Uint8Array(str.length);
for (var i = 0; i < str.length; i++) {
array[i] = str.charCodeAt(i);
}
return array;
};
var $bytesToString = function(slice) {
if (slice.$length === 0) {
return "";
}
var str = "";
for (var i = 0; i < slice.$length; i += 10000) {
str += String.fromCharCode.apply(undefined, slice.$array.subarray(slice.$offset + i, slice.$offset + Math.min(slice.$length, i + 10000)));
}
return str;
};
var $stringToRunes = function(str) {
var array = new Int32Array(str.length);
var rune, j = 0;
for (var i = 0; i < str.length; i += rune[1], j++) {
rune = $decodeRune(str, i);
array[j] = rune[0];
}
return array.subarray(0, j);
};
var $runesToString = function(slice) {
if (slice.$length === 0) {
return "";
}
var str = "";
for (var i = 0; i < slice.$length; i++) {
str += $encodeRune(slice.$array[slice.$offset + i]);
}
return str;
};
var $copyString = function(dst, src) {
var n = Math.min(src.length, dst.$length);
for (var i = 0; i < n; i++) {
dst.$array[dst.$offset + i] = src.charCodeAt(i);
}
return n;
};
var $copySlice = function(dst, src) {
var n = Math.min(src.$length, dst.$length);
$copyArray(dst.$array, src.$array, dst.$offset, src.$offset, n, dst.constructor.elem);
return n;
};
var $copyArray = function(dst, src, dstOffset, srcOffset, n, elem) {
if (n === 0 || (dst === src && dstOffset === srcOffset)) {
return;
}
if (src.subarray) {
dst.set(src.subarray(srcOffset, srcOffset + n), dstOffset);
return;
}
switch (elem.kind) {
case $kindArray:
case $kindStruct:
if (dst === src && dstOffset > srcOffset) {
for (var i = n - 1; i >= 0; i--) {
elem.copy(dst[dstOffset + i], src[srcOffset + i]);
}
return;
}
for (var i = 0; i < n; i++) {
elem.copy(dst[dstOffset + i], src[srcOffset + i]);
}
return;
}
if (dst === src && dstOffset > srcOffset) {
for (var i = n - 1; i >= 0; i--) {
dst[dstOffset + i] = src[srcOffset + i];
}
return;
}
for (var i = 0; i < n; i++) {
dst[dstOffset + i] = src[srcOffset + i];
}
};
var $clone = function(src, type) {
var clone = type.zero();
type.copy(clone, src);
return clone;
};
var $pointerOfStructConversion = function(obj, type) {
if(obj.$proxies === undefined) {
obj.$proxies = {};
obj.$proxies[obj.constructor.string] = obj;
}
var proxy = obj.$proxies[type.string];
if (proxy === undefined) {
var properties = {};
for (var i = 0; i < type.elem.fields.length; i++) {
(function(fieldProp) {
properties[fieldProp] = {
get: function() { return obj[fieldProp]; },
set: function(value) { obj[fieldProp] = value; }
};
})(type.elem.fields[i].prop);
}
proxy = Object.create(type.prototype, properties);
proxy.$val = proxy;
obj.$proxies[type.string] = proxy;
proxy.$proxies = obj.$proxies;
}
return proxy;
};
var $append = function(slice) {
return $internalAppend(slice, arguments, 1, arguments.length - 1);
};
var $appendSlice = function(slice, toAppend) {
if (toAppend.constructor === String) {
var bytes = $stringToBytes(toAppend);
return $internalAppend(slice, bytes, 0, bytes.length);
}
return $internalAppend(slice, toAppend.$array, toAppend.$offset, toAppend.$length);
};
var $internalAppend = function(slice, array, offset, length) {
if (length === 0) {
return slice;
}
var newArray = slice.$array;
var newOffset = slice.$offset;
var newLength = slice.$length + length;
var newCapacity = slice.$capacity;
if (newLength > newCapacity) {
newOffset = 0;
newCapacity = Math.max(newLength, slice.$capacity < 1024 ? slice.$capacity * 2 : Math.floor(slice.$capacity * 5 / 4));
if (slice.$array.constructor === Array) {
newArray = slice.$array.slice(slice.$offset, slice.$offset + slice.$length);
newArray.length = newCapacity;
var zero = slice.constructor.elem.zero;
for (var i = slice.$length; i < newCapacity; i++) {
newArray[i] = zero();
}
} else {
newArray = new slice.$array.constructor(newCapacity);
newArray.set(slice.$array.subarray(slice.$offset, slice.$offset + slice.$length));
}
}
$copyArray(newArray, array, newOffset + slice.$length, offset, length, slice.constructor.elem);
var newSlice = new slice.constructor(newArray);
newSlice.$offset = newOffset;
newSlice.$length = newLength;
newSlice.$capacity = newCapacity;
return newSlice;
};
var $equal = function(a, b, type) {
if (type === $jsObjectPtr) {
return a === b;
}
switch (type.kind) {
case $kindComplex64:
case $kindComplex128:
return a.$real === b.$real && a.$imag === b.$imag;
case $kindInt64:
case $kindUint64:
return a.$high === b.$high && a.$low === b.$low;
case $kindArray:
if (a.length !== b.length) {
return false;
}
for (var i = 0; i < a.length; i++) {
if (!$equal(a[i], b[i], type.elem)) {
return false;
}
}
return true;
case $kindStruct:
for (var i = 0; i < type.fields.length; i++) {
var f = type.fields[i];
if (!$equal(a[f.prop], b[f.prop], f.typ)) {
return false;
}
}
return true;
case $kindInterface:
return $interfaceIsEqual(a, b);
default:
return a === b;
}
};
var $interfaceIsEqual = function(a, b) {
if (a === $ifaceNil || b === $ifaceNil) {
return a === b;
}
if (a.constructor !== b.constructor) {
return false;
}
if (a.constructor === $jsObjectPtr) {
return a.object === b.object;
}
if (!a.constructor.comparable) {
$throwRuntimeError("comparing uncomparable type " + a.constructor.string);
}
return $equal(a.$val, b.$val, a.constructor);
};
var $min = Math.min;
var $mod = function(x, y) { return x % y; };
var $parseInt = parseInt;
var $parseFloat = function(f) {
if (f !== undefined && f !== null && f.constructor === Number) {
return f;
}
return parseFloat(f);
};
var $froundBuf = new Float32Array(1);
var $fround = Math.fround || function(f) {
$froundBuf[0] = f;
return $froundBuf[0];
};
var $imul = Math.imul || function(a, b) {
var ah = (a >>> 16) & 0xffff;
var al = a & 0xffff;
var bh = (b >>> 16) & 0xffff;
var bl = b & 0xffff;
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) >> 0);
};
var $floatKey = function(f) {
if (f !== f) {
$idCounter++;
return "NaN$" + $idCounter;
}
return String(f);
};
var $flatten64 = function(x) {
return x.$high * 4294967296 + x.$low;
};
var $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 $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 $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 $mul64 = function(x, y) {
var high = 0, low = 0;
if ((y.$low & 1) !== 0) {
high = x.$high;
low = x.$low;
}
for (var 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 (var i = 0; i < 32; i++) {
if ((y.$high & 1<<i) !== 0) {
high += x.$low << i;
}
}
return new x.constructor(high, low);
};
var $div64 = function(x, y, returnRemainder) {
if (y.$high === 0 && y.$low === 0) {
$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;
while (yHigh < 2147483648 && ((xHigh > yHigh) || (xHigh === yHigh && xLow > yLow))) {
yHigh = (yHigh << 1 | yLow >>> 31) >>> 0;
yLow = (yLow << 1) >>> 0;
n++;
}
for (var 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 $divComplex = function(n, d) {
var ninf = n.$real === Infinity || n.$real === -Infinity || n.$imag === Infinity || n.$imag === -Infinity;
var dinf = d.$real === Infinity || d.$real === -Infinity || d.$imag === Infinity || d.$imag === -Infinity;
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(NaN, NaN);
}
if (ninf && !dinf) {
return new n.constructor(Infinity, Infinity);
}
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(NaN, NaN);
}
return new n.constructor(Infinity, Infinity);
}
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 $kindBool = 1;
var $kindInt = 2;
var $kindInt8 = 3;
var $kindInt16 = 4;
var $kindInt32 = 5;
var $kindInt64 = 6;
var $kindUint = 7;
var $kindUint8 = 8;
var $kindUint16 = 9;
var $kindUint32 = 10;
var $kindUint64 = 11;
var $kindUintptr = 12;
var $kindFloat32 = 13;
var $kindFloat64 = 14;
var $kindComplex64 = 15;
var $kindComplex128 = 16;
var $kindArray = 17;
var $kindChan = 18;
var $kindFunc = 19;
var $kindInterface = 20;
var $kindMap = 21;
var $kindPtr = 22;
var $kindSlice = 23;
var $kindString = 24;
var $kindStruct = 25;
var $kindUnsafePointer = 26;
var $methodSynthesizers = [];
var $addMethodSynthesizer = function(f) {
if ($methodSynthesizers === null) {
f();
return;
}
$methodSynthesizers.push(f);
};
var $synthesizeMethods = function() {
$methodSynthesizers.forEach(function(f) { f(); });
$methodSynthesizers = null;
};
var $ifaceKeyFor = function(x) {
if (x === $ifaceNil) {
return 'nil';
}
var c = x.constructor;
return c.string + '$' + c.keyFor(x.$val);
};
var $identity = function(x) { return x; };
var $typeIDCounter = 0;
var $idKey = function(x) {
if (x.$id === undefined) {
$idCounter++;
x.$id = $idCounter;
}
return String(x.$id);
};
var $newType = function(size, kind, string, named, pkg, exported, constructor) {
var typ;
switch(kind) {
case $kindBool:
case $kindInt:
case $kindInt8:
case $kindInt16:
case $kindInt32:
case $kindUint:
case $kindUint8:
case $kindUint16:
case $kindUint32:
case $kindUintptr:
case $kindUnsafePointer:
typ = function(v) { this.$val = v; };
typ.wrapped = true;
typ.keyFor = $identity;
break;
case $kindString:
typ = function(v) { this.$val = v; };
typ.wrapped = true;
typ.keyFor = function(x) { return "$" + x; };
break;
case $kindFloat32:
case $kindFloat64:
typ = function(v) { this.$val = v; };
typ.wrapped = true;
typ.keyFor = function(x) { return $floatKey(x); };
break;
case $kindInt64:
typ = function(high, low) {
this.$high = (high + Math.floor(Math.ceil(low) / 4294967296)) >> 0;
this.$low = low >>> 0;
this.$val = this;
};
typ.keyFor = function(x) { return x.$high + "$" + x.$low; };
break;
case $kindUint64:
typ = function(high, low) {
this.$high = (high + Math.floor(Math.ceil(low) / 4294967296)) >>> 0;
this.$low = low >>> 0;
this.$val = this;
};
typ.keyFor = function(x) { return x.$high + "$" + x.$low; };
break;
case $kindComplex64:
typ = function(real, imag) {
this.$real = $fround(real);
this.$imag = $fround(imag);
this.$val = this;
};
typ.keyFor = function(x) { return x.$real + "$" + x.$imag; };
break;
case $kindComplex128:
typ = function(real, imag) {
this.$real = real;
this.$imag = imag;
this.$val = this;
};
typ.keyFor = function(x) { return x.$real + "$" + x.$imag; };
break;
case $kindArray:
typ = function(v) { this.$val = v; };
typ.wrapped = true;
typ.ptr = $newType(4, $kindPtr, "*" + string, false, "", false, function(array) {
this.$get = function() { return array; };
this.$set = function(v) { typ.copy(this, v); };
this.$val = array;
});
typ.init = function(elem, len) {
typ.elem = elem;
typ.len = len;
typ.comparable = elem.comparable;
typ.keyFor = function(x) {
return Array.prototype.join.call($mapArray(x, function(e) {
return String(elem.keyFor(e)).replace(/\\/g, "\\\\").replace(/\$/g, "\\$");
}), "$");
};
typ.copy = function(dst, src) {
$copyArray(dst, src, 0, 0, src.length, elem);
};
typ.ptr.init(typ);
Object.defineProperty(typ.ptr.nil, "nilCheck", { get: $throwNilPointerError });
};
break;
case $kindChan:
typ = function(v) { this.$val = v; };
typ.wrapped = true;
typ.keyFor = $idKey;
typ.init = function(elem, sendOnly, recvOnly) {
typ.elem = elem;
typ.sendOnly = sendOnly;
typ.recvOnly = recvOnly;
};
break;
case $kindFunc:
typ = function(v) { this.$val = v; };
typ.wrapped = true;
typ.init = function(params, results, variadic) {
typ.params = params;
typ.results = results;
typ.variadic = variadic;
typ.comparable = false;
};
break;
case $kindInterface:
typ = { implementedBy: {}, missingMethodFor: {} };
typ.keyFor = $ifaceKeyFor;
typ.init = function(methods) {
typ.methods = methods;
methods.forEach(function(m) {
$ifaceNil[m.prop] = $throwNilPointerError;
});
};
break;
case $kindMap:
typ = function(v) { this.$val = v; };
typ.wrapped = true;
typ.init = function(key, elem) {
typ.key = key;
typ.elem = elem;
typ.comparable = false;
};
break;
case $kindPtr:
typ = constructor || function(getter, setter, target) {
this.$get = getter;
this.$set = setter;
this.$target = target;
this.$val = this;
};
typ.keyFor = $idKey;
typ.init = function(elem) {
typ.elem = elem;
typ.wrapped = (elem.kind === $kindArray);
typ.nil = new typ($throwNilPointerError, $throwNilPointerError);
};
break;
case $kindSlice:
typ = function(array) {
if (array.constructor !== typ.nativeArray) {
array = new typ.nativeArray(array);
}
this.$array = array;
this.$offset = 0;
this.$length = array.length;
this.$capacity = array.length;
this.$val = this;
};
typ.init = function(elem) {
typ.elem = elem;
typ.comparable = false;
typ.nativeArray = $nativeArray(elem.kind);
typ.nil = new typ([]);
};
break;
case $kindStruct:
typ = function(v) { this.$val = v; };
typ.wrapped = true;
typ.ptr = $newType(4, $kindPtr, "*" + string, false, pkg, exported, constructor);
typ.ptr.elem = typ;
typ.ptr.prototype.$get = function() { return this; };
typ.ptr.prototype.$set = function(v) { typ.copy(this, v); };
typ.init = function(pkgPath, fields) {
typ.pkgPath = pkgPath;
typ.fields = fields;
fields.forEach(function(f) {
if (!f.typ.comparable) {
typ.comparable = false;
}
});
typ.keyFor = function(x) {
var val = x.$val;
return $mapArray(fields, function(f) {
return String(f.typ.keyFor(val[f.prop])).replace(/\\/g, "\\\\").replace(/\$/g, "\\$");
}).join("$");
};
typ.copy = function(dst, src) {
for (var i = 0; i < fields.length; i++) {
var f = fields[i];
switch (f.typ.kind) {
case $kindArray:
case $kindStruct:
f.typ.copy(dst[f.prop], src[f.prop]);
continue;
default:
dst[f.prop] = src[f.prop];
continue;
}
}
};
/* nil value */
var properties = {};
fields.forEach(function(f) {
properties[f.prop] = { get: $throwNilPointerError, set: $throwNilPointerError };
});
typ.ptr.nil = Object.create(constructor.prototype, properties);
typ.ptr.nil.$val = typ.ptr.nil;
/* methods for embedded fields */
$addMethodSynthesizer(function() {
var synthesizeMethod = function(target, m, f) {
if (target.prototype[m.prop] !== undefined) { return; }
target.prototype[m.prop] = function() {
var v = this.$val[f.prop];
if (f.typ === $jsObjectPtr) {
v = new $jsObjectPtr(v);
}
if (v.$val === undefined) {
v = new f.typ(v);
}
return v[m.prop].apply(v, arguments);
};
};
fields.forEach(function(f) {
if (f.anonymous) {
$methodSet(f.typ).forEach(function(m) {
synthesizeMethod(typ, m, f);
synthesizeMethod(typ.ptr, m, f);
});
$methodSet($ptrType(f.typ)).forEach(function(m) {
synthesizeMethod(typ.ptr, m, f);
});
}
});
});
};
break;
default:
$panic(new $String("invalid kind: " + kind));
}
switch (kind) {
case $kindBool:
case $kindMap:
typ.zero = function() { return false; };
break;
case $kindInt:
case $kindInt8:
case $kindInt16:
case $kindInt32:
case $kindUint:
case $kindUint8 :
case $kindUint16:
case $kindUint32:
case $kindUintptr:
case $kindUnsafePointer:
case $kindFloat32:
case $kindFloat64:
typ.zero = function() { return 0; };
break;
case $kindString:
typ.zero = function() { return ""; };
break;
case $kindInt64:
case $kindUint64:
case $kindComplex64:
case $kindComplex128:
var zero = new typ(0, 0);
typ.zero = function() { return zero; };
break;
case $kindPtr:
case $kindSlice:
typ.zero = function() { return typ.nil; };
break;
case $kindChan:
typ.zero = function() { return $chanNil; };
break;
case $kindFunc:
typ.zero = function() { return $throwNilPointerError; };
break;
case $kindInterface:
typ.zero = function() { return $ifaceNil; };
break;
case $kindArray:
typ.zero = function() {
var arrayClass = $nativeArray(typ.elem.kind);
if (arrayClass !== Array) {
return new arrayClass(typ.len);
}
var array = new Array(typ.len);
for (var i = 0; i < typ.len; i++) {
array[i] = typ.elem.zero();
}
return array;
};
break;
case $kindStruct:
typ.zero = function() { return new typ.ptr(); };
break;
default:
$panic(new $String("invalid kind: " + kind));
}
typ.id = $typeIDCounter;
$typeIDCounter++;
typ.size = size;
typ.kind = kind;
typ.string = string;
typ.named = named;
typ.pkg = pkg;
typ.exported = exported;
typ.methods = [];
typ.methodSetCache = null;
typ.comparable = true;
return typ;
};
var $methodSet = function(typ) {
if (typ.methodSetCache !== null) {
return typ.methodSetCache;
}
var base = {};
var isPtr = (typ.kind === $kindPtr);
if (isPtr && typ.elem.kind === $kindInterface) {
typ.methodSetCache = [];
return [];
}
var current = [{typ: isPtr ? typ.elem : typ, indirect: isPtr}];
var seen = {};
while (current.length > 0) {
var next = [];
var mset = [];
current.forEach(function(e) {
if (seen[e.typ.string]) {
return;
}
seen[e.typ.string] = true;
if (e.typ.named) {
mset = mset.concat(e.typ.methods);
if (e.indirect) {
mset = mset.concat($ptrType(e.typ).methods);
}
}
switch (e.typ.kind) {
case $kindStruct:
e.typ.fields.forEach(function(f) {
if (f.anonymous) {
var fTyp = f.typ;
var fIsPtr = (fTyp.kind === $kindPtr);
next.push({typ: fIsPtr ? fTyp.elem : fTyp, indirect: e.indirect || fIsPtr});
}
});
break;
case $kindInterface:
mset = mset.concat(e.typ.methods);
break;
}
});
mset.forEach(function(m) {
if (base[m.name] === undefined) {
base[m.name] = m;
}
});
current = next;
}
typ.methodSetCache = [];
Object.keys(base).sort().forEach(function(name) {
typ.methodSetCache.push(base[name]);
});
return typ.methodSetCache;
};
var $Bool = $newType( 1, $kindBool, "bool", true, "", false, null);
var $Int = $newType( 4, $kindInt, "int", true, "", false, null);
var $Int8 = $newType( 1, $kindInt8, "int8", true, "", false, null);
var $Int16 = $newType( 2, $kindInt16, "int16", true, "", false, null);
var $Int32 = $newType( 4, $kindInt32, "int32", true, "", false, null);
var $Int64 = $newType( 8, $kindInt64, "int64", true, "", false, null);
var $Uint = $newType( 4, $kindUint, "uint", true, "", false, null);
var $Uint8 = $newType( 1, $kindUint8, "uint8", true, "", false, null);
var $Uint16 = $newType( 2, $kindUint16, "uint16", true, "", false, null);
var $Uint32 = $newType( 4, $kindUint32, "uint32", true, "", false, null);
var $Uint64 = $newType( 8, $kindUint64, "uint64", true, "", false, null);
var $Uintptr = $newType( 4, $kindUintptr, "uintptr", true, "", false, null);
var $Float32 = $newType( 4, $kindFloat32, "float32", true, "", false, null);
var $Float64 = $newType( 8, $kindFloat64, "float64", true, "", false, null);
var $Complex64 = $newType( 8, $kindComplex64, "complex64", true, "", false, null);
var $Complex128 = $newType(16, $kindComplex128, "complex128", true, "", false, null);
var $String = $newType( 8, $kindString, "string", true, "", false, null);
var $UnsafePointer = $newType( 4, $kindUnsafePointer, "unsafe.Pointer", true, "", false, null);
var $nativeArray = function(elemKind) {
switch (elemKind) {
case $kindInt:
return Int32Array;
case $kindInt8:
return Int8Array;
case $kindInt16:
return Int16Array;
case $kindInt32:
return Int32Array;
case $kindUint:
return Uint32Array;
case $kindUint8:
return Uint8Array;
case $kindUint16:
return Uint16Array;
case $kindUint32:
return Uint32Array;
case $kindUintptr:
return Uint32Array;
case $kindFloat32:
return Float32Array;
case $kindFloat64:
return Float64Array;
default:
return Array;
}
};
var $toNativeArray = function(elemKind, array) {
var nativeArray = $nativeArray(elemKind);
if (nativeArray === Array) {
return array;
}
return new nativeArray(array);
};
var $arrayTypes = {};
var $arrayType = function(elem, len) {
var typeKey = elem.id + "$" + len;
var typ = $arrayTypes[typeKey];
if (typ === undefined) {
typ = $newType(12, $kindArray, "[" + len + "]" + elem.string, false, "", false, null);
$arrayTypes[typeKey] = typ;
typ.init(elem, len);
}
return typ;
};
var $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 = $newType(4, $kindChan, string, false, "", false, null);
elem[field] = typ;
typ.init(elem, sendOnly, recvOnly);
}
return typ;
};
var $Chan = function(elem, capacity) {
if (capacity < 0 || capacity > 2147483647) {
$throwRuntimeError("makechan: size out of range");
}
this.$elem = elem;
this.$capacity = capacity;
this.$buffer = [];
this.$sendQueue = [];
this.$recvQueue = [];
this.$closed = false;
};
var $chanNil = new $Chan(null, 0);
$chanNil.$sendQueue = $chanNil.$recvQueue = { length: 0, push: function() {}, shift: function() { return undefined; }, indexOf: function() { return -1; } };
var $funcTypes = {};
var $funcType = function(params, results, variadic) {
var typeKey = $mapArray(params, function(p) { return p.id; }).join(",") + "$" + $mapArray(results, function(r) { return r.id; }).join(",") + "$" + variadic;
var typ = $funcTypes[typeKey];
if (typ === undefined) {
var paramTypes = $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 += " (" + $mapArray(results, function(r) { return r.string; }).join(", ") + ")";
}
typ = $newType(4, $kindFunc, string, false, "", false, null);
$funcTypes[typeKey] = typ;
typ.init(params, results, variadic);
}
return typ;
};
var $interfaceTypes = {};
var $interfaceType = function(methods) {
var typeKey = $mapArray(methods, function(m) { return m.pkg + "," + m.name + "," + m.typ.id; }).join("$");
var typ = $interfaceTypes[typeKey];
if (typ === undefined) {
var string = "interface {}";
if (methods.length !== 0) {
string = "interface { " + $mapArray(methods, function(m) {
return (m.pkg !== "" ? m.pkg + "." : "") + m.name + m.typ.string.substr(4);
}).join("; ") + " }";
}
typ = $newType(8, $kindInterface, string, false, "", false, null);
$interfaceTypes[typeKey] = typ;
typ.init(methods);
}
return typ;
};
var $emptyInterface = $interfaceType([]);
var $ifaceNil = {};
var $error = $newType(8, $kindInterface, "error", true, "", false, null);
$error.init([{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}]);
var $mapTypes = {};
var $mapType = function(key, elem) {
var typeKey = key.id + "$" + elem.id;
var typ = $mapTypes[typeKey];
if (typ === undefined) {
typ = $newType(4, $kindMap, "map[" + key.string + "]" + elem.string, false, "", false, null);
$mapTypes[typeKey] = typ;
typ.init(key, elem);
}
return typ;
};
var $makeMap = function(keyForFunc, entries) {
var m = {};
for (var i = 0; i < entries.length; i++) {
var e = entries[i];
m[keyForFunc(e.k)] = e;
}
return m;
};
var $ptrType = function(elem) {
var typ = elem.ptr;
if (typ === undefined) {
typ = $newType(4, $kindPtr, "*" + elem.string, false, "", elem.exported, null);
elem.ptr = typ;
typ.init(elem);
}
return typ;
};
var $newDataPointer = function(data, constructor) {
if (constructor.elem.kind === $kindStruct) {
return data;
}
return new constructor(function() { return data; }, function(v) { data = v; });
};
var $indexPtr = function(array, index, constructor) {
array.$ptr = array.$ptr || {};
return array.$ptr[index] || (array.$ptr[index] = new constructor(function() { return array[index]; }, function(v) { array[index] = v; }));
};
var $sliceType = function(elem) {
var typ = elem.slice;
if (typ === undefined) {
typ = $newType(12, $kindSlice, "[]" + elem.string, false, "", false, null);
elem.slice = typ;
typ.init(elem);
}
return typ;
};
var $makeSlice = function(typ, length, capacity) {
capacity = capacity || length;
if (length < 0 || length > 2147483647) {
$throwRuntimeError("makeslice: len out of range");
}
if (capacity < 0 || capacity < length || capacity > 2147483647) {
$throwRuntimeError("makeslice: cap out of range");
}
var array = new typ.nativeArray(capacity);
if (typ.nativeArray === Array) {
for (var i = 0; i < capacity; i++) {
array[i] = typ.elem.zero();
}
}
var slice = new typ(array);
slice.$length = length;
return slice;
};
var $structTypes = {};
var $structType = function(pkgPath, fields) {
var typeKey = $mapArray(fields, function(f) { return f.name + "," + f.typ.id + "," + f.tag; }).join("$");
var typ = $structTypes[typeKey];
if (typ === undefined) {
var string = "struct { " + $mapArray(fields, function(f) {
return f.name + " " + f.typ.string + (f.tag !== "" ? (" \"" + f.tag.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\"") : "");
}).join("; ") + " }";
if (fields.length === 0) {
string = "struct {}";
}
typ = $newType(0, $kindStruct, string, false, "", false, function() {
this.$val = this;
for (var i = 0; i < fields.length; i++) {
var f = fields[i];
var arg = arguments[i];
this[f.prop] = arg !== undefined ? arg : f.typ.zero();
}
});
$structTypes[typeKey] = typ;
typ.init(pkgPath, fields);
}
return typ;
};
var $assertType = function(value, type, returnTuple) {
var isInterface = (type.kind === $kindInterface), ok, missingMethod = "";
if (value === $ifaceNil) {
ok = false;
} else if (!isInterface) {
ok = value.constructor === type;
} else {
var valueTypeString = value.constructor.string;
ok = type.implementedBy[valueTypeString];
if (ok === undefined) {
ok = true;
var valueMethodSet = $methodSet(value.constructor);
var interfaceMethods = type.methods;
for (var i = 0; i < interfaceMethods.length; i++) {
var tm = interfaceMethods[i];
var found = false;
for (var j = 0; j < valueMethodSet.length; j++) {
var vm = valueMethodSet[j];
if (vm.name === tm.name && vm.pkg === tm.pkg && vm.typ === tm.typ) {
found = true;
break;
}
}
if (!found) {
ok = false;
type.missingMethodFor[valueTypeString] = tm.name;
break;
}
}
type.implementedBy[valueTypeString] = ok;
}
if (!ok) {
missingMethod = type.missingMethodFor[valueTypeString];
}
}
if (!ok) {
if (returnTuple) {
return [type.zero(), false];
}
$panic(new $packages["runtime"].TypeAssertionError.ptr("", (value === $ifaceNil ? "" : value.constructor.string), type.string, missingMethod));
}
if (!isInterface) {
value = value.$val;
}
if (type === $jsObjectPtr) {
value = value.object;
}
return returnTuple ? [value, true] : value;
};
var $stackDepthOffset = 0;
var $getStackDepth = function() {
var err = new Error();
if (err.stack === undefined) {
return undefined;
}
return $stackDepthOffset + err.stack.split("\n").length;
};
var $panicStackDepth = null, $panicValue;
var $callDeferred = function(deferred, jsErr, fromPanic) {
if (!fromPanic && deferred !== null && deferred.index >= $curGoroutine.deferStack.length) {
throw jsErr;
}
if (jsErr !== null) {
var newErr = null;
try {
$curGoroutine.deferStack.push(deferred);
$panic(new $jsErrorPtr(jsErr));
} catch (err) {
newErr = err;
}
$curGoroutine.deferStack.pop();
$callDeferred(deferred, newErr);
return;
}
if ($curGoroutine.asleep) {
return;
}
$stackDepthOffset--;
var outerPanicStackDepth = $panicStackDepth;
var outerPanicValue = $panicValue;
var localPanicValue = $curGoroutine.panicStack.pop();
if (localPanicValue !== undefined) {
$panicStackDepth = $getStackDepth();
$panicValue = localPanicValue;
}
try {
while (true) {
if (deferred === null) {
deferred = $curGoroutine.deferStack[$curGoroutine.deferStack.length - 1];
if (deferred === undefined) {
/* The panic reached the top of the stack. Clear it and throw it as a JavaScript error. */
$panicStackDepth = null;
if (localPanicValue.Object instanceof Error) {
throw localPanicValue.Object;
}
var msg;
if (localPanicValue.constructor === $String) {
msg = localPanicValue.$val;
} else if (localPanicValue.Error !== undefined) {
msg = localPanicValue.Error();
} else if (localPanicValue.String !== undefined) {
msg = localPanicValue.String();
} else {
msg = localPanicValue;
}
throw new Error(msg);
}
}
var call = deferred.pop();
if (call === undefined) {
$curGoroutine.deferStack.pop();
if (localPanicValue !== undefined) {
deferred = null;
continue;
}
return;
}
var r = call[0].apply(call[2], call[1]);
if (r && r.$blk !== undefined) {
deferred.push([r.$blk, [], r]);
if (fromPanic) {
throw null;
}
return;
}
if (localPanicValue !== undefined && $panicStackDepth === null) {
throw null; /* error was recovered */
}
}
} finally {
if (localPanicValue !== undefined) {
if ($panicStackDepth !== null) {
$curGoroutine.panicStack.push(localPanicValue);
}
$panicStackDepth = outerPanicStackDepth;
$panicValue = outerPanicValue;
}
$stackDepthOffset++;
}
};
var $panic = function(value) {
$curGoroutine.panicStack.push(value);
$callDeferred(null, null, true);
};
var $recover = function() {
if ($panicStackDepth === null || ($panicStackDepth !== undefined && $panicStackDepth !== $getStackDepth() - 2)) {
return $ifaceNil;
}
$panicStackDepth = null;
return $panicValue;
};
var $throw = function(err) { throw err; };
var $noGoroutine = { asleep: false, exit: false, deferStack: [], panicStack: [] };
var $curGoroutine = $noGoroutine, $totalGoroutines = 0, $awakeGoroutines = 0, $checkForDeadlock = true;
var $mainFinished = false;
var $go = function(fun, args) {
$totalGoroutines++;
$awakeGoroutines++;
var $goroutine = function() {
try {
$curGoroutine = $goroutine;
var r = fun.apply(undefined, args);
if (r && r.$blk !== undefined) {
fun = function() { return r.$blk(); };
args = [];
return;
}
$goroutine.exit = true;
} catch (err) {
if (!$goroutine.exit) {
throw err;
}
} finally {
$curGoroutine = $noGoroutine;
if ($goroutine.exit) { /* also set by runtime.Goexit() */
$totalGoroutines--;
$goroutine.asleep = true;
}
if ($goroutine.asleep) {
$awakeGoroutines--;
if (!$mainFinished && $awakeGoroutines === 0 && $checkForDeadlock) {
console.error("fatal error: all goroutines are asleep - deadlock!");
if ($global.process !== undefined) {
$global.process.exit(2);
}
}
}
}
};
$goroutine.asleep = false;
$goroutine.exit = false;
$goroutine.deferStack = [];
$goroutine.panicStack = [];
$schedule($goroutine);
};
var $scheduled = [];
var $runScheduled = function() {
try {
var r;
while ((r = $scheduled.shift()) !== undefined) {
r();
}
} finally {
if ($scheduled.length > 0) {
setTimeout($runScheduled, 0);
}
}
};
var $schedule = function(goroutine) {
if (goroutine.asleep) {
goroutine.asleep = false;
$awakeGoroutines++;
}
$scheduled.push(goroutine);
if ($curGoroutine === $noGoroutine) {
$runScheduled();
}
};
var $setTimeout = function(f, t) {
$awakeGoroutines++;
return setTimeout(function() {
$awakeGoroutines--;
f();
}, t);
};
var $block = function() {
if ($curGoroutine === $noGoroutine) {
$throwRuntimeError("cannot block in JavaScript callback, fix by wrapping code in goroutine");
}
$curGoroutine.asleep = true;
};
var $send = function(chan, value) {
if (chan.$closed) {
$throwRuntimeError("send on closed channel");
}
var queuedRecv = chan.$recvQueue.shift();
if (queuedRecv !== undefined) {
queuedRecv([value, true]);
return;
}
if (chan.$buffer.length < chan.$capacity) {
chan.$buffer.push(value);
return;
}
var thisGoroutine = $curGoroutine;
var closedDuringSend;
chan.$sendQueue.push(function(closed) {
closedDuringSend = closed;
$schedule(thisGoroutine);
return value;
});
$block();
return {
$blk: function() {
if (closedDuringSend) {
$throwRuntimeError("send on closed channel");
}
}
};
};
var $recv = function(chan) {
var queuedSend = chan.$sendQueue.shift();
if (queuedSend !== undefined) {
chan.$buffer.push(queuedSend(false));
}
var bufferedValue = chan.$buffer.shift();
if (bufferedValue !== undefined) {
return [bufferedValue, true];
}
if (chan.$closed) {
return [chan.$elem.zero(), false];
}
var thisGoroutine = $curGoroutine;
var f = { $blk: function() { return this.value; } };
var queueEntry = function(v) {
f.value = v;
$schedule(thisGoroutine);
};
chan.$recvQueue.push(queueEntry);
$block();
return f;
};
var $close = function(chan) {
if (chan.$closed) {
$throwRuntimeError("close of closed channel");
}
chan.$closed = true;
while (true) {
var queuedSend = chan.$sendQueue.shift();
if (queuedSend === undefined) {
break;
}
queuedSend(true); /* will panic */
}
while (true) {
var queuedRecv = chan.$recvQueue.shift();
if (queuedRecv === undefined) {
break;
}
queuedRecv([chan.$elem.zero(), false]);
}
};
var $select = function(comms) {
var ready = [];
var selection = -1;
for (var i = 0; i < comms.length; i++) {
var comm = comms[i];
var chan = comm[0];
switch (comm.length) {
case 0: /* default */
selection = i;
break;
case 1: /* recv */
if (chan.$sendQueue.length !== 0 || chan.$buffer.length !== 0 || chan.$closed) {
ready.push(i);
}
break;
case 2: /* send */
if (chan.$closed) {
$throwRuntimeError("send on closed channel");
}
if (chan.$recvQueue.length !== 0 || chan.$buffer.length < chan.$capacity) {
ready.push(i);
}
break;
}
}
if (ready.length !== 0) {
selection = ready[Math.floor(Math.random() * ready.length)];
}
if (selection !== -1) {
var comm = comms[selection];
switch (comm.length) {
case 0: /* default */
return [selection];
case 1: /* recv */
return [selection, $recv(comm[0])];
case 2: /* send */
$send(comm[0], comm[1]);
return [selection];
}
}
var entries = [];
var thisGoroutine = $curGoroutine;
var f = { $blk: function() { return this.selection; } };
var removeFromQueues = function() {
for (var i = 0; i < entries.length; i++) {
var entry = entries[i];
var queue = entry[0];
var index = queue.indexOf(entry[1]);
if (index !== -1) {
queue.splice(index, 1);
}
}
};
for (var i = 0; i < comms.length; i++) {
(function(i) {
var comm = comms[i];
switch (comm.length) {
case 1: /* recv */
var queueEntry = function(value) {
f.selection = [i, value];
removeFromQueues();
$schedule(thisGoroutine);
};
entries.push([comm[0].$recvQueue, queueEntry]);
comm[0].$recvQueue.push(queueEntry);
break;
case 2: /* send */
var queueEntry = function() {
if (comm[0].$closed) {
$throwRuntimeError("send on closed channel");
}
f.selection = [i];
removeFromQueues();
$schedule(thisGoroutine);
return comm[1];
};
entries.push([comm[0].$sendQueue, queueEntry]);
comm[0].$sendQueue.push(queueEntry);
break;
}
})(i);
}
$block();
return f;
};
var $jsObjectPtr, $jsErrorPtr;
var $needsExternalization = function(t) {
switch (t.kind) {
case $kindBool:
case $kindInt:
case $kindInt8:
case $kindInt16:
case $kindInt32:
case $kindUint:
case $kindUint8:
case $kindUint16:
case $kindUint32:
case $kindUintptr:
case $kindFloat32:
case $kindFloat64:
return false;
default:
return t !== $jsObjectPtr;
}
};
var $externalize = function(v, t) {
if (t === $jsObjectPtr) {
return v;
}
switch (t.kind) {
case $kindBool:
case $kindInt:
case $kindInt8:
case $kindInt16:
case $kindInt32:
case $kindUint:
case $kindUint8:
case $kindUint16:
case $kindUint32:
case $kindUintptr:
case $kindFloat32:
case $kindFloat64:
return v;
case $kindInt64:
case $kindUint64:
return $flatten64(v);
case $kindArray:
if ($needsExternalization(t.elem)) {
return $mapArray(v, function(e) { return $externalize(e, t.elem); });
}
return v;
case $kindFunc:
return $externalizeFunction(v, t, false);
case $kindInterface:
if (v === $ifaceNil) {
return null;
}
if (v.constructor === $jsObjectPtr) {
return v.$val.object;
}
return $externalize(v.$val, v.constructor);
case $kindMap:
var m = {};
var keys = $keys(v);
for (var i = 0; i < keys.length; i++) {
var entry = v[keys[i]];
m[$externalize(entry.k, t.key)] = $externalize(entry.v, t.elem);
}
return m;
case $kindPtr:
if (v === t.nil) {
return null;
}
return $externalize(v.$get(), t.elem);
case $kindSlice:
if ($needsExternalization(t.elem)) {
return $mapArray($sliceToArray(v), function(e) { return $externalize(e, t.elem); });
}
return $sliceToArray(v);
case $kindString:
if ($isASCII(v)) {
return v;
}
var s = "", r;
for (var i = 0; i < v.length; i += r[1]) {
r = $decodeRune(v, i);
var c = r[0];
if (c > 0xFFFF) {
var h = Math.floor((c - 0x10000) / 0x400) + 0xD800;
var l = (c - 0x10000) % 0x400 + 0xDC00;
s += String.fromCharCode(h, l);
continue;
}
s += String.fromCharCode(c);
}
return s;
case $kindStruct:
var timePkg = $packages["time"];
if (timePkg !== undefined && v.constructor === timePkg.Time.ptr) {
var milli = $div64(v.UnixNano(), new $Int64(0, 1000000));
return new Date($flatten64(milli));
}
var noJsObject = {};
var searchJsObject = function(v, t) {
if (t === $jsObjectPtr) {
return v;
}
switch (t.kind) {
case $kindPtr:
if (v === t.nil) {
return noJsObject;
}
return searchJsObject(v.$get(), t.elem);
case $kindStruct:
var f = t.fields[0];
return searchJsObject(v[f.prop], f.typ);
case $kindInterface:
return searchJsObject(v.$val, v.constructor);
default:
return noJsObject;
}
};
var o = searchJsObject(v, t);
if (o !== noJsObject) {
return o;
}
o = {};
for (var i = 0; i < t.fields.length; i++) {
var f = t.fields[i];
if (!f.exported) {
continue;
}
o[f.name] = $externalize(v[f.prop], f.typ);
}
return o;
}
$throwRuntimeError("cannot externalize " + t.string);
};
var $externalizeFunction = function(v, t, passThis) {
if (v === $throwNilPointerError) {
return null;
}
if (v.$externalizeWrapper === undefined) {
$checkForDeadlock = false;
v.$externalizeWrapper = function() {
var args = [];
for (var i = 0; i < t.params.length; i++) {
if (t.variadic && i === t.params.length - 1) {
var vt = t.params[i].elem, varargs = [];
for (var j = i; j < arguments.length; j++) {
varargs.push($internalize(arguments[j], vt));
}
args.push(new (t.params[i])(varargs));
break;
}
args.push($internalize(arguments[i], t.params[i]));
}
var result = v.apply(passThis ? this : undefined, args);
switch (t.results.length) {
case 0:
return;
case 1:
return $externalize(result, t.results[0]);
default:
for (var i = 0; i < t.results.length; i++) {
result[i] = $externalize(result[i], t.results[i]);
}
return result;
}
};
}
return v.$externalizeWrapper;
};
var $internalize = function(v, t, recv) {
if (t === $jsObjectPtr) {
return v;
}
if (t === $jsObjectPtr.elem) {
$throwRuntimeError("cannot internalize js.Object, use *js.Object instead");
}
if (v && v.__internal_object__ !== undefined) {
return $assertType(v.__internal_object__, t, false);
}
var timePkg = $packages["time"];
if (timePkg !== undefined && t === timePkg.Time) {
if (!(v !== null && v !== undefined && v.constructor === Date)) {
$throwRuntimeError("cannot internalize time.Time from " + typeof v + ", must be Date");
}
return timePkg.Unix(new $Int64(0, 0), new $Int64(0, v.getTime() * 1000000));
}
switch (t.kind) {
case $kindBool:
return !!v;
case $kindInt:
return parseInt(v);
case $kindInt8:
return parseInt(v) << 24 >> 24;
case $kindInt16:
return parseInt(v) << 16 >> 16;
case $kindInt32:
return parseInt(v) >> 0;
case $kindUint:
return parseInt(v);
case $kindUint8:
return parseInt(v) << 24 >>> 24;
case $kindUint16:
return parseInt(v) << 16 >>> 16;
case $kindUint32:
case $kindUintptr:
return parseInt(v) >>> 0;
case $kindInt64:
case $kindUint64:
return new t(0, v);
case $kindFloat32:
case $kindFloat64:
return parseFloat(v);
case $kindArray:
if (v.length !== t.len) {
$throwRuntimeError("got array with wrong size from JavaScript native");
}
return $mapArray(v, function(e) { return $internalize(e, t.elem); });
case $kindFunc:
return function() {
var args = [];
for (var i = 0; i < t.params.length; i++) {
if (t.variadic && i === t.params.length - 1) {
var vt = t.params[i].elem, varargs = arguments[i];
for (var j = 0; j < varargs.$length; j++) {
args.push($externalize(varargs.$array[varargs.$offset + j], vt));
}
break;
}
args.push($externalize(arguments[i], t.params[i]));
}
var result = v.apply(recv, args);
switch (t.results.length) {
case 0:
return;
case 1:
return $internalize(result, t.results[0]);
default:
for (var i = 0; i < t.results.length; i++) {
result[i] = $internalize(result[i], t.results[i]);
}
return result;
}
};
case $kindInterface:
if (t.methods.length !== 0) {
$throwRuntimeError("cannot internalize " + t.string);
}
if (v === null) {
return $ifaceNil;
}
if (v === undefined) {
return new $jsObjectPtr(undefined);
}
switch (v.constructor) {
case Int8Array:
return new ($sliceType($Int8))(v);
case Int16Array:
return new ($sliceType($Int16))(v);
case Int32Array:
return new ($sliceType($Int))(v);
case Uint8Array:
return new ($sliceType($Uint8))(v);
case Uint16Array:
return new ($sliceType($Uint16))(v);
case Uint32Array:
return new ($sliceType($Uint))(v);
case Float32Array:
return new ($sliceType($Float32))(v);
case Float64Array:
return new ($sliceType($Float64))(v);
case Array:
return $internalize(v, $sliceType($emptyInterface));
case Boolean:
return new $Bool(!!v);
case Date:
if (timePkg === undefined) {
/* time package is not present, internalize as &js.Object{Date} so it can be externalized into original Date. */
return new $jsObjectPtr(v);
}
return new timePkg.Time($internalize(v, timePkg.Time));
case Function:
var funcType = $funcType([$sliceType($emptyInterface)], [$jsObjectPtr], true);
return new funcType($internalize(v, funcType));
case Number:
return new $Float64(parseFloat(v));
case String:
return new $String($internalize(v, $String));
default:
if ($global.Node && v instanceof $global.Node) {
return new $jsObjectPtr(v);
}
var mapType = $mapType($String, $emptyInterface);
return new mapType($internalize(v, mapType));
}
case $kindMap:
var m = {};
var keys = $keys(v);
for (var i = 0; i < keys.length; i++) {
var k = $internalize(keys[i], t.key);
m[t.key.keyFor(k)] = { k: k, v: $internalize(v[keys[i]], t.elem) };
}
return m;
case $kindPtr:
if (t.elem.kind === $kindStruct) {
return $internalize(v, t.elem);
}
case $kindSlice:
return new t($mapArray(v, function(e) { return $internalize(e, t.elem); }));
case $kindString:
v = String(v);
if ($isASCII(v)) {
return v;
}
var s = "";
var i = 0;
while (i < v.length) {
var h = v.charCodeAt(i);
if (0xD800 <= h && h <= 0xDBFF) {
var l = v.charCodeAt(i + 1);
var c = (h - 0xD800) * 0x400 + l - 0xDC00 + 0x10000;
s += $encodeRune(c);
i += 2;
continue;
}
s += $encodeRune(h);
i++;
}
return s;
case $kindStruct:
var noJsObject = {};
var searchJsObject = function(t) {
if (t === $jsObjectPtr) {
return v;
}
if (t === $jsObjectPtr.elem) {
$throwRuntimeError("cannot internalize js.Object, use *js.Object instead");
}
switch (t.kind) {
case $kindPtr:
return searchJsObject(t.elem);
case $kindStruct:
var f = t.fields[0];
var o = searchJsObject(f.typ);
if (o !== noJsObject) {
var n = new t.ptr();
n[f.prop] = o;
return n;
}
return noJsObject;
default:
return noJsObject;
}
};
var o = searchJsObject(t);
if (o !== noJsObject) {
return o;
}
}
$throwRuntimeError("cannot internalize " + t.string);
};
/* $isASCII reports whether string s contains only ASCII characters. */
var $isASCII = function(s) {
for (var i = 0; i < s.length; i++) {
if (s.charCodeAt(i) >= 128) {
return false;
}
}
return true;
};
$packages["github.com/gopherjs/gopherjs/js"] = (function() {
var $pkg = {}, $init, Object, Error, sliceType, ptrType, ptrType$1, MakeFunc, init;
Object = $pkg.Object = $newType(0, $kindStruct, "js.Object", true, "github.com/gopherjs/gopherjs/js", true, function(object_) {
this.$val = this;
if (arguments.length === 0) {
this.object = null;
return;
}
this.object = object_;
});
Error = $pkg.Error = $newType(0, $kindStruct, "js.Error", true, "github.com/gopherjs/gopherjs/js", true, function(Object_) {
this.$val = this;
if (arguments.length === 0) {
this.Object = null;
return;
}
this.Object = Object_;
});
sliceType = $sliceType($emptyInterface);
ptrType = $ptrType(Object);
ptrType$1 = $ptrType(Error);
Object.ptr.prototype.Get = function(key) {
var key, o;
o = this;
return o.object[$externalize(key, $String)];
};
Object.prototype.Get = function(key) { return this.$val.Get(key); };
Object.ptr.prototype.Set = function(key, value) {
var key, o, value;
o = this;
o.object[$externalize(key, $String)] = $externalize(value, $emptyInterface);
};
Object.prototype.Set = function(key, value) { return this.$val.Set(key, value); };
Object.ptr.prototype.Delete = function(key) {
var key, o;
o = this;
delete o.object[$externalize(key, $String)];
};
Object.prototype.Delete = function(key) { return this.$val.Delete(key); };
Object.ptr.prototype.Length = function() {
var o;
o = this;
return $parseInt(o.object.length);
};
Object.prototype.Length = function() { return this.$val.Length(); };
Object.ptr.prototype.Index = function(i) {
var i, o;
o = this;
return o.object[i];
};
Object.prototype.Index = function(i) { return this.$val.Index(i); };
Object.ptr.prototype.SetIndex = function(i, value) {
var i, o, value;
o = this;
o.object[i] = $externalize(value, $emptyInterface);
};
Object.prototype.SetIndex = function(i, value) { return this.$val.SetIndex(i, value); };
Object.ptr.prototype.Call = function(name, args) {
var args, name, o, obj;
o = this;
return (obj = o.object, obj[$externalize(name, $String)].apply(obj, $externalize(args, sliceType)));
};
Object.prototype.Call = function(name, args) { return this.$val.Call(name, args); };
Object.ptr.prototype.Invoke = function(args) {
var args, o;
o = this;
return o.object.apply(undefined, $externalize(args, sliceType));
};
Object.prototype.Invoke = function(args) { return this.$val.Invoke(args); };
Object.ptr.prototype.New = function(args) {
var args, o;
o = this;
return new ($global.Function.prototype.bind.apply(o.object, [undefined].concat($externalize(args, sliceType))));
};
Object.prototype.New = function(args) { return this.$val.New(args); };
Object.ptr.prototype.Bool = function() {
var o;
o = this;
return !!(o.object);
};
Object.prototype.Bool = function() { return this.$val.Bool(); };
Object.ptr.prototype.String = function() {
var o;
o = this;
return $internalize(o.object, $String);
};
Object.prototype.String = function() { return this.$val.String(); };
Object.ptr.prototype.Int = function() {
var o;
o = this;
return $parseInt(o.object) >> 0;
};
Object.prototype.Int = function() { return this.$val.Int(); };
Object.ptr.prototype.Int64 = function() {
var o;
o = this;
return $internalize(o.object, $Int64);
};
Object.prototype.Int64 = function() { return this.$val.Int64(); };
Object.ptr.prototype.Uint64 = function() {
var o;
o = this;
return $internalize(o.object, $Uint64);
};
Object.prototype.Uint64 = function() { return this.$val.Uint64(); };
Object.ptr.prototype.Float = function() {
var o;
o = this;
return $parseFloat(o.object);
};
Object.prototype.Float = function() { return this.$val.Float(); };
Object.ptr.prototype.Interface = function() {
var o;
o = this;
return $internalize(o.object, $emptyInterface);
};
Object.prototype.Interface = function() { return this.$val.Interface(); };
Object.ptr.prototype.Unsafe = function() {
var o;
o = this;
return o.object;
};
Object.prototype.Unsafe = function() { return this.$val.Unsafe(); };
Error.ptr.prototype.Error = function() {
var err;
err = this;
return "JavaScript error: " + $internalize(err.Object.message, $String);
};
Error.prototype.Error = function() { return this.$val.Error(); };
Error.ptr.prototype.Stack = function() {
var err;
err = this;
return $internalize(err.Object.stack, $String);
};
Error.prototype.Stack = function() { return this.$val.Stack(); };
MakeFunc = function(fn) {
var fn;
return $makeFunc(fn);
};
$pkg.MakeFunc = MakeFunc;
init = function() {
var e;
e = new Error.ptr(null);
$unused(e);
};
ptrType.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([$String], [ptrType], false)}, {prop: "Set", name: "Set", pkg: "", typ: $funcType([$String, $emptyInterface], [], false)}, {prop: "Delete", name: "Delete", pkg: "", typ: $funcType([$String], [], false)}, {prop: "Length", name: "Length", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Index", name: "Index", pkg: "", typ: $funcType([$Int], [ptrType], false)}, {prop: "SetIndex", name: "SetIndex", pkg: "", typ: $funcType([$Int, $emptyInterface], [], false)}, {prop: "Call", name: "Call", pkg: "", typ: $funcType([$String, sliceType], [ptrType], true)}, {prop: "Invoke", name: "Invoke", pkg: "", typ: $funcType([sliceType], [ptrType], true)}, {prop: "New", name: "New", pkg: "", typ: $funcType([sliceType], [ptrType], true)}, {prop: "Bool", name: "Bool", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Int", name: "Int", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Int64", name: "Int64", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}, {prop: "Float", name: "Float", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Interface", name: "Interface", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "Unsafe", name: "Unsafe", pkg: "", typ: $funcType([], [$Uintptr], false)}];
ptrType$1.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Stack", name: "Stack", pkg: "", typ: $funcType([], [$String], false)}];
Object.init("github.com/gopherjs/gopherjs/js", [{prop: "object", name: "object", anonymous: false, exported: false, typ: ptrType, tag: ""}]);
Error.init("", [{prop: "Object", name: "Object", anonymous: true, exported: true, typ: ptrType, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
init();
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["runtime/internal/sys"] = (function() {
var $pkg = {}, $init;
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["runtime"] = (function() {
var $pkg = {}, $init, js, sys, TypeAssertionError, errorString, ptrType$4, init, GOROOT, Goexit, SetFinalizer, KeepAlive, throw$1;
js = $packages["github.com/gopherjs/gopherjs/js"];
sys = $packages["runtime/internal/sys"];
TypeAssertionError = $pkg.TypeAssertionError = $newType(0, $kindStruct, "runtime.TypeAssertionError", true, "runtime", true, function(interfaceString_, concreteString_, assertedString_, missingMethod_) {
this.$val = this;
if (arguments.length === 0) {
this.interfaceString = "";
this.concreteString = "";
this.assertedString = "";
this.missingMethod = "";
return;
}
this.interfaceString = interfaceString_;
this.concreteString = concreteString_;
this.assertedString = assertedString_;
this.missingMethod = missingMethod_;
});
errorString = $pkg.errorString = $newType(8, $kindString, "runtime.errorString", true, "runtime", false, null);
ptrType$4 = $ptrType(TypeAssertionError);
init = function() {
var e, jsPkg;
jsPkg = $packages[$externalize("github.com/gopherjs/gopherjs/js", $String)];
$jsObjectPtr = jsPkg.Object.ptr;
$jsErrorPtr = jsPkg.Error.ptr;
$throwRuntimeError = throw$1;
e = $ifaceNil;
e = new TypeAssertionError.ptr("", "", "", "");
$unused(e);
};
GOROOT = function() {
var goroot, process;
process = $global.process;
if (process === undefined) {
return "/";
}
goroot = process.env.GOROOT;
if (!(goroot === undefined)) {
return $internalize(goroot, $String);
}
return "/usr/lib/go-1.9";
};
$pkg.GOROOT = GOROOT;
Goexit = function() {
$curGoroutine.exit = $externalize(true, $Bool);
$throw(null);
};
$pkg.Goexit = Goexit;
SetFinalizer = function(x, f) {
var f, x;
};
$pkg.SetFinalizer = SetFinalizer;
KeepAlive = function(param) {
var param;
};
$pkg.KeepAlive = KeepAlive;
throw$1 = function(s) {
var s;
$panic(new errorString((s)));
};
TypeAssertionError.ptr.prototype.RuntimeError = function() {
};
TypeAssertionError.prototype.RuntimeError = function() { return this.$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.$val.Error(); };
errorString.prototype.RuntimeError = function() {
var e;
e = this.$val;
};
$ptrType(errorString).prototype.RuntimeError = function() { return new errorString(this.$get()).RuntimeError(); };
errorString.prototype.Error = function() {
var e;
e = this.$val;
return "runtime error: " + (e);
};
$ptrType(errorString).prototype.Error = function() { return new errorString(this.$get()).Error(); };
ptrType$4.methods = [{prop: "RuntimeError", name: "RuntimeError", pkg: "", typ: $funcType([], [], false)}, {prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
errorString.methods = [{prop: "RuntimeError", name: "RuntimeError", pkg: "", typ: $funcType([], [], false)}, {prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
TypeAssertionError.init("runtime", [{prop: "interfaceString", name: "interfaceString", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "concreteString", name: "concreteString", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "assertedString", name: "assertedString", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "missingMethod", name: "missingMethod", anonymous: false, exported: false, typ: $String, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = sys.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
init();
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["errors"] = (function() {
var $pkg = {}, $init, errorString, ptrType, New;
errorString = $pkg.errorString = $newType(0, $kindStruct, "errors.errorString", true, "errors", false, function(s_) {
this.$val = this;
if (arguments.length === 0) {
this.s = "";
return;
}
this.s = s_;
});
ptrType = $ptrType(errorString);
New = function(text) {
var text;
return new errorString.ptr(text);
};
$pkg.New = New;
errorString.ptr.prototype.Error = function() {
var e;
e = this;
return e.s;
};
errorString.prototype.Error = function() { return this.$val.Error(); };
ptrType.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
errorString.init("errors", [{prop: "s", name: "s", anonymous: false, exported: false, typ: $String, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["internal/race"] = (function() {
var $pkg = {}, $init, Acquire, Release, ReleaseMerge, ReadRange, WriteRange;
Acquire = function(addr) {
var addr;
};
$pkg.Acquire = Acquire;
Release = function(addr) {
var addr;
};
$pkg.Release = Release;
ReleaseMerge = function(addr) {
var addr;
};
$pkg.ReleaseMerge = ReleaseMerge;
ReadRange = function(addr, len) {
var addr, len;
};
$pkg.ReadRange = ReadRange;
WriteRange = function(addr, len) {
var addr, len;
};
$pkg.WriteRange = WriteRange;
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["sync/atomic"] = (function() {
var $pkg = {}, $init, js, Value, noCopy, ptrType, ptrType$1, CompareAndSwapInt32, CompareAndSwapUint64, CompareAndSwapPointer, AddInt32, LoadUint64, LoadPointer, StorePointer;
js = $packages["github.com/gopherjs/gopherjs/js"];
Value = $pkg.Value = $newType(0, $kindStruct, "atomic.Value", true, "sync/atomic", true, function(noCopy_, v_) {
this.$val = this;
if (arguments.length === 0) {
this.noCopy = new noCopy.ptr();
this.v = $ifaceNil;
return;
}
this.noCopy = noCopy_;
this.v = v_;
});
noCopy = $pkg.noCopy = $newType(0, $kindStruct, "atomic.noCopy", true, "sync/atomic", false, function() {
this.$val = this;
if (arguments.length === 0) {
return;
}
});
ptrType = $ptrType(Value);
ptrType$1 = $ptrType(noCopy);
CompareAndSwapInt32 = function(addr, old, new$1) {
var addr, new$1, old;
if (addr.$get() === old) {
addr.$set(new$1);
return true;
}
return false;
};
$pkg.CompareAndSwapInt32 = CompareAndSwapInt32;
CompareAndSwapUint64 = function(addr, old, new$1) {
var addr, new$1, old, x;
if ((x = addr.$get(), (x.$high === old.$high && x.$low === old.$low))) {
addr.$set(new$1);
return true;
}
return false;
};
$pkg.CompareAndSwapUint64 = CompareAndSwapUint64;
CompareAndSwapPointer = function(addr, old, new$1) {
var addr, new$1, old;
if (addr.$get() === old) {
addr.$set(new$1);
return true;
}
return false;
};
$pkg.CompareAndSwapPointer = CompareAndSwapPointer;
AddInt32 = function(addr, delta) {
var addr, delta, new$1;
new$1 = addr.$get() + delta >> 0;
addr.$set(new$1);
return new$1;
};
$pkg.AddInt32 = AddInt32;
LoadUint64 = function(addr) {
var addr;
return addr.$get();
};
$pkg.LoadUint64 = LoadUint64;
LoadPointer = function(addr) {
var addr;
return addr.$get();
};
$pkg.LoadPointer = LoadPointer;
StorePointer = function(addr, val) {
var addr, val;
addr.$set(val);
};
$pkg.StorePointer = StorePointer;
Value.ptr.prototype.Load = function() {
var v, x;
x = $ifaceNil;
v = this;
x = v.v;
return x;
};
Value.prototype.Load = function() { return this.$val.Load(); };
Value.ptr.prototype.Store = function(x) {
var v, x;
v = this;
if ($interfaceIsEqual(x, $ifaceNil)) {
$panic(new $String("sync/atomic: store of nil value into Value"));
}
if (!($interfaceIsEqual(v.v, $ifaceNil)) && !(x.constructor === v.v.constructor)) {
$panic(new $String("sync/atomic: store of inconsistently typed value into Value"));
}
v.v = x;
};
Value.prototype.Store = function(x) { return this.$val.Store(x); };
noCopy.ptr.prototype.Lock = function() {
};
noCopy.prototype.Lock = function() { return this.$val.Lock(); };
ptrType.methods = [{prop: "Load", name: "Load", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "Store", name: "Store", pkg: "", typ: $funcType([$emptyInterface], [], false)}];
ptrType$1.methods = [{prop: "Lock", name: "Lock", pkg: "", typ: $funcType([], [], false)}];
Value.init("sync/atomic", [{prop: "noCopy", name: "noCopy", anonymous: false, exported: false, typ: noCopy, tag: ""}, {prop: "v", name: "v", anonymous: false, exported: false, typ: $emptyInterface, tag: ""}]);
noCopy.init("", []);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["sync"] = (function() {
var $pkg = {}, $init, js, race, runtime, atomic, Pool, Map, readOnly, entry, Mutex, poolLocalInternal, poolLocal, notifyList, ptrType, sliceType, ptrType$1, chanType, sliceType$1, ptrType$3, ptrType$4, ptrType$5, ptrType$6, ptrType$7, sliceType$4, funcType, funcType$1, ptrType$15, mapType, ptrType$16, arrayType$2, semWaiters, semAwoken, expunged, allPools, runtime_registerPoolCleanup, runtime_SemacquireMutex, runtime_Semrelease, runtime_notifyListCheck, runtime_canSpin, runtime_nanotime, newEntry, poolCleanup, init, indexLocal, init$1, runtime_doSpin;
js = $packages["github.com/gopherjs/gopherjs/js"];
race = $packages["internal/race"];
runtime = $packages["runtime"];
atomic = $packages["sync/atomic"];
Pool = $pkg.Pool = $newType(0, $kindStruct, "sync.Pool", true, "sync", true, function(local_, localSize_, store_, New_) {
this.$val = this;
if (arguments.length === 0) {
this.local = 0;
this.localSize = 0;
this.store = sliceType$4.nil;
this.New = $throwNilPointerError;
return;
}
this.local = local_;
this.localSize = localSize_;
this.store = store_;
this.New = New_;
});
Map = $pkg.Map = $newType(0, $kindStruct, "sync.Map", true, "sync", true, function(mu_, read_, dirty_, misses_) {
this.$val = this;
if (arguments.length === 0) {
this.mu = new Mutex.ptr(0, 0);
this.read = new atomic.Value.ptr(new atomic.noCopy.ptr(), $ifaceNil);
this.dirty = false;
this.misses = 0;
return;
}
this.mu = mu_;
this.read = read_;
this.dirty = dirty_;
this.misses = misses_;
});
readOnly = $pkg.readOnly = $newType(0, $kindStruct, "sync.readOnly", true, "sync", false, function(m_, amended_) {
this.$val = this;
if (arguments.length === 0) {
this.m = false;
this.amended = false;
return;
}
this.m = m_;
this.amended = amended_;
});
entry = $pkg.entry = $newType(0, $kindStruct, "sync.entry", true, "sync", false, function(p_) {
this.$val = this;
if (arguments.length === 0) {
this.p = 0;
return;
}
this.p = p_;
});
Mutex = $pkg.Mutex = $newType(0, $kindStruct, "sync.Mutex", true, "sync", true, function(state_, sema_) {
this.$val = this;
if (arguments.length === 0) {
this.state = 0;
this.sema = 0;
return;
}
this.state = state_;
this.sema = sema_;
});
poolLocalInternal = $pkg.poolLocalInternal = $newType(0, $kindStruct, "sync.poolLocalInternal", true, "sync", false, function(private$0_, shared_, Mutex_) {
this.$val = this;
if (arguments.length === 0) {
this.private$0 = $ifaceNil;
this.shared = sliceType$4.nil;
this.Mutex = new Mutex.ptr(0, 0);
return;
}
this.private$0 = private$0_;
this.shared = shared_;
this.Mutex = Mutex_;
});
poolLocal = $pkg.poolLocal = $newType(0, $kindStruct, "sync.poolLocal", true, "sync", false, function(poolLocalInternal_, pad_) {
this.$val = this;
if (arguments.length === 0) {
this.poolLocalInternal = new poolLocalInternal.ptr($ifaceNil, sliceType$4.nil, new Mutex.ptr(0, 0));
this.pad = arrayType$2.zero();
return;
}
this.poolLocalInternal = poolLocalInternal_;
this.pad = pad_;
});
notifyList = $pkg.notifyList = $newType(0, $kindStruct, "sync.notifyList", true, "sync", false, function(wait_, notify_, lock_, head_, tail_) {
this.$val = this;
if (arguments.length === 0) {
this.wait = 0;
this.notify = 0;
this.lock = 0;
this.head = 0;
this.tail = 0;
return;
}
this.wait = wait_;
this.notify = notify_;
this.lock = lock_;
this.head = head_;
this.tail = tail_;
});
ptrType = $ptrType(Pool);
sliceType = $sliceType(ptrType);
ptrType$1 = $ptrType($Uint32);
chanType = $chanType($Bool, false, false);
sliceType$1 = $sliceType(chanType);
ptrType$3 = $ptrType($emptyInterface);
ptrType$4 = $ptrType(entry);
ptrType$5 = $ptrType($UnsafePointer);
ptrType$6 = $ptrType($Int32);
ptrType$7 = $ptrType(poolLocal);
sliceType$4 = $sliceType($emptyInterface);
funcType = $funcType([], [$emptyInterface], false);
funcType$1 = $funcType([$emptyInterface, $emptyInterface], [$Bool], false);
ptrType$15 = $ptrType(Map);
mapType = $mapType($emptyInterface, ptrType$4);
ptrType$16 = $ptrType(Mutex);
arrayType$2 = $arrayType($Uint8, 100);
Pool.ptr.prototype.Get = function() {
var _r, p, x, x$1, x$2, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; p = $f.p; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
p = this;
/* */ if (p.store.$length === 0) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (p.store.$length === 0) { */ case 1:
/* */ if (!(p.New === $throwNilPointerError)) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (!(p.New === $throwNilPointerError)) { */ case 3:
_r = p.New(); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } */ case 4:
$s = -1; return $ifaceNil;
/* } */ case 2:
x$2 = (x = p.store, x$1 = p.store.$length - 1 >> 0, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1]));
p.store = $subslice(p.store, 0, (p.store.$length - 1 >> 0));
$s = -1; return x$2;
/* */ } return; } if ($f === undefined) { $f = { $blk: Pool.ptr.prototype.Get }; } $f._r = _r; $f.p = p; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$r = $r; return $f;
};
Pool.prototype.Get = function() { return this.$val.Get(); };
Pool.ptr.prototype.Put = function(x) {
var p, x;
p = this;
if ($interfaceIsEqual(x, $ifaceNil)) {
return;
}
p.store = $append(p.store, x);
};
Pool.prototype.Put = function(x) { return this.$val.Put(x); };
runtime_registerPoolCleanup = function(cleanup) {
var cleanup;
};
runtime_SemacquireMutex = function(s, lifo) {
var _entry, _entry$1, _entry$2, _entry$3, _entry$4, _key, _key$1, _key$2, _r, ch, lifo, s, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _entry$2 = $f._entry$2; _entry$3 = $f._entry$3; _entry$4 = $f._entry$4; _key = $f._key; _key$1 = $f._key$1; _key$2 = $f._key$2; _r = $f._r; ch = $f.ch; lifo = $f.lifo; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
/* */ if (((s.$get() - (_entry = semAwoken[ptrType$1.keyFor(s)], _entry !== undefined ? _entry.v : 0) >>> 0)) === 0) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (((s.$get() - (_entry = semAwoken[ptrType$1.keyFor(s)], _entry !== undefined ? _entry.v : 0) >>> 0)) === 0) { */ case 1:
ch = new $Chan($Bool, 0);
if (lifo) {
_key = s; (semWaiters || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key)] = { k: _key, v: $appendSlice(new sliceType$1([ch]), (_entry$1 = semWaiters[ptrType$1.keyFor(s)], _entry$1 !== undefined ? _entry$1.v : sliceType$1.nil)) };
} else {
_key$1 = s; (semWaiters || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key$1)] = { k: _key$1, v: $append((_entry$2 = semWaiters[ptrType$1.keyFor(s)], _entry$2 !== undefined ? _entry$2.v : sliceType$1.nil), ch) };
}
_r = $recv(ch); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r[0];
_key$2 = s; (semAwoken || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key$2)] = { k: _key$2, v: (_entry$3 = semAwoken[ptrType$1.keyFor(s)], _entry$3 !== undefined ? _entry$3.v : 0) - (1) >>> 0 };
if ((_entry$4 = semAwoken[ptrType$1.keyFor(s)], _entry$4 !== undefined ? _entry$4.v : 0) === 0) {
delete semAwoken[ptrType$1.keyFor(s)];
}
/* } */ case 2:
s.$set(s.$get() - (1) >>> 0);
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: runtime_SemacquireMutex }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._entry$2 = _entry$2; $f._entry$3 = _entry$3; $f._entry$4 = _entry$4; $f._key = _key; $f._key$1 = _key$1; $f._key$2 = _key$2; $f._r = _r; $f.ch = ch; $f.lifo = lifo; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
};
runtime_Semrelease = function(s, handoff) {
var _entry, _entry$1, _key, _key$1, ch, handoff, s, w, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _key = $f._key; _key$1 = $f._key$1; ch = $f.ch; handoff = $f.handoff; s = $f.s; w = $f.w; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
s.$set(s.$get() + (1) >>> 0);
w = (_entry = semWaiters[ptrType$1.keyFor(s)], _entry !== undefined ? _entry.v : sliceType$1.nil);
if (w.$length === 0) {
$s = -1; return;
}
ch = (0 >= w.$length ? ($throwRuntimeError("index out of range"), undefined) : w.$array[w.$offset + 0]);
w = $subslice(w, 1);
_key = s; (semWaiters || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key)] = { k: _key, v: w };
if (w.$length === 0) {
delete semWaiters[ptrType$1.keyFor(s)];
}
_key$1 = s; (semAwoken || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key$1)] = { k: _key$1, v: (_entry$1 = semAwoken[ptrType$1.keyFor(s)], _entry$1 !== undefined ? _entry$1.v : 0) + (1) >>> 0 };
$r = $send(ch, true); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: runtime_Semrelease }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._key = _key; $f._key$1 = _key$1; $f.ch = ch; $f.handoff = handoff; $f.s = s; $f.w = w; $f.$s = $s; $f.$r = $r; return $f;
};
runtime_notifyListCheck = function(size) {
var size;
};
runtime_canSpin = function(i) {
var i;
return false;
};
runtime_nanotime = function() {
return $mul64($internalize(new ($global.Date)().getTime(), $Int64), new $Int64(0, 1000000));
};
newEntry = function(i) {
var i, i$24ptr;
return new entry.ptr(((i$24ptr || (i$24ptr = new ptrType$3(function() { return i; }, function($v) { i = $v; })))));
};
Map.ptr.prototype.Load = function(key) {
var _entry, _entry$1, _entry$2, _tmp, _tmp$1, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, e, key, m, ok, read, value, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _entry$2 = $f._entry$2; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; e = $f.e; key = $f.key; m = $f.m; ok = $f.ok; read = $f.read; value = $f.value; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
value = $ifaceNil;
ok = false;
m = this;
_tuple = $assertType(m.read.Load(), readOnly, true);
read = $clone(_tuple[0], readOnly);
_tuple$1 = (_entry = read.m[$emptyInterface.keyFor(key)], _entry !== undefined ? [_entry.v, true] : [ptrType$4.nil, false]);
e = _tuple$1[0];
ok = _tuple$1[1];
/* */ if (!ok && read.amended) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!ok && read.amended) { */ case 1:
$r = m.mu.Lock(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
_tuple$2 = $assertType(m.read.Load(), readOnly, true);
readOnly.copy(read, _tuple$2[0]);
_tuple$3 = (_entry$1 = read.m[$emptyInterface.keyFor(key)], _entry$1 !== undefined ? [_entry$1.v, true] : [ptrType$4.nil, false]);
e = _tuple$3[0];
ok = _tuple$3[1];
if (!ok && read.amended) {
_tuple$4 = (_entry$2 = m.dirty[$emptyInterface.keyFor(key)], _entry$2 !== undefined ? [_entry$2.v, true] : [ptrType$4.nil, false]);
e = _tuple$4[0];
ok = _tuple$4[1];
m.missLocked();
}
$r = m.mu.Unlock(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* } */ case 2:
if (!ok) {
_tmp = $ifaceNil;
_tmp$1 = false;
value = _tmp;
ok = _tmp$1;
$s = -1; return [value, ok];
}
_tuple$5 = e.load();
value = _tuple$5[0];
ok = _tuple$5[1];
$s = -1; return [value, ok];
/* */ } return; } if ($f === undefined) { $f = { $blk: Map.ptr.prototype.Load }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._entry$2 = _entry$2; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f.e = e; $f.key = key; $f.m = m; $f.ok = ok; $f.read = read; $f.value = value; $f.$s = $s; $f.$r = $r; return $f;
};
Map.prototype.Load = function(key) { return this.$val.Load(key); };
entry.ptr.prototype.load = function() {
var _tmp, _tmp$1, _tmp$2, _tmp$3, e, ok, p, value;
value = $ifaceNil;
ok = false;
e = this;
p = atomic.LoadPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))));
if (p === 0 || p === expunged) {
_tmp = $ifaceNil;
_tmp$1 = false;
value = _tmp;
ok = _tmp$1;
return [value, ok];
}
_tmp$2 = (p).$get();
_tmp$3 = true;
value = _tmp$2;
ok = _tmp$3;
return [value, ok];
};
entry.prototype.load = function() { return this.$val.load(); };
Map.ptr.prototype.Store = function(key, value) {
var _entry, _entry$1, _entry$2, _key, _key$1, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, e, e$1, e$2, key, m, ok, ok$1, ok$2, read, value, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _entry$2 = $f._entry$2; _key = $f._key; _key$1 = $f._key$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; e = $f.e; e$1 = $f.e$1; e$2 = $f.e$2; key = $f.key; m = $f.m; ok = $f.ok; ok$1 = $f.ok$1; ok$2 = $f.ok$2; read = $f.read; value = $f.value; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
value = [value];
m = this;
_tuple = $assertType(m.read.Load(), readOnly, true);
read = $clone(_tuple[0], readOnly);
_tuple$1 = (_entry = read.m[$emptyInterface.keyFor(key)], _entry !== undefined ? [_entry.v, true] : [ptrType$4.nil, false]);
e = _tuple$1[0];
ok = _tuple$1[1];
if (ok && e.tryStore((value.$ptr || (value.$ptr = new ptrType$3(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, value))))) {
$s = -1; return;
}
$r = m.mu.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
_tuple$2 = $assertType(m.read.Load(), readOnly, true);
readOnly.copy(read, _tuple$2[0]);
_tuple$3 = (_entry$1 = read.m[$emptyInterface.keyFor(key)], _entry$1 !== undefined ? [_entry$1.v, true] : [ptrType$4.nil, false]);
e$1 = _tuple$3[0];
ok$1 = _tuple$3[1];
if (ok$1) {
if (e$1.unexpungeLocked()) {
_key = key; (m.dirty || $throwRuntimeError("assignment to entry in nil map"))[$emptyInterface.keyFor(_key)] = { k: _key, v: e$1 };
}
e$1.storeLocked((value.$ptr || (value.$ptr = new ptrType$3(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, value))));
} else {
_tuple$4 = (_entry$2 = m.dirty[$emptyInterface.keyFor(key)], _entry$2 !== undefined ? [_entry$2.v, true] : [ptrType$4.nil, false]);
e$2 = _tuple$4[0];
ok$2 = _tuple$4[1];
if (ok$2) {
e$2.storeLocked((value.$ptr || (value.$ptr = new ptrType$3(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, value))));
} else {
if (!read.amended) {
m.dirtyLocked();
m.read.Store((x = new readOnly.ptr(read.m, true), new x.constructor.elem(x)));
}
_key$1 = key; (m.dirty || $throwRuntimeError("assignment to entry in nil map"))[$emptyInterface.keyFor(_key$1)] = { k: _key$1, v: newEntry(value[0]) };
}
}
$r = m.mu.Unlock(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Map.ptr.prototype.Store }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._entry$2 = _entry$2; $f._key = _key; $f._key$1 = _key$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f.e = e; $f.e$1 = e$1; $f.e$2 = e$2; $f.key = key; $f.m = m; $f.ok = ok; $f.ok$1 = ok$1; $f.ok$2 = ok$2; $f.read = read; $f.value = value; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Map.prototype.Store = function(key, value) { return this.$val.Store(key, value); };
entry.ptr.prototype.tryStore = function(i) {
var e, i, p;
e = this;
p = atomic.LoadPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))));
if (p === expunged) {
return false;
}
while (true) {
if (atomic.CompareAndSwapPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))), p, (i))) {
return true;
}
p = atomic.LoadPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))));
if (p === expunged) {
return false;
}
}
};
entry.prototype.tryStore = function(i) { return this.$val.tryStore(i); };
entry.ptr.prototype.unexpungeLocked = function() {
var e, wasExpunged;
wasExpunged = false;
e = this;
wasExpunged = atomic.CompareAndSwapPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))), expunged, 0);
return wasExpunged;
};
entry.prototype.unexpungeLocked = function() { return this.$val.unexpungeLocked(); };
entry.ptr.prototype.storeLocked = function(i) {
var e, i;
e = this;
atomic.StorePointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))), (i));
};
entry.prototype.storeLocked = function(i) { return this.$val.storeLocked(i); };
Map.ptr.prototype.LoadOrStore = function(key, value) {
var _entry, _entry$1, _entry$2, _key, _key$1, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, _tuple$6, _tuple$7, actual, actual$1, e, e$1, e$2, key, loaded, loaded$1, m, ok, ok$1, ok$2, ok$3, read, value, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _entry$2 = $f._entry$2; _key = $f._key; _key$1 = $f._key$1; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; _tuple$7 = $f._tuple$7; actual = $f.actual; actual$1 = $f.actual$1; e = $f.e; e$1 = $f.e$1; e$2 = $f.e$2; key = $f.key; loaded = $f.loaded; loaded$1 = $f.loaded$1; m = $f.m; ok = $f.ok; ok$1 = $f.ok$1; ok$2 = $f.ok$2; ok$3 = $f.ok$3; read = $f.read; value = $f.value; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
actual = $ifaceNil;
loaded = false;
m = this;
_tuple = $assertType(m.read.Load(), readOnly, true);
read = $clone(_tuple[0], readOnly);
_tuple$1 = (_entry = read.m[$emptyInterface.keyFor(key)], _entry !== undefined ? [_entry.v, true] : [ptrType$4.nil, false]);
e = _tuple$1[0];
ok = _tuple$1[1];
if (ok) {
_tuple$2 = e.tryLoadOrStore(value);
actual$1 = _tuple$2[0];
loaded$1 = _tuple$2[1];
ok$1 = _tuple$2[2];
if (ok$1) {
_tmp = actual$1;
_tmp$1 = loaded$1;
actual = _tmp;
loaded = _tmp$1;
$s = -1; return [actual, loaded];
}
}
$r = m.mu.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
_tuple$3 = $assertType(m.read.Load(), readOnly, true);
readOnly.copy(read, _tuple$3[0]);
_tuple$4 = (_entry$1 = read.m[$emptyInterface.keyFor(key)], _entry$1 !== undefined ? [_entry$1.v, true] : [ptrType$4.nil, false]);
e$1 = _tuple$4[0];
ok$2 = _tuple$4[1];
if (ok$2) {
if (e$1.unexpungeLocked()) {
_key = key; (m.dirty || $throwRuntimeError("assignment to entry in nil map"))[$emptyInterface.keyFor(_key)] = { k: _key, v: e$1 };
}
_tuple$5 = e$1.tryLoadOrStore(value);
actual = _tuple$5[0];
loaded = _tuple$5[1];
} else {
_tuple$6 = (_entry$2 = m.dirty[$emptyInterface.keyFor(key)], _entry$2 !== undefined ? [_entry$2.v, true] : [ptrType$4.nil, false]);
e$2 = _tuple$6[0];
ok$3 = _tuple$6[1];
if (ok$3) {
_tuple$7 = e$2.tryLoadOrStore(value);
actual = _tuple$7[0];
loaded = _tuple$7[1];
m.missLocked();
} else {
if (!read.amended) {
m.dirtyLocked();
m.read.Store((x = new readOnly.ptr(read.m, true), new x.constructor.elem(x)));
}
_key$1 = key; (m.dirty || $throwRuntimeError("assignment to entry in nil map"))[$emptyInterface.keyFor(_key$1)] = { k: _key$1, v: newEntry(value) };
_tmp$2 = value;
_tmp$3 = false;
actual = _tmp$2;
loaded = _tmp$3;
}
}
$r = m.mu.Unlock(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
_tmp$4 = actual;
_tmp$5 = loaded;
actual = _tmp$4;
loaded = _tmp$5;
$s = -1; return [actual, loaded];
/* */ } return; } if ($f === undefined) { $f = { $blk: Map.ptr.prototype.LoadOrStore }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._entry$2 = _entry$2; $f._key = _key; $f._key$1 = _key$1; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f._tuple$7 = _tuple$7; $f.actual = actual; $f.actual$1 = actual$1; $f.e = e; $f.e$1 = e$1; $f.e$2 = e$2; $f.key = key; $f.loaded = loaded; $f.loaded$1 = loaded$1; $f.m = m; $f.ok = ok; $f.ok$1 = ok$1; $f.ok$2 = ok$2; $f.ok$3 = ok$3; $f.read = read; $f.value = value; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Map.prototype.LoadOrStore = function(key, value) { return this.$val.LoadOrStore(key, value); };
entry.ptr.prototype.tryLoadOrStore = function(i) {
var _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, actual, e, i, ic, ic$24ptr, loaded, ok, p;
actual = $ifaceNil;
loaded = false;
ok = false;
e = this;
p = atomic.LoadPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))));
if (p === expunged) {
_tmp = $ifaceNil;
_tmp$1 = false;
_tmp$2 = false;
actual = _tmp;
loaded = _tmp$1;
ok = _tmp$2;
return [actual, loaded, ok];
}
if (!(p === 0)) {
_tmp$3 = (p).$get();
_tmp$4 = true;
_tmp$5 = true;
actual = _tmp$3;
loaded = _tmp$4;
ok = _tmp$5;
return [actual, loaded, ok];
}
ic = i;
while (true) {
if (atomic.CompareAndSwapPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))), 0, ((ic$24ptr || (ic$24ptr = new ptrType$3(function() { return ic; }, function($v) { ic = $v; })))))) {
_tmp$6 = i;
_tmp$7 = false;
_tmp$8 = true;
actual = _tmp$6;
loaded = _tmp$7;
ok = _tmp$8;
return [actual, loaded, ok];
}
p = atomic.LoadPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))));
if (p === expunged) {
_tmp$9 = $ifaceNil;
_tmp$10 = false;
_tmp$11 = false;
actual = _tmp$9;
loaded = _tmp$10;
ok = _tmp$11;
return [actual, loaded, ok];
}
if (!(p === 0)) {
_tmp$12 = (p).$get();
_tmp$13 = true;
_tmp$14 = true;
actual = _tmp$12;
loaded = _tmp$13;
ok = _tmp$14;
return [actual, loaded, ok];
}
}
};
entry.prototype.tryLoadOrStore = function(i) { return this.$val.tryLoadOrStore(i); };
Map.ptr.prototype.Delete = function(key) {
var _entry, _entry$1, _tuple, _tuple$1, _tuple$2, _tuple$3, e, key, m, ok, read, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; e = $f.e; key = $f.key; m = $f.m; ok = $f.ok; read = $f.read; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
m = this;
_tuple = $assertType(m.read.Load(), readOnly, true);
read = $clone(_tuple[0], readOnly);
_tuple$1 = (_entry = read.m[$emptyInterface.keyFor(key)], _entry !== undefined ? [_entry.v, true] : [ptrType$4.nil, false]);
e = _tuple$1[0];
ok = _tuple$1[1];
/* */ if (!ok && read.amended) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!ok && read.amended) { */ case 1:
$r = m.mu.Lock(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
_tuple$2 = $assertType(m.read.Load(), readOnly, true);
readOnly.copy(read, _tuple$2[0]);
_tuple$3 = (_entry$1 = read.m[$emptyInterface.keyFor(key)], _entry$1 !== undefined ? [_entry$1.v, true] : [ptrType$4.nil, false]);
e = _tuple$3[0];
ok = _tuple$3[1];
if (!ok && read.amended) {
delete m.dirty[$emptyInterface.keyFor(key)];
}
$r = m.mu.Unlock(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* } */ case 2:
if (ok) {
e.delete$();
}
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Map.ptr.prototype.Delete }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.e = e; $f.key = key; $f.m = m; $f.ok = ok; $f.read = read; $f.$s = $s; $f.$r = $r; return $f;
};
Map.prototype.Delete = function(key) { return this.$val.Delete(key); };
entry.ptr.prototype.delete$ = function() {
var e, hadValue, p;
hadValue = false;
e = this;
while (true) {
p = atomic.LoadPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))));
if (p === 0 || p === expunged) {
hadValue = false;
return hadValue;
}
if (atomic.CompareAndSwapPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))), p, 0)) {
hadValue = true;
return hadValue;
}
}
};
entry.prototype.delete$ = function() { return this.$val.delete$(); };
Map.ptr.prototype.Range = function(f) {
var _entry, _i, _keys, _r, _ref, _tuple, _tuple$1, _tuple$2, e, f, k, m, ok, read, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _i = $f._i; _keys = $f._keys; _r = $f._r; _ref = $f._ref; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; e = $f.e; f = $f.f; k = $f.k; m = $f.m; ok = $f.ok; read = $f.read; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
m = this;
_tuple = $assertType(m.read.Load(), readOnly, true);
read = $clone(_tuple[0], readOnly);
/* */ if (read.amended) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (read.amended) { */ case 1:
$r = m.mu.Lock(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
_tuple$1 = $assertType(m.read.Load(), readOnly, true);
readOnly.copy(read, _tuple$1[0]);
if (read.amended) {
readOnly.copy(read, new readOnly.ptr(m.dirty, false));
m.read.Store(new read.constructor.elem(read));
m.dirty = false;
m.misses = 0;
}
$r = m.mu.Unlock(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* } */ case 2:
_ref = read.m;
_i = 0;
_keys = $keys(_ref);
/* while (true) { */ case 5:
/* if (!(_i < _keys.length)) { break; } */ if(!(_i < _keys.length)) { $s = 6; continue; }
_entry = _ref[_keys[_i]];
if (_entry === undefined) {
_i++;
/* continue; */ $s = 5; continue;
}
k = _entry.k;
e = _entry.v;
_tuple$2 = e.load();
v = _tuple$2[0];
ok = _tuple$2[1];
/* */ if (!ok) { $s = 7; continue; }
/* */ $s = 8; continue;
/* if (!ok) { */ case 7:
_i++;
/* continue; */ $s = 5; continue;
/* } */ case 8:
_r = f(k, v); /* */ $s = 11; case 11: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (!_r) { $s = 9; continue; }
/* */ $s = 10; continue;
/* if (!_r) { */ case 9:
/* break; */ $s = 6; continue;
/* } */ case 10:
_i++;
/* } */ $s = 5; continue; case 6:
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Map.ptr.prototype.Range }; } $f._entry = _entry; $f._i = _i; $f._keys = _keys; $f._r = _r; $f._ref = _ref; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.e = e; $f.f = f; $f.k = k; $f.m = m; $f.ok = ok; $f.read = read; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Map.prototype.Range = function(f) { return this.$val.Range(f); };
Map.ptr.prototype.missLocked = function() {
var m, x;
m = this;
m.misses = m.misses + (1) >> 0;
if (m.misses < $keys(m.dirty).length) {
return;
}
m.read.Store((x = new readOnly.ptr(m.dirty, false), new x.constructor.elem(x)));
m.dirty = false;
m.misses = 0;
};
Map.prototype.missLocked = function() { return this.$val.missLocked(); };
Map.ptr.prototype.dirtyLocked = function() {
var _entry, _i, _key, _keys, _ref, _tuple, e, k, m, read, x;
m = this;
if (!(m.dirty === false)) {
return;
}
_tuple = $assertType(m.read.Load(), readOnly, true);
read = $clone(_tuple[0], readOnly);
m.dirty = (x = $keys(read.m).length, ((x < 0 || x > 2147483647) ? $throwRuntimeError("makemap: size out of range") : {}));
_ref = read.m;
_i = 0;
_keys = $keys(_ref);
while (true) {
if (!(_i < _keys.length)) { break; }
_entry = _ref[_keys[_i]];
if (_entry === undefined) {
_i++;
continue;
}
k = _entry.k;
e = _entry.v;
if (!e.tryExpungeLocked()) {
_key = k; (m.dirty || $throwRuntimeError("assignment to entry in nil map"))[$emptyInterface.keyFor(_key)] = { k: _key, v: e };
}
_i++;
}
};
Map.prototype.dirtyLocked = function() { return this.$val.dirtyLocked(); };
entry.ptr.prototype.tryExpungeLocked = function() {
var e, isExpunged, p;
isExpunged = false;
e = this;
p = atomic.LoadPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))));
while (true) {
if (!(p === 0)) { break; }
if (atomic.CompareAndSwapPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))), 0, expunged)) {
isExpunged = true;
return isExpunged;
}
p = atomic.LoadPointer((e.$ptr_p || (e.$ptr_p = new ptrType$5(function() { return this.$target.p; }, function($v) { this.$target.p = $v; }, e))));
}
isExpunged = p === expunged;
return isExpunged;
};
entry.prototype.tryExpungeLocked = function() { return this.$val.tryExpungeLocked(); };
Mutex.ptr.prototype.Lock = function() {
var awoke, delta, iter, m, new$1, old, queueLifo, starving, waitStartTime, x, x$1, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; awoke = $f.awoke; delta = $f.delta; iter = $f.iter; m = $f.m; new$1 = $f.new$1; old = $f.old; queueLifo = $f.queueLifo; starving = $f.starving; waitStartTime = $f.waitStartTime; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
m = this;
if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), 0, 1)) {
if (false) {
race.Acquire((m));
}
$s = -1; return;
}
waitStartTime = new $Int64(0, 0);
starving = false;
awoke = false;
iter = 0;
old = m.state;
/* while (true) { */ case 1:
/* */ if (((old & 5) === 1) && runtime_canSpin(iter)) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (((old & 5) === 1) && runtime_canSpin(iter)) { */ case 3:
if (!awoke && ((old & 2) === 0) && !(((old >> 3 >> 0) === 0)) && atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, old | 2)) {
awoke = true;
}
runtime_doSpin();
iter = iter + (1) >> 0;
old = m.state;
/* continue; */ $s = 1; continue;
/* } */ case 4:
new$1 = old;
if ((old & 4) === 0) {
new$1 = new$1 | (1);
}
if (!(((old & 5) === 0))) {
new$1 = new$1 + (8) >> 0;
}
if (starving && !(((old & 1) === 0))) {
new$1 = new$1 | (4);
}
if (awoke) {
if ((new$1 & 2) === 0) {
$panic(new $String("sync: inconsistent mutex state"));
}
new$1 = (new$1 & ~(2)) >> 0;
}
/* */ if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, new$1)) { $s = 5; continue; }
/* */ $s = 6; continue;
/* if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, new$1)) { */ case 5:
if ((old & 5) === 0) {
/* break; */ $s = 2; continue;
}
queueLifo = !((waitStartTime.$high === 0 && waitStartTime.$low === 0));
if ((waitStartTime.$high === 0 && waitStartTime.$low === 0)) {
waitStartTime = runtime_nanotime();
}
$r = runtime_SemacquireMutex((m.$ptr_sema || (m.$ptr_sema = new ptrType$1(function() { return this.$target.sema; }, function($v) { this.$target.sema = $v; }, m))), queueLifo); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
starving = starving || (x = (x$1 = runtime_nanotime(), new $Int64(x$1.$high - waitStartTime.$high, x$1.$low - waitStartTime.$low)), (x.$high > 0 || (x.$high === 0 && x.$low > 1000000)));
old = m.state;
if (!(((old & 4) === 0))) {
if (!(((old & 3) === 0)) || ((old >> 3 >> 0) === 0)) {
$panic(new $String("sync: inconsistent mutex state"));
}
delta = -7;
if (!starving || ((old >> 3 >> 0) === 1)) {
delta = delta - (4) >> 0;
}
atomic.AddInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), delta);
/* break; */ $s = 2; continue;
}
awoke = true;
iter = 0;
$s = 7; continue;
/* } else { */ case 6:
old = m.state;
/* } */ case 7:
/* } */ $s = 1; continue; case 2:
if (false) {
race.Acquire((m));
}
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Mutex.ptr.prototype.Lock }; } $f.awoke = awoke; $f.delta = delta; $f.iter = iter; $f.m = m; $f.new$1 = new$1; $f.old = old; $f.queueLifo = queueLifo; $f.starving = starving; $f.waitStartTime = waitStartTime; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
};
Mutex.prototype.Lock = function() { return this.$val.Lock(); };
Mutex.ptr.prototype.Unlock = function() {
var m, new$1, old, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; m = $f.m; new$1 = $f.new$1; old = $f.old; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
m = this;
if (false) {
$unused(m.state);
race.Release((m));
}
new$1 = atomic.AddInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), -1);
if ((((new$1 + 1 >> 0)) & 1) === 0) {
$panic(new $String("sync: unlock of unlocked mutex"));
}
/* */ if ((new$1 & 4) === 0) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if ((new$1 & 4) === 0) { */ case 1:
old = new$1;
/* while (true) { */ case 4:
if (((old >> 3 >> 0) === 0) || !(((old & 7) === 0))) {
$s = -1; return;
}
new$1 = ((old - 8 >> 0)) | 2;
/* */ if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, new$1)) { $s = 6; continue; }
/* */ $s = 7; continue;
/* if (atomic.CompareAndSwapInt32((m.$ptr_state || (m.$ptr_state = new ptrType$6(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, m))), old, new$1)) { */ case 6:
$r = runtime_Semrelease((m.$ptr_sema || (m.$ptr_sema = new ptrType$1(function() { return this.$target.sema; }, function($v) { this.$target.sema = $v; }, m))), false); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$s = -1; return;
/* } */ case 7:
old = m.state;
/* } */ $s = 4; continue; case 5:
$s = 3; continue;
/* } else { */ case 2:
$r = runtime_Semrelease((m.$ptr_sema || (m.$ptr_sema = new ptrType$1(function() { return this.$target.sema; }, function($v) { this.$target.sema = $v; }, m))), true); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* } */ case 3:
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Mutex.ptr.prototype.Unlock }; } $f.m = m; $f.new$1 = new$1; $f.old = old; $f.$s = $s; $f.$r = $r; return $f;
};
Mutex.prototype.Unlock = function() { return this.$val.Unlock(); };
poolCleanup = function() {
var _i, _i$1, _ref, _ref$1, i, i$1, j, l, p, x;
_ref = allPools;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
p = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
((i < 0 || i >= allPools.$length) ? ($throwRuntimeError("index out of range"), undefined) : allPools.$array[allPools.$offset + i] = ptrType.nil);
i$1 = 0;
while (true) {
if (!(i$1 < ((p.localSize >> 0)))) { break; }
l = indexLocal(p.local, i$1);
l.poolLocalInternal.private$0 = $ifaceNil;
_ref$1 = l.poolLocalInternal.shared;
_i$1 = 0;
while (true) {
if (!(_i$1 < _ref$1.$length)) { break; }
j = _i$1;
(x = l.poolLocalInternal.shared, ((j < 0 || j >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + j] = $ifaceNil));
_i$1++;
}
l.poolLocalInternal.shared = sliceType$4.nil;
i$1 = i$1 + (1) >> 0;
}
p.local = 0;
p.localSize = 0;
_i++;
}
allPools = new sliceType([]);
};
init = function() {
runtime_registerPoolCleanup(poolCleanup);
};
indexLocal = function(l, i) {
var i, l, lp;
lp = (((l) + ($imul(((i >>> 0)), 128) >>> 0) >>> 0));
return ($pointerOfStructConversion(lp, ptrType$7));
};
init$1 = function() {
var n;
n = new notifyList.ptr(0, 0, 0, 0, 0);
runtime_notifyListCheck(20);
};
runtime_doSpin = function() {
$throwRuntimeError("native function not implemented: sync.runtime_doSpin");
};
ptrType.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "Put", name: "Put", pkg: "", typ: $funcType([$emptyInterface], [], false)}, {prop: "getSlow", name: "getSlow", pkg: "sync", typ: $funcType([], [$emptyInterface], false)}, {prop: "pin", name: "pin", pkg: "sync", typ: $funcType([], [ptrType$7], false)}, {prop: "pinSlow", name: "pinSlow", pkg: "sync", typ: $funcType([], [ptrType$7], false)}];
ptrType$15.methods = [{prop: "Load", name: "Load", pkg: "", typ: $funcType([$emptyInterface], [$emptyInterface, $Bool], false)}, {prop: "Store", name: "Store", pkg: "", typ: $funcType([$emptyInterface, $emptyInterface], [], false)}, {prop: "LoadOrStore", name: "LoadOrStore", pkg: "", typ: $funcType([$emptyInterface, $emptyInterface], [$emptyInterface, $Bool], false)}, {prop: "Delete", name: "Delete", pkg: "", typ: $funcType([$emptyInterface], [], false)}, {prop: "Range", name: "Range", pkg: "", typ: $funcType([funcType$1], [], false)}, {prop: "missLocked", name: "missLocked", pkg: "sync", typ: $funcType([], [], false)}, {prop: "dirtyLocked", name: "dirtyLocked", pkg: "sync", typ: $funcType([], [], false)}];
ptrType$4.methods = [{prop: "load", name: "load", pkg: "sync", typ: $funcType([], [$emptyInterface, $Bool], false)}, {prop: "tryStore", name: "tryStore", pkg: "sync", typ: $funcType([ptrType$3], [$Bool], false)}, {prop: "unexpungeLocked", name: "unexpungeLocked", pkg: "sync", typ: $funcType([], [$Bool], false)}, {prop: "storeLocked", name: "storeLocked", pkg: "sync", typ: $funcType([ptrType$3], [], false)}, {prop: "tryLoadOrStore", name: "tryLoadOrStore", pkg: "sync", typ: $funcType([$emptyInterface], [$emptyInterface, $Bool, $Bool], false)}, {prop: "delete$", name: "delete", pkg: "sync", typ: $funcType([], [$Bool], false)}, {prop: "tryExpungeLocked", name: "tryExpungeLocked", pkg: "sync", typ: $funcType([], [$Bool], false)}];
ptrType$16.methods = [{prop: "Lock", name: "Lock", pkg: "", typ: $funcType([], [], false)}, {prop: "Unlock", name: "Unlock", pkg: "", typ: $funcType([], [], false)}];
Pool.init("sync", [{prop: "local", name: "local", anonymous: false, exported: false, typ: $UnsafePointer, tag: ""}, {prop: "localSize", name: "localSize", anonymous: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "store", name: "store", anonymous: false, exported: false, typ: sliceType$4, tag: ""}, {prop: "New", name: "New", anonymous: false, exported: true, typ: funcType, tag: ""}]);
Map.init("sync", [{prop: "mu", name: "mu", anonymous: false, exported: false, typ: Mutex, tag: ""}, {prop: "read", name: "read", anonymous: false, exported: false, typ: atomic.Value, tag: ""}, {prop: "dirty", name: "dirty", anonymous: false, exported: false, typ: mapType, tag: ""}, {prop: "misses", name: "misses", anonymous: false, exported: false, typ: $Int, tag: ""}]);
readOnly.init("sync", [{prop: "m", name: "m", anonymous: false, exported: false, typ: mapType, tag: ""}, {prop: "amended", name: "amended", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
entry.init("sync", [{prop: "p", name: "p", anonymous: false, exported: false, typ: $UnsafePointer, tag: ""}]);
Mutex.init("sync", [{prop: "state", name: "state", anonymous: false, exported: false, typ: $Int32, tag: ""}, {prop: "sema", name: "sema", anonymous: false, exported: false, typ: $Uint32, tag: ""}]);
poolLocalInternal.init("sync", [{prop: "private$0", name: "private", anonymous: false, exported: false, typ: $emptyInterface, tag: ""}, {prop: "shared", name: "shared", anonymous: false, exported: false, typ: sliceType$4, tag: ""}, {prop: "Mutex", name: "Mutex", anonymous: true, exported: true, typ: Mutex, tag: ""}]);
poolLocal.init("sync", [{prop: "poolLocalInternal", name: "poolLocalInternal", anonymous: true, exported: false, typ: poolLocalInternal, tag: ""}, {prop: "pad", name: "pad", anonymous: false, exported: false, typ: arrayType$2, tag: ""}]);
notifyList.init("sync", [{prop: "wait", name: "wait", anonymous: false, exported: false, typ: $Uint32, tag: ""}, {prop: "notify", name: "notify", anonymous: false, exported: false, typ: $Uint32, tag: ""}, {prop: "lock", name: "lock", anonymous: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "head", name: "head", anonymous: false, exported: false, typ: $UnsafePointer, tag: ""}, {prop: "tail", name: "tail", anonymous: false, exported: false, typ: $UnsafePointer, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = race.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = runtime.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = atomic.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
allPools = sliceType.nil;
semWaiters = {};
semAwoken = {};
expunged = (new Uint8Array(8));
init();
init$1();
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["io"] = (function() {
var $pkg = {}, $init, errors, sync, RuneScanner, errWhence, errOffset;
errors = $packages["errors"];
sync = $packages["sync"];
RuneScanner = $pkg.RuneScanner = $newType(8, $kindInterface, "io.RuneScanner", true, "io", true, null);
RuneScanner.init([{prop: "ReadRune", name: "ReadRune", pkg: "", typ: $funcType([], [$Int32, $Int, $error], false)}, {prop: "UnreadRune", name: "UnreadRune", pkg: "", typ: $funcType([], [$error], false)}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = sync.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$pkg.ErrShortWrite = errors.New("short write");
$pkg.ErrShortBuffer = errors.New("short buffer");
$pkg.EOF = errors.New("EOF");
$pkg.ErrUnexpectedEOF = errors.New("unexpected EOF");
$pkg.ErrNoProgress = errors.New("multiple Read calls return no data or error");
errWhence = errors.New("Seek: invalid whence");
errOffset = errors.New("Seek: invalid offset");
$pkg.ErrClosedPipe = errors.New("io: read/write on closed pipe");
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["math"] = (function() {
var $pkg = {}, $init, js, arrayType, arrayType$1, arrayType$2, structType, math, zero, nan, buf, Exp, Log, init;
js = $packages["github.com/gopherjs/gopherjs/js"];
arrayType = $arrayType($Uint32, 2);
arrayType$1 = $arrayType($Float32, 2);
arrayType$2 = $arrayType($Float64, 1);
structType = $structType("math", [{prop: "uint32array", name: "uint32array", anonymous: false, exported: false, typ: arrayType, tag: ""}, {prop: "float32array", name: "float32array", anonymous: false, exported: false, typ: arrayType$1, tag: ""}, {prop: "float64array", name: "float64array", anonymous: false, exported: false, typ: arrayType$2, tag: ""}]);
Exp = function(x) {
var x;
return $parseFloat(math.exp(x));
};
$pkg.Exp = Exp;
Log = function(x) {
var x;
if (!((x === x))) {
return nan;
}
return $parseFloat(math.log(x));
};
$pkg.Log = Log;
init = function() {
var ab;
ab = new ($global.ArrayBuffer)(8);
buf.uint32array = new ($global.Uint32Array)(ab);
buf.float32array = new ($global.Float32Array)(ab);
buf.float64array = new ($global.Float64Array)(ab);
};
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
buf = new structType.ptr(arrayType.zero(), arrayType$1.zero(), arrayType$2.zero());
math = $global.Math;
zero = 0;
nan = 0 / zero;
init();
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["syscall"] = (function() {
var $pkg = {}, $init, js, race, runtime, sync, SockaddrLinklayer, SockaddrNetlink, mmapper, Errno, Sockaddr, SockaddrInet4, SockaddrInet6, SockaddrUnix, Timespec, Stat_t, RawSockaddrInet4, RawSockaddrInet6, RawSockaddrUnix, RawSockaddrLinklayer, RawSockaddrNetlink, RawSockaddr, RawSockaddrAny, _Socklen, Linger, Iovec, IPMreq, IPMreqn, IPv6Mreq, Msghdr, sliceType, sliceType$1, ptrType$2, ptrType$4, arrayType$1, ptrType$8, arrayType$2, ptrType$11, arrayType$4, arrayType$7, arrayType$8, arrayType$9, arrayType$10, ptrType$18, ptrType$19, structType, ptrType$22, ptrType$24, ptrType$25, mapType, funcType$2, funcType$3, ptrType$26, ptrType$27, ptrType$28, ptrType$29, arrayType$15, ptrType$31, warningPrinted, lineBuffer, syscallModule, alreadyTriedToLoad, minusOne, envs, mapper, errEAGAIN, errEINVAL, errENOENT, ioSync, ioSync$24ptr, errors, init, printWarning, printToConsole, indexByte, runtime_envs, syscall, Syscall, Syscall6, BytePtrFromString, readInt, readIntBE, readIntLE, ParseDirent, CloseOnExec, SetNonblock, msanRead, msanWrite, itoa, uitoa, anyToSockaddr, Accept, Accept4, SetsockoptIPMreqn, Recvmsg, SendmsgN, ReadDirent, direntIno, direntReclen, direntNamlen, errnoErr, Read, Write, Recvfrom, Sendto, SetsockoptByte, SetsockoptInt, SetsockoptInet4Addr, SetsockoptIPMreq, SetsockoptIPv6Mreq, SetsockoptLinger, Close, Fchdir, Fchmod, fcntl, Fsync, Getdents, read, write, munmap, Fchown, Fstat, Ftruncate, Lstat, Pread, Pwrite, Seek, Shutdown, accept, accept4, setsockopt, recvfrom, sendto, recvmsg, sendmsg, mmap;
js = $packages["github.com/gopherjs/gopherjs/js"];
race = $packages["internal/race"];
runtime = $packages["runtime"];
sync = $packages["sync"];
SockaddrLinklayer = $pkg.SockaddrLinklayer = $newType(0, $kindStruct, "syscall.SockaddrLinklayer", true, "syscall", true, function(Protocol_, Ifindex_, Hatype_, Pkttype_, Halen_, Addr_, raw_) {
this.$val = this;
if (arguments.length === 0) {
this.Protocol = 0;
this.Ifindex = 0;
this.Hatype = 0;
this.Pkttype = 0;
this.Halen = 0;
this.Addr = arrayType$1.zero();
this.raw = new RawSockaddrLinklayer.ptr(0, 0, 0, 0, 0, 0, arrayType$1.zero());
return;
}
this.Protocol = Protocol_;
this.Ifindex = Ifindex_;
this.Hatype = Hatype_;
this.Pkttype = Pkttype_;
this.Halen = Halen_;
this.Addr = Addr_;
this.raw = raw_;
});
SockaddrNetlink = $pkg.SockaddrNetlink = $newType(0, $kindStruct, "syscall.SockaddrNetlink", true, "syscall", true, function(Family_, Pad_, Pid_, Groups_, raw_) {
this.$val = this;
if (arguments.length === 0) {
this.Family = 0;
this.Pad = 0;
this.Pid = 0;
this.Groups = 0;
this.raw = new RawSockaddrNetlink.ptr(0, 0, 0, 0);
return;
}
this.Family = Family_;
this.Pad = Pad_;
this.Pid = Pid_;
this.Groups = Groups_;
this.raw = raw_;
});
mmapper = $pkg.mmapper = $newType(0, $kindStruct, "syscall.mmapper", true, "syscall", false, function(Mutex_, active_, mmap_, munmap_) {
this.$val = this;
if (arguments.length === 0) {
this.Mutex = new sync.Mutex.ptr(0, 0);
this.active = false;
this.mmap = $throwNilPointerError;
this.munmap = $throwNilPointerError;
return;
}
this.Mutex = Mutex_;
this.active = active_;
this.mmap = mmap_;
this.munmap = munmap_;
});
Errno = $pkg.Errno = $newType(4, $kindUintptr, "syscall.Errno", true, "syscall", true, null);
Sockaddr = $pkg.Sockaddr = $newType(8, $kindInterface, "syscall.Sockaddr", true, "syscall", true, null);
SockaddrInet4 = $pkg.SockaddrInet4 = $newType(0, $kindStruct, "syscall.SockaddrInet4", true, "syscall", true, function(Port_, Addr_, raw_) {
this.$val = this;
if (arguments.length === 0) {
this.Port = 0;
this.Addr = arrayType$8.zero();
this.raw = new RawSockaddrInet4.ptr(0, 0, arrayType$8.zero(), arrayType$1.zero());
return;
}
this.Port = Port_;
this.Addr = Addr_;
this.raw = raw_;
});
SockaddrInet6 = $pkg.SockaddrInet6 = $newType(0, $kindStruct, "syscall.SockaddrInet6", true, "syscall", true, function(Port_, ZoneId_, Addr_, raw_) {
this.$val = this;
if (arguments.length === 0) {
this.Port = 0;
this.ZoneId = 0;
this.Addr = arrayType$2.zero();
this.raw = new RawSockaddrInet6.ptr(0, 0, 0, arrayType$2.zero(), 0);
return;
}
this.Port = Port_;
this.ZoneId = ZoneId_;
this.Addr = Addr_;
this.raw = raw_;
});
SockaddrUnix = $pkg.SockaddrUnix = $newType(0, $kindStruct, "syscall.SockaddrUnix", true, "syscall", true, function(Name_, raw_) {
this.$val = this;
if (arguments.length === 0) {
this.Name = "";
this.raw = new RawSockaddrUnix.ptr(0, arrayType$7.zero());
return;
}
this.Name = Name_;
this.raw = raw_;
});
Timespec = $pkg.Timespec = $newType(0, $kindStruct, "syscall.Timespec", true, "syscall", true, function(Sec_, Nsec_) {
this.$val = this;
if (arguments.length === 0) {
this.Sec = new $Int64(0, 0);
this.Nsec = new $Int64(0, 0);
return;
}
this.Sec = Sec_;
this.Nsec = Nsec_;
});
Stat_t = $pkg.Stat_t = $newType(0, $kindStruct, "syscall.Stat_t", true, "syscall", true, function(Dev_, Ino_, Nlink_, Mode_, Uid_, Gid_, X__pad0_, Rdev_, Size_, Blksize_, Blocks_, Atim_, Mtim_, Ctim_, X__unused_) {
this.$val = this;
if (arguments.length === 0) {
this.Dev = new $Uint64(0, 0);
this.Ino = new $Uint64(0, 0);
this.Nlink = new $Uint64(0, 0);
this.Mode = 0;
this.Uid = 0;
this.Gid = 0;
this.X__pad0 = 0;
this.Rdev = new $Uint64(0, 0);
this.Size = new $Int64(0, 0);
this.Blksize = new $Int64(0, 0);
this.Blocks = new $Int64(0, 0);
this.Atim = new Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0));
this.Mtim = new Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0));
this.Ctim = new Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0));
this.X__unused = arrayType$15.zero();
return;
}
this.Dev = Dev_;
this.Ino = Ino_;
this.Nlink = Nlink_;
this.Mode = Mode_;
this.Uid = Uid_;
this.Gid = Gid_;
this.X__pad0 = X__pad0_;
this.Rdev = Rdev_;
this.Size = Size_;
this.Blksize = Blksize_;
this.Blocks = Blocks_;
this.Atim = Atim_;
this.Mtim = Mtim_;
this.Ctim = Ctim_;
this.X__unused = X__unused_;
});
RawSockaddrInet4 = $pkg.RawSockaddrInet4 = $newType(0, $kindStruct, "syscall.RawSockaddrInet4", true, "syscall", true, function(Family_, Port_, Addr_, Zero_) {
this.$val = this;
if (arguments.length === 0) {
this.Family = 0;
this.Port = 0;
this.Addr = arrayType$8.zero();
this.Zero = arrayType$1.zero();
return;
}
this.Family = Family_;
this.Port = Port_;
this.Addr = Addr_;
this.Zero = Zero_;
});
RawSockaddrInet6 = $pkg.RawSockaddrInet6 = $newType(0, $kindStruct, "syscall.RawSockaddrInet6", true, "syscall", true, function(Family_, Port_, Flowinfo_, Addr_, Scope_id_) {
this.$val = this;
if (arguments.length === 0) {
this.Family = 0;
this.Port = 0;
this.Flowinfo = 0;
this.Addr = arrayType$2.zero();
this.Scope_id = 0;
return;
}
this.Family = Family_;
this.Port = Port_;
this.Flowinfo = Flowinfo_;
this.Addr = Addr_;
this.Scope_id = Scope_id_;
});
RawSockaddrUnix = $pkg.RawSockaddrUnix = $newType(0, $kindStruct, "syscall.RawSockaddrUnix", true, "syscall", true, function(Family_, Path_) {
this.$val = this;
if (arguments.length === 0) {
this.Family = 0;
this.Path = arrayType$7.zero();
return;
}
this.Family = Family_;
this.Path = Path_;
});
RawSockaddrLinklayer = $pkg.RawSockaddrLinklayer = $newType(0, $kindStruct, "syscall.RawSockaddrLinklayer", true, "syscall", true, function(Family_, Protocol_, Ifindex_, Hatype_, Pkttype_, Halen_, Addr_) {
this.$val = this;
if (arguments.length === 0) {
this.Family = 0;
this.Protocol = 0;
this.Ifindex = 0;
this.Hatype = 0;
this.Pkttype = 0;
this.Halen = 0;
this.Addr = arrayType$1.zero();
return;
}
this.Family = Family_;
this.Protocol = Protocol_;
this.Ifindex = Ifindex_;
this.Hatype = Hatype_;
this.Pkttype = Pkttype_;
this.Halen = Halen_;
this.Addr = Addr_;
});
RawSockaddrNetlink = $pkg.RawSockaddrNetlink = $newType(0, $kindStruct, "syscall.RawSockaddrNetlink", true, "syscall", true, function(Family_, Pad_, Pid_, Groups_) {
this.$val = this;
if (arguments.length === 0) {
this.Family = 0;
this.Pad = 0;
this.Pid = 0;
this.Groups = 0;
return;
}
this.Family = Family_;
this.Pad = Pad_;
this.Pid = Pid_;
this.Groups = Groups_;
});
RawSockaddr = $pkg.RawSockaddr = $newType(0, $kindStruct, "syscall.RawSockaddr", true, "syscall", true, function(Family_, Data_) {
this.$val = this;
if (arguments.length === 0) {
this.Family = 0;
this.Data = arrayType$9.zero();
return;
}
this.Family = Family_;
this.Data = Data_;
});
RawSockaddrAny = $pkg.RawSockaddrAny = $newType(0, $kindStruct, "syscall.RawSockaddrAny", true, "syscall", true, function(Addr_, Pad_) {
this.$val = this;
if (arguments.length === 0) {
this.Addr = new RawSockaddr.ptr(0, arrayType$9.zero());
this.Pad = arrayType$10.zero();
return;
}
this.Addr = Addr_;
this.Pad = Pad_;
});
_Socklen = $pkg._Socklen = $newType(4, $kindUint32, "syscall._Socklen", true, "syscall", false, null);
Linger = $pkg.Linger = $newType(0, $kindStruct, "syscall.Linger", true, "syscall", true, function(Onoff_, Linger_) {
this.$val = this;
if (arguments.length === 0) {
this.Onoff = 0;
this.Linger = 0;
return;
}
this.Onoff = Onoff_;
this.Linger = Linger_;
});
Iovec = $pkg.Iovec = $newType(0, $kindStruct, "syscall.Iovec", true, "syscall", true, function(Base_, Len_) {
this.$val = this;
if (arguments.length === 0) {
this.Base = ptrType$2.nil;
this.Len = new $Uint64(0, 0);
return;
}
this.Base = Base_;
this.Len = Len_;
});
IPMreq = $pkg.IPMreq = $newType(0, $kindStruct, "syscall.IPMreq", true, "syscall", true, function(Multiaddr_, Interface_) {
this.$val = this;
if (arguments.length === 0) {
this.Multiaddr = arrayType$8.zero();
this.Interface = arrayType$8.zero();
return;
}
this.Multiaddr = Multiaddr_;
this.Interface = Interface_;
});
IPMreqn = $pkg.IPMreqn = $newType(0, $kindStruct, "syscall.IPMreqn", true, "syscall", true, function(Multiaddr_, Address_, Ifindex_) {
this.$val = this;
if (arguments.length === 0) {
this.Multiaddr = arrayType$8.zero();
this.Address = arrayType$8.zero();
this.Ifindex = 0;
return;
}
this.Multiaddr = Multiaddr_;
this.Address = Address_;
this.Ifindex = Ifindex_;
});
IPv6Mreq = $pkg.IPv6Mreq = $newType(0, $kindStruct, "syscall.IPv6Mreq", true, "syscall", true, function(Multiaddr_, Interface_) {
this.$val = this;
if (arguments.length === 0) {
this.Multiaddr = arrayType$2.zero();
this.Interface = 0;
return;
}
this.Multiaddr = Multiaddr_;
this.Interface = Interface_;
});
Msghdr = $pkg.Msghdr = $newType(0, $kindStruct, "syscall.Msghdr", true, "syscall", true, function(Name_, Namelen_, Pad_cgo_0_, Iov_, Iovlen_, Control_, Controllen_, Flags_, Pad_cgo_1_) {
this.$val = this;
if (arguments.length === 0) {
this.Name = ptrType$2.nil;
this.Namelen = 0;
this.Pad_cgo_0 = arrayType$8.zero();
this.Iov = ptrType$19.nil;
this.Iovlen = new $Uint64(0, 0);
this.Control = ptrType$2.nil;
this.Controllen = new $Uint64(0, 0);
this.Flags = 0;
this.Pad_cgo_1 = arrayType$8.zero();
return;
}
this.Name = Name_;
this.Namelen = Namelen_;
this.Pad_cgo_0 = Pad_cgo_0_;
this.Iov = Iov_;
this.Iovlen = Iovlen_;
this.Control = Control_;
this.Controllen = Controllen_;
this.Flags = Flags_;
this.Pad_cgo_1 = Pad_cgo_1_;
});
sliceType = $sliceType($Uint8);
sliceType$1 = $sliceType($String);
ptrType$2 = $ptrType($Uint8);
ptrType$4 = $ptrType($Int32);
arrayType$1 = $arrayType($Uint8, 8);
ptrType$8 = $ptrType($Uint16);
arrayType$2 = $arrayType($Uint8, 16);
ptrType$11 = $ptrType(SockaddrNetlink);
arrayType$4 = $arrayType($Uint8, 32);
arrayType$7 = $arrayType($Int8, 108);
arrayType$8 = $arrayType($Uint8, 4);
arrayType$9 = $arrayType($Int8, 14);
arrayType$10 = $arrayType($Int8, 96);
ptrType$18 = $ptrType(_Socklen);
ptrType$19 = $ptrType(Iovec);
structType = $structType("syscall", [{prop: "addr", name: "addr", anonymous: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "len", name: "len", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "cap", name: "cap", anonymous: false, exported: false, typ: $Int, tag: ""}]);
ptrType$22 = $ptrType($Int64);
ptrType$24 = $ptrType(SockaddrLinklayer);
ptrType$25 = $ptrType(mmapper);
mapType = $mapType(ptrType$2, sliceType);
funcType$2 = $funcType([$Uintptr, $Uintptr, $Int, $Int, $Int, $Int64], [$Uintptr, $error], false);
funcType$3 = $funcType([$Uintptr, $Uintptr], [$error], false);
ptrType$26 = $ptrType(SockaddrInet4);
ptrType$27 = $ptrType(SockaddrInet6);
ptrType$28 = $ptrType(SockaddrUnix);
ptrType$29 = $ptrType(Timespec);
arrayType$15 = $arrayType($Int64, 3);
ptrType$31 = $ptrType(Msghdr);
init = function() {
$flushConsole = (function() {
if (!((lineBuffer.$length === 0))) {
$global.console.log($externalize(($bytesToString(lineBuffer)), $String));
lineBuffer = sliceType.nil;
}
});
};
printWarning = function() {
if (!warningPrinted) {
$global.console.error($externalize("warning: system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md", $String));
}
warningPrinted = true;
};
printToConsole = function(b) {
var b, goPrintToConsole, i;
goPrintToConsole = $global.goPrintToConsole;
if (!(goPrintToConsole === undefined)) {
goPrintToConsole(b);
return;
}
lineBuffer = $appendSlice(lineBuffer, b);
while (true) {
i = indexByte(lineBuffer, 10);
if (i === -1) {
break;
}
$global.console.log($externalize(($bytesToString($subslice(lineBuffer, 0, i))), $String));
lineBuffer = $subslice(lineBuffer, (i + 1 >> 0));
}
};
indexByte = function(s, c) {
var _i, _ref, b, c, i, s;
_ref = s;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
b = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
if (b === c) {
return i;
}
_i++;
}
return -1;
};
runtime_envs = function() {
var envkeys, envs$1, i, jsEnv, key, process;
process = $global.process;
if (process === undefined) {
return sliceType$1.nil;
}
jsEnv = process.env;
envkeys = $global.Object.keys(jsEnv);
envs$1 = $makeSlice(sliceType$1, $parseInt(envkeys.length));
i = 0;
while (true) {
if (!(i < $parseInt(envkeys.length))) { break; }
key = $internalize(envkeys[i], $String);
((i < 0 || i >= envs$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : envs$1.$array[envs$1.$offset + i] = key + "=" + $internalize(jsEnv[$externalize(key, $String)], $String));
i = i + (1) >> 0;
}
return envs$1;
};
syscall = function(name) {
var name, require, $deferred;
/* */ var $err = null; try { $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
$deferred.push([(function() {
$recover();
}), []]);
if (syscallModule === null) {
if (alreadyTriedToLoad) {
return null;
}
alreadyTriedToLoad = true;
require = $global.require;
if (require === undefined) {
$panic(new $String(""));
}
syscallModule = require($externalize("syscall", $String));
}
return syscallModule[$externalize(name, $String)];
/* */ } catch(err) { $err = err; return null; } finally { $callDeferred($deferred, $err); }
};
Syscall = function(trap, a1, a2, a3) {
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, a1, a2, a3, array, err, f, r, r1, r2, slice, trap;
r1 = 0;
r2 = 0;
err = 0;
f = syscall("Syscall");
if (!(f === null)) {
r = f(trap, a1, a2, a3);
_tmp = ((($parseInt(r[0]) >> 0) >>> 0));
_tmp$1 = ((($parseInt(r[1]) >> 0) >>> 0));
_tmp$2 = ((($parseInt(r[2]) >> 0) >>> 0));
r1 = _tmp;
r2 = _tmp$1;
err = _tmp$2;
return [r1, r2, err];
}
if ((trap === 1) && ((a1 === 1) || (a1 === 2))) {
array = a2;
slice = $makeSlice(sliceType, $parseInt(array.length));
slice.$array = array;
printToConsole(slice);
_tmp$3 = (($parseInt(array.length) >>> 0));
_tmp$4 = 0;
_tmp$5 = 0;
r1 = _tmp$3;
r2 = _tmp$4;
err = _tmp$5;
return [r1, r2, err];
}
if (trap === 60) {
runtime.Goexit();
}
printWarning();
_tmp$6 = ((minusOne >>> 0));
_tmp$7 = 0;
_tmp$8 = 13;
r1 = _tmp$6;
r2 = _tmp$7;
err = _tmp$8;
return [r1, r2, err];
};
$pkg.Syscall = Syscall;
Syscall6 = function(trap, a1, a2, a3, a4, a5, a6) {
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, a1, a2, a3, a4, a5, a6, err, f, r, r1, r2, trap;
r1 = 0;
r2 = 0;
err = 0;
f = syscall("Syscall6");
if (!(f === null)) {
r = f(trap, a1, a2, a3, a4, a5, a6);
_tmp = ((($parseInt(r[0]) >> 0) >>> 0));
_tmp$1 = ((($parseInt(r[1]) >> 0) >>> 0));
_tmp$2 = ((($parseInt(r[2]) >> 0) >>> 0));
r1 = _tmp;
r2 = _tmp$1;
err = _tmp$2;
return [r1, r2, err];
}
if (!((trap === 202))) {
printWarning();
}
_tmp$3 = ((minusOne >>> 0));
_tmp$4 = 0;
_tmp$5 = 13;
r1 = _tmp$3;
r2 = _tmp$4;
err = _tmp$5;
return [r1, r2, err];
};
$pkg.Syscall6 = Syscall6;
BytePtrFromString = function(s) {
var _i, _ref, array, b, i, s;
array = new ($global.Uint8Array)(s.length + 1 >> 0);
_ref = (new sliceType($stringToBytes(s)));
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
b = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
if (b === 0) {
return [ptrType$2.nil, new Errno(22)];
}
array[i] = b;
_i++;
}
array[s.length] = 0;
return [((array)), $ifaceNil];
};
$pkg.BytePtrFromString = BytePtrFromString;
readInt = function(b, off, size) {
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, b, off, ok, size, u;
u = new $Uint64(0, 0);
ok = false;
if (b.$length < (((off + size >>> 0) >> 0))) {
_tmp = new $Uint64(0, 0);
_tmp$1 = false;
u = _tmp;
ok = _tmp$1;
return [u, ok];
}
if (false) {
_tmp$2 = readIntBE($subslice(b, off), size);
_tmp$3 = true;
u = _tmp$2;
ok = _tmp$3;
return [u, ok];
}
_tmp$4 = readIntLE($subslice(b, off), size);
_tmp$5 = true;
u = _tmp$4;
ok = _tmp$5;
return [u, ok];
};
readIntBE = function(b, size) {
var _1, b, size, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$18, x$19, x$2, x$20, x$21, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
_1 = size;
if (_1 === (1)) {
return (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0])));
} else if (_1 === (2)) {
$unused((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]));
return (x = (new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), x$1 = $shiftLeft64((new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), 8), new $Uint64(x.$high | x$1.$high, (x.$low | x$1.$low) >>> 0));
} else if (_1 === (4)) {
$unused((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]));
return (x$2 = (x$3 = (x$4 = (new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), x$5 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 8), new $Uint64(x$4.$high | x$5.$high, (x$4.$low | x$5.$low) >>> 0)), x$6 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 16), new $Uint64(x$3.$high | x$6.$high, (x$3.$low | x$6.$low) >>> 0)), x$7 = $shiftLeft64((new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), 24), new $Uint64(x$2.$high | x$7.$high, (x$2.$low | x$7.$low) >>> 0));
} else if (_1 === (8)) {
$unused((7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]));
return (x$8 = (x$9 = (x$10 = (x$11 = (x$12 = (x$13 = (x$14 = (new $Uint64(0, (7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]))), x$15 = $shiftLeft64((new $Uint64(0, (6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6]))), 8), new $Uint64(x$14.$high | x$15.$high, (x$14.$low | x$15.$low) >>> 0)), x$16 = $shiftLeft64((new $Uint64(0, (5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5]))), 16), new $Uint64(x$13.$high | x$16.$high, (x$13.$low | x$16.$low) >>> 0)), x$17 = $shiftLeft64((new $Uint64(0, (4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4]))), 24), new $Uint64(x$12.$high | x$17.$high, (x$12.$low | x$17.$low) >>> 0)), x$18 = $shiftLeft64((new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), 32), new $Uint64(x$11.$high | x$18.$high, (x$11.$low | x$18.$low) >>> 0)), x$19 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 40), new $Uint64(x$10.$high | x$19.$high, (x$10.$low | x$19.$low) >>> 0)), x$20 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 48), new $Uint64(x$9.$high | x$20.$high, (x$9.$low | x$20.$low) >>> 0)), x$21 = $shiftLeft64((new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), 56), new $Uint64(x$8.$high | x$21.$high, (x$8.$low | x$21.$low) >>> 0));
} else {
$panic(new $String("syscall: readInt with unsupported size"));
}
};
readIntLE = function(b, size) {
var _1, b, size, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$16, x$17, x$18, x$19, x$2, x$20, x$21, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
_1 = size;
if (_1 === (1)) {
return (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0])));
} else if (_1 === (2)) {
$unused((1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]));
return (x = (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), x$1 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 8), new $Uint64(x.$high | x$1.$high, (x.$low | x$1.$low) >>> 0));
} else if (_1 === (4)) {
$unused((3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]));
return (x$2 = (x$3 = (x$4 = (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), x$5 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 8), new $Uint64(x$4.$high | x$5.$high, (x$4.$low | x$5.$low) >>> 0)), x$6 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 16), new $Uint64(x$3.$high | x$6.$high, (x$3.$low | x$6.$low) >>> 0)), x$7 = $shiftLeft64((new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), 24), new $Uint64(x$2.$high | x$7.$high, (x$2.$low | x$7.$low) >>> 0));
} else if (_1 === (8)) {
$unused((7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]));
return (x$8 = (x$9 = (x$10 = (x$11 = (x$12 = (x$13 = (x$14 = (new $Uint64(0, (0 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 0]))), x$15 = $shiftLeft64((new $Uint64(0, (1 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 1]))), 8), new $Uint64(x$14.$high | x$15.$high, (x$14.$low | x$15.$low) >>> 0)), x$16 = $shiftLeft64((new $Uint64(0, (2 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 2]))), 16), new $Uint64(x$13.$high | x$16.$high, (x$13.$low | x$16.$low) >>> 0)), x$17 = $shiftLeft64((new $Uint64(0, (3 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 3]))), 24), new $Uint64(x$12.$high | x$17.$high, (x$12.$low | x$17.$low) >>> 0)), x$18 = $shiftLeft64((new $Uint64(0, (4 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 4]))), 32), new $Uint64(x$11.$high | x$18.$high, (x$11.$low | x$18.$low) >>> 0)), x$19 = $shiftLeft64((new $Uint64(0, (5 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 5]))), 40), new $Uint64(x$10.$high | x$19.$high, (x$10.$low | x$19.$low) >>> 0)), x$20 = $shiftLeft64((new $Uint64(0, (6 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 6]))), 48), new $Uint64(x$9.$high | x$20.$high, (x$9.$low | x$20.$low) >>> 0)), x$21 = $shiftLeft64((new $Uint64(0, (7 >= b.$length ? ($throwRuntimeError("index out of range"), undefined) : b.$array[b.$offset + 7]))), 56), new $Uint64(x$8.$high | x$21.$high, (x$8.$low | x$21.$low) >>> 0));
} else {
$panic(new $String("syscall: readInt with unsupported size"));
}
};
ParseDirent = function(buf, max, names) {
var _i, _ref, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, _tuple$1, _tuple$2, buf, c, consumed, count, i, ino, max, name, names, namlen, newnames, ok, origlen, rec, reclen, x, x$1, x$2;
consumed = 0;
count = 0;
newnames = sliceType$1.nil;
origlen = buf.$length;
count = 0;
while (true) {
if (!(!((max === 0)) && buf.$length > 0)) { break; }
_tuple = direntReclen(buf);
reclen = _tuple[0];
ok = _tuple[1];
if (!ok || (x = (new $Uint64(0, buf.$length)), (reclen.$high > x.$high || (reclen.$high === x.$high && reclen.$low > x.$low)))) {
_tmp = origlen;
_tmp$1 = count;
_tmp$2 = names;
consumed = _tmp;
count = _tmp$1;
newnames = _tmp$2;
return [consumed, count, newnames];
}
rec = $subslice(buf, 0, $flatten64(reclen));
buf = $subslice(buf, $flatten64(reclen));
_tuple$1 = direntIno(rec);
ino = _tuple$1[0];
ok = _tuple$1[1];
if (!ok) {
break;
}
if ((ino.$high === 0 && ino.$low === 0)) {
continue;
}
_tuple$2 = direntNamlen(rec);
namlen = _tuple$2[0];
ok = _tuple$2[1];
if (!ok || (x$1 = new $Uint64(0 + namlen.$high, 19 + namlen.$low), x$2 = (new $Uint64(0, rec.$length)), (x$1.$high > x$2.$high || (x$1.$high === x$2.$high && x$1.$low > x$2.$low)))) {
break;
}
name = $subslice(rec, 19, $flatten64(new $Uint64(0 + namlen.$high, 19 + namlen.$low)));
_ref = name;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
c = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
if (c === 0) {
name = $subslice(name, 0, i);
break;
}
_i++;
}
if (($bytesToString(name)) === "." || ($bytesToString(name)) === "..") {
continue;
}
max = max - (1) >> 0;
count = count + (1) >> 0;
names = $append(names, ($bytesToString(name)));
}
_tmp$3 = origlen - buf.$length >> 0;
_tmp$4 = count;
_tmp$5 = names;
consumed = _tmp$3;
count = _tmp$4;
newnames = _tmp$5;
return [consumed, count, newnames];
};
$pkg.ParseDirent = ParseDirent;
CloseOnExec = function(fd) {
var fd;
fcntl(fd, 2, 1);
};
$pkg.CloseOnExec = CloseOnExec;
SetNonblock = function(fd, nonblocking) {
var _tuple, _tuple$1, err, fd, flag, nonblocking;
err = $ifaceNil;
_tuple = fcntl(fd, 3, 0);
flag = _tuple[0];
err = _tuple[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
err = err;
return err;
}
if (nonblocking) {
flag = flag | (2048);
} else {
flag = (flag & ~(2048)) >> 0;
}
_tuple$1 = fcntl(fd, 4, flag);
err = _tuple$1[1];
err = err;
return err;
};
$pkg.SetNonblock = SetNonblock;
msanRead = function(addr, len) {
var addr, len;
};
msanWrite = function(addr, len) {
var addr, len;
};
itoa = function(val) {
var val;
if (val < 0) {
return "-" + uitoa(((-val >>> 0)));
}
return uitoa(((val >>> 0)));
};
uitoa = function(val) {
var _q, _r, buf, i, val;
buf = arrayType$4.zero();
i = 31;
while (true) {
if (!(val >= 10)) { break; }
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = ((((_r = val % 10, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) + 48 >>> 0) << 24 >>> 24)));
i = i - (1) >> 0;
val = (_q = val / (10), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
}
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = (((val + 48 >>> 0) << 24 >>> 24)));
return ($bytesToString($subslice(new sliceType(buf), i)));
};
Timespec.ptr.prototype.Unix = function() {
var _tmp, _tmp$1, nsec, sec, ts;
sec = new $Int64(0, 0);
nsec = new $Int64(0, 0);
ts = this;
_tmp = (ts.Sec);
_tmp$1 = (ts.Nsec);
sec = _tmp;
nsec = _tmp$1;
return [sec, nsec];
};
Timespec.prototype.Unix = function() { return this.$val.Unix(); };
Timespec.ptr.prototype.Nano = function() {
var ts, x, x$1;
ts = this;
return (x = $mul64((ts.Sec), new $Int64(0, 1000000000)), x$1 = (ts.Nsec), new $Int64(x.$high + x$1.$high, x.$low + x$1.$low));
};
Timespec.prototype.Nano = function() { return this.$val.Nano(); };
SockaddrInet4.ptr.prototype.sockaddr = function() {
var _array, _struct, _view, i, p, sa, x, x$1, x$2;
sa = this;
if (sa.Port < 0 || sa.Port > 65535) {
return [0, 0, new Errno(22)];
}
sa.raw.Family = 2;
p = (((x = sa.raw, (x.$ptr_Port || (x.$ptr_Port = new ptrType$8(function() { return this.$target.Port; }, function($v) { this.$target.Port = $v; }, x))))));
p.nilCheck, p[0] = (((sa.Port >> 8 >> 0) << 24 >>> 24));
p.nilCheck, p[1] = ((sa.Port << 24 >>> 24));
i = 0;
while (true) {
if (!(i < 4)) { break; }
(x$2 = sa.raw.Addr, ((i < 0 || i >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[i] = (x$1 = sa.Addr, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i]))));
i = i + (1) >> 0;
}
_array = new Uint8Array(16);
return [(_array), 16, $ifaceNil];
};
SockaddrInet4.prototype.sockaddr = function() { return this.$val.sockaddr(); };
SockaddrInet6.ptr.prototype.sockaddr = function() {
var _array, _struct, _view, i, p, sa, x, x$1, x$2;
sa = this;
if (sa.Port < 0 || sa.Port > 65535) {
return [0, 0, new Errno(22)];
}
sa.raw.Family = 10;
p = (((x = sa.raw, (x.$ptr_Port || (x.$ptr_Port = new ptrType$8(function() { return this.$target.Port; }, function($v) { this.$target.Port = $v; }, x))))));
p.nilCheck, p[0] = (((sa.Port >> 8 >> 0) << 24 >>> 24));
p.nilCheck, p[1] = ((sa.Port << 24 >>> 24));
sa.raw.Scope_id = sa.ZoneId;
i = 0;
while (true) {
if (!(i < 16)) { break; }
(x$2 = sa.raw.Addr, ((i < 0 || i >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[i] = (x$1 = sa.Addr, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i]))));
i = i + (1) >> 0;
}
_array = new Uint8Array(28);
return [(_array), 28, $ifaceNil];
};
SockaddrInet6.prototype.sockaddr = function() { return this.$val.sockaddr(); };
SockaddrUnix.ptr.prototype.sockaddr = function() {
var _array, _struct, _view, i, n, name, sa, sl, x;
sa = this;
name = sa.Name;
n = name.length;
if (n >= 108) {
return [0, 0, new Errno(22)];
}
sa.raw.Family = 1;
i = 0;
while (true) {
if (!(i < n)) { break; }
(x = sa.raw.Path, ((i < 0 || i >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[i] = ((name.charCodeAt(i) << 24 >> 24))));
i = i + (1) >> 0;
}
sl = 2;
if (n > 0) {
sl = sl + ((((n >>> 0)) + 1 >>> 0)) >>> 0;
}
if (sa.raw.Path[0] === 64) {
sa.raw.Path[0] = 0;
sl = sl - (1) >>> 0;
}
_array = new Uint8Array(110);
return [(_array), sl, $ifaceNil];
};
SockaddrUnix.prototype.sockaddr = function() { return this.$val.sockaddr(); };
SockaddrLinklayer.ptr.prototype.sockaddr = function() {
var _array, _struct, _view, i, sa, x, x$1;
sa = this;
if (sa.Ifindex < 0 || sa.Ifindex > 2147483647) {
return [0, 0, new Errno(22)];
}
sa.raw.Family = 17;
sa.raw.Protocol = sa.Protocol;
sa.raw.Ifindex = ((sa.Ifindex >> 0));
sa.raw.Hatype = sa.Hatype;
sa.raw.Pkttype = sa.Pkttype;
sa.raw.Halen = sa.Halen;
i = 0;
while (true) {
if (!(i < 8)) { break; }
(x$1 = sa.raw.Addr, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i] = (x = sa.Addr, ((i < 0 || i >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[i]))));
i = i + (1) >> 0;
}
_array = new Uint8Array(20);
return [(_array), 20, $ifaceNil];
};
SockaddrLinklayer.prototype.sockaddr = function() { return this.$val.sockaddr(); };
SockaddrNetlink.ptr.prototype.sockaddr = function() {
var _array, _struct, _view, sa;
sa = this;
sa.raw.Family = 16;
sa.raw.Pad = sa.Pad;
sa.raw.Pid = sa.Pid;
sa.raw.Groups = sa.Groups;
_array = new Uint8Array(12);
return [(_array), 12, $ifaceNil];
};
SockaddrNetlink.prototype.sockaddr = function() { return this.$val.sockaddr(); };
anyToSockaddr = function(rsa) {
var _1, _array, _array$1, _array$2, _array$3, _array$4, _array$5, _array$6, _array$7, _array$8, _array$9, _struct, _struct$1, _struct$2, _struct$3, _struct$4, _struct$5, _struct$6, _struct$7, _struct$8, _struct$9, _view, _view$1, _view$2, _view$3, _view$4, _view$5, _view$6, _view$7, _view$8, _view$9, bytes, i, i$1, i$2, n, p, p$1, pp, pp$1, pp$2, pp$3, pp$4, rsa, sa, sa$1, sa$2, sa$3, sa$4, x, x$1, x$2, x$3, x$4, x$5, x$6;
_1 = rsa.Addr.Family;
if (_1 === (16)) {
_array$1 = new Uint8Array(112);
pp = ((_array = (_array$1), _struct = new RawSockaddrNetlink.ptr(0, 0, 0, 0), _view = new DataView(_array.buffer, _array.byteOffset), _struct.Family = _view.getUint16(0, true), _struct.Pad = _view.getUint16(2, true), _struct.Pid = _view.getUint32(4, true), _struct.Groups = _view.getUint32(8, true), _struct));
_struct$1 = rsa, _view$1 = new DataView(_array$1.buffer, _array$1.byteOffset), _struct$1.Addr.Family = _view$1.getUint16(0, true), _struct$1.Addr.Data = new ($nativeArray($kindInt8))(_array$1.buffer, $min(_array$1.byteOffset + 2, _array$1.buffer.byteLength)), _struct$1.Pad = new ($nativeArray($kindInt8))(_array$1.buffer, $min(_array$1.byteOffset + 16, _array$1.buffer.byteLength));
sa = new SockaddrNetlink.ptr(0, 0, 0, 0, new RawSockaddrNetlink.ptr(0, 0, 0, 0));
sa.Family = pp.Family;
sa.Pad = pp.Pad;
sa.Pid = pp.Pid;
sa.Groups = pp.Groups;
return [sa, $ifaceNil];
} else if (_1 === (17)) {
_array$3 = new Uint8Array(112);
pp$1 = ((_array$2 = (_array$3), _struct$2 = new RawSockaddrLinklayer.ptr(0, 0, 0, 0, 0, 0, arrayType$1.zero()), _view$2 = new DataView(_array$2.buffer, _array$2.byteOffset), _struct$2.Family = _view$2.getUint16(0, true), _struct$2.Protocol = _view$2.getUint16(2, true), _struct$2.Ifindex = _view$2.getInt32(4, true), _struct$2.Hatype = _view$2.getUint16(8, true), _struct$2.Pkttype = _view$2.getUint8(10, true), _struct$2.Halen = _view$2.getUint8(11, true), _struct$2.Addr = new ($nativeArray($kindUint8))(_array$2.buffer, $min(_array$2.byteOffset + 12, _array$2.buffer.byteLength)), _struct$2));
_struct$3 = rsa, _view$3 = new DataView(_array$3.buffer, _array$3.byteOffset), _struct$3.Addr.Family = _view$3.getUint16(0, true), _struct$3.Addr.Data = new ($nativeArray($kindInt8))(_array$3.buffer, $min(_array$3.byteOffset + 2, _array$3.buffer.byteLength)), _struct$3.Pad = new ($nativeArray($kindInt8))(_array$3.buffer, $min(_array$3.byteOffset + 16, _array$3.buffer.byteLength));
sa$1 = new SockaddrLinklayer.ptr(0, 0, 0, 0, 0, arrayType$1.zero(), new RawSockaddrLinklayer.ptr(0, 0, 0, 0, 0, 0, arrayType$1.zero()));
sa$1.Protocol = pp$1.Protocol;
sa$1.Ifindex = ((pp$1.Ifindex >> 0));
sa$1.Hatype = pp$1.Hatype;
sa$1.Pkttype = pp$1.Pkttype;
sa$1.Halen = pp$1.Halen;
i = 0;
while (true) {
if (!(i < 8)) { break; }
(x$1 = sa$1.Addr, ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i] = (x = pp$1.Addr, ((i < 0 || i >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[i]))));
i = i + (1) >> 0;
}
return [sa$1, $ifaceNil];
} else if (_1 === (1)) {
_array$5 = new Uint8Array(112);
pp$2 = ((_array$4 = (_array$5), _struct$4 = new RawSockaddrUnix.ptr(0, arrayType$7.zero()), _view$4 = new DataView(_array$4.buffer, _array$4.byteOffset), _struct$4.Family = _view$4.getUint16(0, true), _struct$4.Path = new ($nativeArray($kindInt8))(_array$4.buffer, $min(_array$4.byteOffset + 2, _array$4.buffer.byteLength)), _struct$4));
_struct$5 = rsa, _view$5 = new DataView(_array$5.buffer, _array$5.byteOffset), _struct$5.Addr.Family = _view$5.getUint16(0, true), _struct$5.Addr.Data = new ($nativeArray($kindInt8))(_array$5.buffer, $min(_array$5.byteOffset + 2, _array$5.buffer.byteLength)), _struct$5.Pad = new ($nativeArray($kindInt8))(_array$5.buffer, $min(_array$5.byteOffset + 16, _array$5.buffer.byteLength));
sa$2 = new SockaddrUnix.ptr("", new RawSockaddrUnix.ptr(0, arrayType$7.zero()));
if (pp$2.Path[0] === 0) {
pp$2.Path[0] = 64;
}
n = 0;
while (true) {
if (!(n < 108 && !(((x$2 = pp$2.Path, ((n < 0 || n >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[n])) === 0)))) { break; }
n = n + (1) >> 0;
}
bytes = $subslice(new sliceType((($sliceToArray(new sliceType(pp$2.Path))))), 0, n);
sa$2.Name = ($bytesToString(bytes));
return [sa$2, $ifaceNil];
} else if (_1 === (2)) {
_array$7 = new Uint8Array(112);
pp$3 = ((_array$6 = (_array$7), _struct$6 = new RawSockaddrInet4.ptr(0, 0, arrayType$8.zero(), arrayType$1.zero()), _view$6 = new DataView(_array$6.buffer, _array$6.byteOffset), _struct$6.Family = _view$6.getUint16(0, true), _struct$6.Port = _view$6.getUint16(2, true), _struct$6.Addr = new ($nativeArray($kindUint8))(_array$6.buffer, $min(_array$6.byteOffset + 4, _array$6.buffer.byteLength)), _struct$6.Zero = new ($nativeArray($kindUint8))(_array$6.buffer, $min(_array$6.byteOffset + 8, _array$6.buffer.byteLength)), _struct$6));
_struct$7 = rsa, _view$7 = new DataView(_array$7.buffer, _array$7.byteOffset), _struct$7.Addr.Family = _view$7.getUint16(0, true), _struct$7.Addr.Data = new ($nativeArray($kindInt8))(_array$7.buffer, $min(_array$7.byteOffset + 2, _array$7.buffer.byteLength)), _struct$7.Pad = new ($nativeArray($kindInt8))(_array$7.buffer, $min(_array$7.byteOffset + 16, _array$7.buffer.byteLength));
sa$3 = new SockaddrInet4.ptr(0, arrayType$8.zero(), new RawSockaddrInet4.ptr(0, 0, arrayType$8.zero(), arrayType$1.zero()));
p = (((pp$3.$ptr_Port || (pp$3.$ptr_Port = new ptrType$8(function() { return this.$target.Port; }, function($v) { this.$target.Port = $v; }, pp$3)))));
sa$3.Port = ((((p.nilCheck, p[0]) >> 0)) << 8 >> 0) + (((p.nilCheck, p[1]) >> 0)) >> 0;
i$1 = 0;
while (true) {
if (!(i$1 < 4)) { break; }
(x$4 = sa$3.Addr, ((i$1 < 0 || i$1 >= x$4.length) ? ($throwRuntimeError("index out of range"), undefined) : x$4[i$1] = (x$3 = pp$3.Addr, ((i$1 < 0 || i$1 >= x$3.length) ? ($throwRuntimeError("index out of range"), undefined) : x$3[i$1]))));
i$1 = i$1 + (1) >> 0;
}
return [sa$3, $ifaceNil];
} else if (_1 === (10)) {
_array$9 = new Uint8Array(112);
pp$4 = ((_array$8 = (_array$9), _struct$8 = new RawSockaddrInet6.ptr(0, 0, 0, arrayType$2.zero(), 0), _view$8 = new DataView(_array$8.buffer, _array$8.byteOffset), _struct$8.Family = _view$8.getUint16(0, true), _struct$8.Port = _view$8.getUint16(2, true), _struct$8.Flowinfo = _view$8.getUint32(4, true), _struct$8.Addr = new ($nativeArray($kindUint8))(_array$8.buffer, $min(_array$8.byteOffset + 8, _array$8.buffer.byteLength)), _struct$8.Scope_id = _view$8.getUint32(24, true), _struct$8));
_struct$9 = rsa, _view$9 = new DataView(_array$9.buffer, _array$9.byteOffset), _struct$9.Addr.Family = _view$9.getUint16(0, true), _struct$9.Addr.Data = new ($nativeArray($kindInt8))(_array$9.buffer, $min(_array$9.byteOffset + 2, _array$9.buffer.byteLength)), _struct$9.Pad = new ($nativeArray($kindInt8))(_array$9.buffer, $min(_array$9.byteOffset + 16, _array$9.buffer.byteLength));
sa$4 = new SockaddrInet6.ptr(0, 0, arrayType$2.zero(), new RawSockaddrInet6.ptr(0, 0, 0, arrayType$2.zero(), 0));
p$1 = (((pp$4.$ptr_Port || (pp$4.$ptr_Port = new ptrType$8(function() { return this.$target.Port; }, function($v) { this.$target.Port = $v; }, pp$4)))));
sa$4.Port = ((((p$1.nilCheck, p$1[0]) >> 0)) << 8 >> 0) + (((p$1.nilCheck, p$1[1]) >> 0)) >> 0;
sa$4.ZoneId = pp$4.Scope_id;
i$2 = 0;
while (true) {
if (!(i$2 < 16)) { break; }
(x$6 = sa$4.Addr, ((i$2 < 0 || i$2 >= x$6.length) ? ($throwRuntimeError("index out of range"), undefined) : x$6[i$2] = (x$5 = pp$4.Addr, ((i$2 < 0 || i$2 >= x$5.length) ? ($throwRuntimeError("index out of range"), undefined) : x$5[i$2]))));
i$2 = i$2 + (1) >> 0;
}
return [sa$4, $ifaceNil];
}
return [$ifaceNil, new Errno(97)];
};
Accept = function(fd) {
var _tuple, _tuple$1, err, fd, len, len$24ptr, nfd, rsa, sa;
nfd = 0;
sa = $ifaceNil;
err = $ifaceNil;
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$9.zero()), arrayType$10.zero());
len = 112;
_tuple = accept(fd, rsa, (len$24ptr || (len$24ptr = new ptrType$18(function() { return len; }, function($v) { len = $v; }))));
nfd = _tuple[0];
err = _tuple[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
return [nfd, sa, err];
}
_tuple$1 = anyToSockaddr(rsa);
sa = _tuple$1[0];
err = _tuple$1[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
Close(nfd);
nfd = 0;
}
return [nfd, sa, err];
};
$pkg.Accept = Accept;
Accept4 = function(fd, flags) {
var _tuple, _tuple$1, err, fd, flags, len, len$24ptr, nfd, rsa, sa;
nfd = 0;
sa = $ifaceNil;
err = $ifaceNil;
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$9.zero()), arrayType$10.zero());
len = 112;
_tuple = accept4(fd, rsa, (len$24ptr || (len$24ptr = new ptrType$18(function() { return len; }, function($v) { len = $v; }))), flags);
nfd = _tuple[0];
err = _tuple[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
return [nfd, sa, err];
}
if (len > 112) {
$panic(new $String("RawSockaddrAny too small"));
}
_tuple$1 = anyToSockaddr(rsa);
sa = _tuple$1[0];
err = _tuple$1[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
Close(nfd);
nfd = 0;
}
return [nfd, sa, err];
};
$pkg.Accept4 = Accept4;
SetsockoptIPMreqn = function(fd, level, opt, mreq) {
var _array, _struct, _view, err, fd, level, mreq, opt;
err = $ifaceNil;
_array = new Uint8Array(12);
err = setsockopt(fd, level, opt, (_array), 12);
_struct = mreq, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Multiaddr = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 0, _array.buffer.byteLength)), _struct.Address = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 4, _array.buffer.byteLength)), _struct.Ifindex = _view.getInt32(8, true);
return err;
};
$pkg.SetsockoptIPMreqn = SetsockoptIPMreqn;
Recvmsg = function(fd, p, oob, flags) {
var _array, _struct, _tuple, _tuple$1, _view, dummy, dummy$24ptr, err, fd, flags, from, iov, msg, n, oob, oobn, p, recvflags, rsa;
n = 0;
oobn = 0;
recvflags = 0;
from = $ifaceNil;
err = $ifaceNil;
msg = new Msghdr.ptr(ptrType$2.nil, 0, arrayType$8.zero(), ptrType$19.nil, new $Uint64(0, 0), ptrType$2.nil, new $Uint64(0, 0), 0, arrayType$8.zero());
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$9.zero()), arrayType$10.zero());
_array = new Uint8Array(112);
msg.Name = ((_array));
_struct = rsa, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
msg.Namelen = 112;
iov = new Iovec.ptr(ptrType$2.nil, new $Uint64(0, 0));
if (p.$length > 0) {
iov.Base = (($sliceToArray(p)));
iov.SetLen(p.$length);
}
dummy = 0;
if (oob.$length > 0) {
if (p.$length === 0) {
iov.Base = (dummy$24ptr || (dummy$24ptr = new ptrType$2(function() { return dummy; }, function($v) { dummy = $v; })));
iov.SetLen(1);
}
msg.Control = (($sliceToArray(oob)));
msg.SetControllen(oob.$length);
}
msg.Iov = iov;
msg.Iovlen = new $Uint64(0, 1);
_tuple = recvmsg(fd, msg, flags);
n = _tuple[0];
err = _tuple[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
return [n, oobn, recvflags, from, err];
}
oobn = ((msg.Controllen.$low >> 0));
recvflags = ((msg.Flags >> 0));
if (!((rsa.Addr.Family === 0))) {
_tuple$1 = anyToSockaddr(rsa);
from = _tuple$1[0];
err = _tuple$1[1];
}
return [n, oobn, recvflags, from, err];
};
$pkg.Recvmsg = Recvmsg;
SendmsgN = function(fd, p, oob, to, flags) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, _tuple$1, dummy, err, err$1, fd, flags, iov, msg, n, oob, p, ptr, salen, to, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; dummy = $f.dummy; err = $f.err; err$1 = $f.err$1; fd = $f.fd; flags = $f.flags; iov = $f.iov; msg = $f.msg; n = $f.n; oob = $f.oob; p = $f.p; ptr = $f.ptr; salen = $f.salen; to = $f.to; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
dummy = [dummy];
iov = [iov];
msg = [msg];
n = 0;
err = $ifaceNil;
ptr = 0;
salen = 0;
/* */ if (!($interfaceIsEqual(to, $ifaceNil))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!($interfaceIsEqual(to, $ifaceNil))) { */ case 1:
err$1 = $ifaceNil;
_r = to.sockaddr(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
ptr = _tuple[0];
salen = _tuple[1];
err$1 = _tuple[2];
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
_tmp = 0;
_tmp$1 = err$1;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
}
/* } */ case 2:
msg[0] = new Msghdr.ptr(ptrType$2.nil, 0, arrayType$8.zero(), ptrType$19.nil, new $Uint64(0, 0), ptrType$2.nil, new $Uint64(0, 0), 0, arrayType$8.zero());
msg[0].Name = ((ptr));
msg[0].Namelen = ((salen >>> 0));
iov[0] = new Iovec.ptr(ptrType$2.nil, new $Uint64(0, 0));
if (p.$length > 0) {
iov[0].Base = (($sliceToArray(p)));
iov[0].SetLen(p.$length);
}
dummy[0] = 0;
if (oob.$length > 0) {
if (p.$length === 0) {
iov[0].Base = (dummy.$ptr || (dummy.$ptr = new ptrType$2(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, dummy)));
iov[0].SetLen(1);
}
msg[0].Control = (($sliceToArray(oob)));
msg[0].SetControllen(oob.$length);
}
msg[0].Iov = iov[0];
msg[0].Iovlen = new $Uint64(0, 1);
_tuple$1 = sendmsg(fd, msg[0], flags);
n = _tuple$1[0];
err = _tuple$1[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
_tmp$2 = 0;
_tmp$3 = err;
n = _tmp$2;
err = _tmp$3;
$s = -1; return [n, err];
}
if (oob.$length > 0 && (p.$length === 0)) {
n = 0;
}
_tmp$4 = n;
_tmp$5 = $ifaceNil;
n = _tmp$4;
err = _tmp$5;
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: SendmsgN }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.dummy = dummy; $f.err = err; $f.err$1 = err$1; $f.fd = fd; $f.flags = flags; $f.iov = iov; $f.msg = msg; $f.n = n; $f.oob = oob; $f.p = p; $f.ptr = ptr; $f.salen = salen; $f.to = to; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.SendmsgN = SendmsgN;
ReadDirent = function(fd, buf) {
var _tuple, buf, err, fd, n;
n = 0;
err = $ifaceNil;
_tuple = Getdents(fd, buf);
n = _tuple[0];
err = _tuple[1];
return [n, err];
};
$pkg.ReadDirent = ReadDirent;
direntIno = function(buf) {
var buf;
return readInt(buf, 0, 8);
};
direntReclen = function(buf) {
var buf;
return readInt(buf, 16, 2);
};
direntNamlen = function(buf) {
var _tuple, buf, ok, reclen;
_tuple = direntReclen(buf);
reclen = _tuple[0];
ok = _tuple[1];
if (!ok) {
return [new $Uint64(0, 0), false];
}
return [new $Uint64(reclen.$high - 0, reclen.$low - 19), true];
};
Iovec.ptr.prototype.SetLen = function(length) {
var iov, length;
iov = this;
iov.Len = (new $Uint64(0, length));
};
Iovec.prototype.SetLen = function(length) { return this.$val.SetLen(length); };
Msghdr.ptr.prototype.SetControllen = function(length) {
var length, msghdr;
msghdr = this;
msghdr.Controllen = (new $Uint64(0, length));
};
Msghdr.prototype.SetControllen = function(length) { return this.$val.SetControllen(length); };
mmapper.ptr.prototype.Mmap = function(fd, offset, length, prot, flags) {
var _key, _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, addr, b, data, err, errno, fd, flags, length, m, offset, p, prot, sl, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _key = $f._key; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; addr = $f.addr; b = $f.b; data = $f.data; err = $f.err; errno = $f.errno; fd = $f.fd; flags = $f.flags; length = $f.length; m = $f.m; offset = $f.offset; p = $f.p; prot = $f.prot; sl = $f.sl; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
sl = [sl];
data = sliceType.nil;
err = $ifaceNil;
m = this;
if (length <= 0) {
_tmp = sliceType.nil;
_tmp$1 = new Errno(22);
data = _tmp;
err = _tmp$1;
$s = -1; return [data, err];
}
_r = m.mmap(0, ((length >>> 0)), prot, flags, fd, offset); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
addr = _tuple[0];
errno = _tuple[1];
if (!($interfaceIsEqual(errno, $ifaceNil))) {
_tmp$2 = sliceType.nil;
_tmp$3 = errno;
data = _tmp$2;
err = _tmp$3;
$s = -1; return [data, err];
}
sl[0] = new structType.ptr(addr, length, length);
b = sl[0];
p = $indexPtr(b.$array, b.$offset + (b.$capacity - 1 >> 0), ptrType$2);
$r = m.Mutex.Lock(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$deferred.push([$methodVal(m.Mutex, "Unlock"), []]);
_key = p; (m.active || $throwRuntimeError("assignment to entry in nil map"))[ptrType$2.keyFor(_key)] = { k: _key, v: b };
_tmp$4 = b;
_tmp$5 = $ifaceNil;
data = _tmp$4;
err = _tmp$5;
$s = -1; return [data, err];
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return [data, err]; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: mmapper.ptr.prototype.Mmap }; } $f._key = _key; $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f.addr = addr; $f.b = b; $f.data = data; $f.err = err; $f.errno = errno; $f.fd = fd; $f.flags = flags; $f.length = length; $f.m = m; $f.offset = offset; $f.p = p; $f.prot = prot; $f.sl = sl; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
mmapper.prototype.Mmap = function(fd, offset, length, prot, flags) { return this.$val.Mmap(fd, offset, length, prot, flags); };
mmapper.ptr.prototype.Munmap = function(data) {
var _entry, _r, b, data, err, errno, m, p, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _r = $f._r; b = $f.b; data = $f.data; err = $f.err; errno = $f.errno; m = $f.m; p = $f.p; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
err = $ifaceNil;
m = this;
if ((data.$length === 0) || !((data.$length === data.$capacity))) {
err = new Errno(22);
$s = -1; return err;
}
p = $indexPtr(data.$array, data.$offset + (data.$capacity - 1 >> 0), ptrType$2);
$r = m.Mutex.Lock(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$deferred.push([$methodVal(m.Mutex, "Unlock"), []]);
b = (_entry = m.active[ptrType$2.keyFor(p)], _entry !== undefined ? _entry.v : sliceType.nil);
if (b === sliceType.nil || !($indexPtr(b.$array, b.$offset + 0, ptrType$2) === $indexPtr(data.$array, data.$offset + 0, ptrType$2))) {
err = new Errno(22);
$s = -1; return err;
}
_r = m.munmap((($sliceToArray(b))), ((b.$length >>> 0))); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
errno = _r;
if (!($interfaceIsEqual(errno, $ifaceNil))) {
err = errno;
$s = -1; return err;
}
delete m.active[ptrType$2.keyFor(p)];
err = $ifaceNil;
$s = -1; return err;
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return err; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: mmapper.ptr.prototype.Munmap }; } $f._entry = _entry; $f._r = _r; $f.b = b; $f.data = data; $f.err = err; $f.errno = errno; $f.m = m; $f.p = p; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
mmapper.prototype.Munmap = function(data) { return this.$val.Munmap(data); };
Errno.prototype.Error = function() {
var e, s;
e = this.$val;
if (0 <= ((e >> 0)) && ((e >> 0)) < 133) {
s = ((e < 0 || e >= errors.length) ? ($throwRuntimeError("index out of range"), undefined) : errors[e]);
if (!(s === "")) {
return s;
}
}
return "errno " + itoa(((e >> 0)));
};
$ptrType(Errno).prototype.Error = function() { return new Errno(this.$get()).Error(); };
Errno.prototype.Temporary = function() {
var e;
e = this.$val;
return (e === 4) || (e === 24) || (e === 104) || (e === 103) || new Errno(e).Timeout();
};
$ptrType(Errno).prototype.Temporary = function() { return new Errno(this.$get()).Temporary(); };
Errno.prototype.Timeout = function() {
var e;
e = this.$val;
return (e === 11) || (e === 11) || (e === 110);
};
$ptrType(Errno).prototype.Timeout = function() { return new Errno(this.$get()).Timeout(); };
errnoErr = function(e) {
var _1, e;
_1 = e;
if (_1 === (0)) {
return $ifaceNil;
} else if (_1 === (11)) {
return errEAGAIN;
} else if (_1 === (22)) {
return errEINVAL;
} else if (_1 === (2)) {
return errENOENT;
}
return new Errno(e);
};
Read = function(fd, p) {
var _tuple, err, fd, n, p;
n = 0;
err = $ifaceNil;
_tuple = read(fd, p);
n = _tuple[0];
err = _tuple[1];
if (false) {
if (n > 0) {
race.WriteRange(($sliceToArray(p)), n);
}
if ($interfaceIsEqual(err, $ifaceNil)) {
race.Acquire(((ioSync$24ptr || (ioSync$24ptr = new ptrType$22(function() { return ioSync; }, function($v) { ioSync = $v; })))));
}
}
if (false && n > 0) {
msanWrite(($sliceToArray(p)), n);
}
return [n, err];
};
$pkg.Read = Read;
Write = function(fd, p) {
var _tuple, err, fd, n, p;
n = 0;
err = $ifaceNil;
if (false) {
race.ReleaseMerge(((ioSync$24ptr || (ioSync$24ptr = new ptrType$22(function() { return ioSync; }, function($v) { ioSync = $v; })))));
}
_tuple = write(fd, p);
n = _tuple[0];
err = _tuple[1];
if (false && n > 0) {
race.ReadRange(($sliceToArray(p)), n);
}
if (false && n > 0) {
msanRead(($sliceToArray(p)), n);
}
return [n, err];
};
$pkg.Write = Write;
Recvfrom = function(fd, p, flags) {
var _tuple, _tuple$1, err, fd, flags, from, len, len$24ptr, n, p, rsa;
n = 0;
from = $ifaceNil;
err = $ifaceNil;
rsa = new RawSockaddrAny.ptr(new RawSockaddr.ptr(0, arrayType$9.zero()), arrayType$10.zero());
len = 112;
_tuple = recvfrom(fd, p, flags, rsa, (len$24ptr || (len$24ptr = new ptrType$18(function() { return len; }, function($v) { len = $v; }))));
n = _tuple[0];
err = _tuple[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
return [n, from, err];
}
if (!((rsa.Addr.Family === 0))) {
_tuple$1 = anyToSockaddr(rsa);
from = _tuple$1[0];
err = _tuple$1[1];
}
return [n, from, err];
};
$pkg.Recvfrom = Recvfrom;
Sendto = function(fd, p, flags, to) {
var _r, _tuple, err, fd, flags, n, p, ptr, to, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; fd = $f.fd; flags = $f.flags; n = $f.n; p = $f.p; ptr = $f.ptr; to = $f.to; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
err = $ifaceNil;
_r = to.sockaddr(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
ptr = _tuple[0];
n = _tuple[1];
err = _tuple[2];
if (!($interfaceIsEqual(err, $ifaceNil))) {
err = err;
$s = -1; return err;
}
err = sendto(fd, p, flags, ptr, n);
$s = -1; return err;
/* */ } return; } if ($f === undefined) { $f = { $blk: Sendto }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.fd = fd; $f.flags = flags; $f.n = n; $f.p = p; $f.ptr = ptr; $f.to = to; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.Sendto = Sendto;
SetsockoptByte = function(fd, level, opt, value) {
var err, fd, level, opt, value, value$24ptr;
err = $ifaceNil;
err = setsockopt(fd, level, opt, ((value$24ptr || (value$24ptr = new ptrType$2(function() { return value; }, function($v) { value = $v; })))), 1);
return err;
};
$pkg.SetsockoptByte = SetsockoptByte;
SetsockoptInt = function(fd, level, opt, value) {
var err, fd, level, n, n$24ptr, opt, value;
err = $ifaceNil;
n = ((value >> 0));
err = setsockopt(fd, level, opt, ((n$24ptr || (n$24ptr = new ptrType$4(function() { return n; }, function($v) { n = $v; })))), 4);
return err;
};
$pkg.SetsockoptInt = SetsockoptInt;
SetsockoptInet4Addr = function(fd, level, opt, value) {
var err, fd, level, opt, value;
err = $ifaceNil;
err = setsockopt(fd, level, opt, ($sliceToArray(new sliceType(value))), 4);
return err;
};
$pkg.SetsockoptInet4Addr = SetsockoptInet4Addr;
SetsockoptIPMreq = function(fd, level, opt, mreq) {
var _array, _struct, _view, err, fd, level, mreq, opt;
err = $ifaceNil;
_array = new Uint8Array(8);
err = setsockopt(fd, level, opt, (_array), 8);
_struct = mreq, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Multiaddr = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 0, _array.buffer.byteLength)), _struct.Interface = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 4, _array.buffer.byteLength));
return err;
};
$pkg.SetsockoptIPMreq = SetsockoptIPMreq;
SetsockoptIPv6Mreq = function(fd, level, opt, mreq) {
var _array, _struct, _view, err, fd, level, mreq, opt;
err = $ifaceNil;
_array = new Uint8Array(20);
err = setsockopt(fd, level, opt, (_array), 20);
_struct = mreq, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Multiaddr = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 0, _array.buffer.byteLength)), _struct.Interface = _view.getUint32(16, true);
return err;
};
$pkg.SetsockoptIPv6Mreq = SetsockoptIPv6Mreq;
SetsockoptLinger = function(fd, level, opt, l) {
var _array, _struct, _view, err, fd, l, level, opt;
err = $ifaceNil;
_array = new Uint8Array(8);
err = setsockopt(fd, level, opt, (_array), 8);
_struct = l, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Onoff = _view.getInt32(0, true), _struct.Linger = _view.getInt32(4, true);
return err;
};
$pkg.SetsockoptLinger = SetsockoptLinger;
Close = function(fd) {
var _tuple, e1, err, fd;
err = $ifaceNil;
_tuple = Syscall(3, ((fd >>> 0)), 0, 0);
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Close = Close;
Fchdir = function(fd) {
var _tuple, e1, err, fd;
err = $ifaceNil;
_tuple = Syscall(81, ((fd >>> 0)), 0, 0);
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Fchdir = Fchdir;
Fchmod = function(fd, mode) {
var _tuple, e1, err, fd, mode;
err = $ifaceNil;
_tuple = Syscall(91, ((fd >>> 0)), ((mode >>> 0)), 0);
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Fchmod = Fchmod;
fcntl = function(fd, cmd, arg) {
var _tuple, arg, cmd, e1, err, fd, r0, val;
val = 0;
err = $ifaceNil;
_tuple = Syscall(72, ((fd >>> 0)), ((cmd >>> 0)), ((arg >>> 0)));
r0 = _tuple[0];
e1 = _tuple[2];
val = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [val, err];
};
Fsync = function(fd) {
var _tuple, e1, err, fd;
err = $ifaceNil;
_tuple = Syscall(74, ((fd >>> 0)), 0, 0);
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Fsync = Fsync;
Getdents = function(fd, buf) {
var _p0, _tuple, buf, e1, err, fd, n, r0;
n = 0;
err = $ifaceNil;
_p0 = 0;
if (buf.$length > 0) {
_p0 = ($sliceToArray(buf));
} else {
_p0 = (new Uint8Array(0));
}
_tuple = Syscall(217, ((fd >>> 0)), (_p0), ((buf.$length >>> 0)));
r0 = _tuple[0];
e1 = _tuple[2];
n = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [n, err];
};
$pkg.Getdents = Getdents;
read = function(fd, p) {
var _p0, _tuple, e1, err, fd, n, p, r0;
n = 0;
err = $ifaceNil;
_p0 = 0;
if (p.$length > 0) {
_p0 = ($sliceToArray(p));
} else {
_p0 = (new Uint8Array(0));
}
_tuple = Syscall(0, ((fd >>> 0)), (_p0), ((p.$length >>> 0)));
r0 = _tuple[0];
e1 = _tuple[2];
n = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [n, err];
};
write = function(fd, p) {
var _p0, _tuple, e1, err, fd, n, p, r0;
n = 0;
err = $ifaceNil;
_p0 = 0;
if (p.$length > 0) {
_p0 = ($sliceToArray(p));
} else {
_p0 = (new Uint8Array(0));
}
_tuple = Syscall(1, ((fd >>> 0)), (_p0), ((p.$length >>> 0)));
r0 = _tuple[0];
e1 = _tuple[2];
n = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [n, err];
};
munmap = function(addr, length) {
var _tuple, addr, e1, err, length;
err = $ifaceNil;
_tuple = Syscall(11, (addr), (length), 0);
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
Fchown = function(fd, uid, gid) {
var _tuple, e1, err, fd, gid, uid;
err = $ifaceNil;
_tuple = Syscall(93, ((fd >>> 0)), ((uid >>> 0)), ((gid >>> 0)));
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Fchown = Fchown;
Fstat = function(fd, stat) {
var _array, _struct, _tuple, _view, e1, err, fd, stat;
err = $ifaceNil;
_array = new Uint8Array(144);
_tuple = Syscall(5, ((fd >>> 0)), ((_array)), 0);
_struct = stat, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Dev = new $Uint64(_view.getUint32(4, true), _view.getUint32(0, true)), _struct.Ino = new $Uint64(_view.getUint32(12, true), _view.getUint32(8, true)), _struct.Nlink = new $Uint64(_view.getUint32(20, true), _view.getUint32(16, true)), _struct.Mode = _view.getUint32(24, true), _struct.Uid = _view.getUint32(28, true), _struct.Gid = _view.getUint32(32, true), _struct.X__pad0 = _view.getInt32(36, true), _struct.Rdev = new $Uint64(_view.getUint32(44, true), _view.getUint32(40, true)), _struct.Size = new $Int64(_view.getUint32(52, true), _view.getUint32(48, true)), _struct.Blksize = new $Int64(_view.getUint32(60, true), _view.getUint32(56, true)), _struct.Blocks = new $Int64(_view.getUint32(68, true), _view.getUint32(64, true)), _struct.Atim.Sec = new $Int64(_view.getUint32(76, true), _view.getUint32(72, true)), _struct.Atim.Nsec = new $Int64(_view.getUint32(84, true), _view.getUint32(80, true)), _struct.Mtim.Sec = new $Int64(_view.getUint32(92, true), _view.getUint32(88, true)), _struct.Mtim.Nsec = new $Int64(_view.getUint32(100, true), _view.getUint32(96, true)), _struct.Ctim.Sec = new $Int64(_view.getUint32(108, true), _view.getUint32(104, true)), _struct.Ctim.Nsec = new $Int64(_view.getUint32(116, true), _view.getUint32(112, true)), _struct.X__unused = new ($nativeArray($kindInt64))(_array.buffer, $min(_array.byteOffset + 120, _array.buffer.byteLength));
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Fstat = Fstat;
Ftruncate = function(fd, length) {
var _tuple, e1, err, fd, length;
err = $ifaceNil;
_tuple = Syscall(77, ((fd >>> 0)), ((length.$low >>> 0)), 0);
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Ftruncate = Ftruncate;
Lstat = function(path, stat) {
var _array, _p0, _struct, _tuple, _tuple$1, _view, e1, err, path, stat;
err = $ifaceNil;
_p0 = ptrType$2.nil;
_tuple = BytePtrFromString(path);
_p0 = _tuple[0];
err = _tuple[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
return err;
}
_array = new Uint8Array(144);
_tuple$1 = Syscall(6, ((_p0)), ((_array)), 0);
_struct = stat, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Dev = new $Uint64(_view.getUint32(4, true), _view.getUint32(0, true)), _struct.Ino = new $Uint64(_view.getUint32(12, true), _view.getUint32(8, true)), _struct.Nlink = new $Uint64(_view.getUint32(20, true), _view.getUint32(16, true)), _struct.Mode = _view.getUint32(24, true), _struct.Uid = _view.getUint32(28, true), _struct.Gid = _view.getUint32(32, true), _struct.X__pad0 = _view.getInt32(36, true), _struct.Rdev = new $Uint64(_view.getUint32(44, true), _view.getUint32(40, true)), _struct.Size = new $Int64(_view.getUint32(52, true), _view.getUint32(48, true)), _struct.Blksize = new $Int64(_view.getUint32(60, true), _view.getUint32(56, true)), _struct.Blocks = new $Int64(_view.getUint32(68, true), _view.getUint32(64, true)), _struct.Atim.Sec = new $Int64(_view.getUint32(76, true), _view.getUint32(72, true)), _struct.Atim.Nsec = new $Int64(_view.getUint32(84, true), _view.getUint32(80, true)), _struct.Mtim.Sec = new $Int64(_view.getUint32(92, true), _view.getUint32(88, true)), _struct.Mtim.Nsec = new $Int64(_view.getUint32(100, true), _view.getUint32(96, true)), _struct.Ctim.Sec = new $Int64(_view.getUint32(108, true), _view.getUint32(104, true)), _struct.Ctim.Nsec = new $Int64(_view.getUint32(116, true), _view.getUint32(112, true)), _struct.X__unused = new ($nativeArray($kindInt64))(_array.buffer, $min(_array.byteOffset + 120, _array.buffer.byteLength));
e1 = _tuple$1[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Lstat = Lstat;
Pread = function(fd, p, offset) {
var _p0, _tuple, e1, err, fd, n, offset, p, r0;
n = 0;
err = $ifaceNil;
_p0 = 0;
if (p.$length > 0) {
_p0 = ($sliceToArray(p));
} else {
_p0 = (new Uint8Array(0));
}
_tuple = Syscall6(17, ((fd >>> 0)), (_p0), ((p.$length >>> 0)), ((offset.$low >>> 0)), 0, 0);
r0 = _tuple[0];
e1 = _tuple[2];
n = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [n, err];
};
$pkg.Pread = Pread;
Pwrite = function(fd, p, offset) {
var _p0, _tuple, e1, err, fd, n, offset, p, r0;
n = 0;
err = $ifaceNil;
_p0 = 0;
if (p.$length > 0) {
_p0 = ($sliceToArray(p));
} else {
_p0 = (new Uint8Array(0));
}
_tuple = Syscall6(18, ((fd >>> 0)), (_p0), ((p.$length >>> 0)), ((offset.$low >>> 0)), 0, 0);
r0 = _tuple[0];
e1 = _tuple[2];
n = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [n, err];
};
$pkg.Pwrite = Pwrite;
Seek = function(fd, offset, whence) {
var _tuple, e1, err, fd, off, offset, r0, whence;
off = new $Int64(0, 0);
err = $ifaceNil;
_tuple = Syscall(8, ((fd >>> 0)), ((offset.$low >>> 0)), ((whence >>> 0)));
r0 = _tuple[0];
e1 = _tuple[2];
off = (new $Int64(0, r0.constructor === Number ? r0 : 1));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [off, err];
};
$pkg.Seek = Seek;
Shutdown = function(fd, how) {
var _tuple, e1, err, fd, how;
err = $ifaceNil;
_tuple = Syscall(48, ((fd >>> 0)), ((how >>> 0)), 0);
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
$pkg.Shutdown = Shutdown;
accept = function(s, rsa, addrlen) {
var _array, _struct, _tuple, _view, addrlen, e1, err, fd, r0, rsa, s;
fd = 0;
err = $ifaceNil;
_array = new Uint8Array(112);
_tuple = Syscall(43, ((s >>> 0)), ((_array)), ((addrlen)));
_struct = rsa, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
r0 = _tuple[0];
e1 = _tuple[2];
fd = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [fd, err];
};
accept4 = function(s, rsa, addrlen, flags) {
var _array, _struct, _tuple, _view, addrlen, e1, err, fd, flags, r0, rsa, s;
fd = 0;
err = $ifaceNil;
_array = new Uint8Array(112);
_tuple = Syscall6(288, ((s >>> 0)), ((_array)), ((addrlen)), ((flags >>> 0)), 0, 0);
_struct = rsa, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
r0 = _tuple[0];
e1 = _tuple[2];
fd = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [fd, err];
};
setsockopt = function(s, level, name, val, vallen) {
var _tuple, e1, err, level, name, s, val, vallen;
err = $ifaceNil;
_tuple = Syscall6(54, ((s >>> 0)), ((level >>> 0)), ((name >>> 0)), (val), (vallen), 0);
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
recvfrom = function(fd, p, flags, from, fromlen) {
var _array, _p0, _struct, _tuple, _view, e1, err, fd, flags, from, fromlen, n, p, r0;
n = 0;
err = $ifaceNil;
_p0 = 0;
if (p.$length > 0) {
_p0 = ($sliceToArray(p));
} else {
_p0 = (new Uint8Array(0));
}
_array = new Uint8Array(112);
_tuple = Syscall6(45, ((fd >>> 0)), (_p0), ((p.$length >>> 0)), ((flags >>> 0)), ((_array)), ((fromlen)));
_struct = from, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Addr.Family = _view.getUint16(0, true), _struct.Addr.Data = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 2, _array.buffer.byteLength)), _struct.Pad = new ($nativeArray($kindInt8))(_array.buffer, $min(_array.byteOffset + 16, _array.buffer.byteLength));
r0 = _tuple[0];
e1 = _tuple[2];
n = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [n, err];
};
sendto = function(s, buf, flags, to, addrlen) {
var _p0, _tuple, addrlen, buf, e1, err, flags, s, to;
err = $ifaceNil;
_p0 = 0;
if (buf.$length > 0) {
_p0 = ($sliceToArray(buf));
} else {
_p0 = (new Uint8Array(0));
}
_tuple = Syscall6(44, ((s >>> 0)), (_p0), ((buf.$length >>> 0)), ((flags >>> 0)), (to), ((addrlen >>> 0)));
e1 = _tuple[2];
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return err;
};
recvmsg = function(s, msg, flags) {
var _array, _struct, _tuple, _view, e1, err, flags, msg, n, r0, s;
n = 0;
err = $ifaceNil;
_array = new Uint8Array(48);
_tuple = Syscall(47, ((s >>> 0)), ((_array)), ((flags >>> 0)));
_struct = msg, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Namelen = _view.getUint32(4, true), _struct.Pad_cgo_0 = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 8, _array.buffer.byteLength)), _struct.Iovlen = new $Uint64(_view.getUint32(20, true), _view.getUint32(16, true)), _struct.Controllen = new $Uint64(_view.getUint32(36, true), _view.getUint32(32, true)), _struct.Flags = _view.getInt32(40, true), _struct.Pad_cgo_1 = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 44, _array.buffer.byteLength));
r0 = _tuple[0];
e1 = _tuple[2];
n = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [n, err];
};
sendmsg = function(s, msg, flags) {
var _array, _struct, _tuple, _view, e1, err, flags, msg, n, r0, s;
n = 0;
err = $ifaceNil;
_array = new Uint8Array(48);
_tuple = Syscall(46, ((s >>> 0)), ((_array)), ((flags >>> 0)));
_struct = msg, _view = new DataView(_array.buffer, _array.byteOffset), _struct.Namelen = _view.getUint32(4, true), _struct.Pad_cgo_0 = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 8, _array.buffer.byteLength)), _struct.Iovlen = new $Uint64(_view.getUint32(20, true), _view.getUint32(16, true)), _struct.Controllen = new $Uint64(_view.getUint32(36, true), _view.getUint32(32, true)), _struct.Flags = _view.getInt32(40, true), _struct.Pad_cgo_1 = new ($nativeArray($kindUint8))(_array.buffer, $min(_array.byteOffset + 44, _array.buffer.byteLength));
r0 = _tuple[0];
e1 = _tuple[2];
n = ((r0 >> 0));
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [n, err];
};
mmap = function(addr, length, prot, flags, fd, offset) {
var _tuple, addr, e1, err, fd, flags, length, offset, prot, r0, xaddr;
xaddr = 0;
err = $ifaceNil;
_tuple = Syscall6(9, (addr), (length), ((prot >>> 0)), ((flags >>> 0)), ((fd >>> 0)), ((offset.$low >>> 0)));
r0 = _tuple[0];
e1 = _tuple[2];
xaddr = (r0);
if (!((e1 === 0))) {
err = errnoErr(e1);
}
return [xaddr, err];
};
ptrType$24.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
ptrType$11.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
ptrType$25.methods = [{prop: "Mmap", name: "Mmap", pkg: "", typ: $funcType([$Int, $Int64, $Int, $Int, $Int], [sliceType, $error], false)}, {prop: "Munmap", name: "Munmap", pkg: "", typ: $funcType([sliceType], [$error], false)}];
Errno.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}];
ptrType$26.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
ptrType$27.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
ptrType$28.methods = [{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}];
ptrType$29.methods = [{prop: "Unix", name: "Unix", pkg: "", typ: $funcType([], [$Int64, $Int64], false)}, {prop: "Nano", name: "Nano", pkg: "", typ: $funcType([], [$Int64], false)}];
ptrType$19.methods = [{prop: "SetLen", name: "SetLen", pkg: "", typ: $funcType([$Int], [], false)}];
ptrType$31.methods = [{prop: "SetControllen", name: "SetControllen", pkg: "", typ: $funcType([$Int], [], false)}];
SockaddrLinklayer.init("syscall", [{prop: "Protocol", name: "Protocol", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Ifindex", name: "Ifindex", anonymous: false, exported: true, typ: $Int, tag: ""}, {prop: "Hatype", name: "Hatype", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pkttype", name: "Pkttype", anonymous: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Halen", name: "Halen", anonymous: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Addr", name: "Addr", anonymous: false, exported: true, typ: arrayType$1, tag: ""}, {prop: "raw", name: "raw", anonymous: false, exported: false, typ: RawSockaddrLinklayer, tag: ""}]);
SockaddrNetlink.init("syscall", [{prop: "Family", name: "Family", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pad", name: "Pad", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pid", name: "Pid", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Groups", name: "Groups", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "raw", name: "raw", anonymous: false, exported: false, typ: RawSockaddrNetlink, tag: ""}]);
mmapper.init("syscall", [{prop: "Mutex", name: "Mutex", anonymous: true, exported: true, typ: sync.Mutex, tag: ""}, {prop: "active", name: "active", anonymous: false, exported: false, typ: mapType, tag: ""}, {prop: "mmap", name: "mmap", anonymous: false, exported: false, typ: funcType$2, tag: ""}, {prop: "munmap", name: "munmap", anonymous: false, exported: false, typ: funcType$3, tag: ""}]);
Sockaddr.init([{prop: "sockaddr", name: "sockaddr", pkg: "syscall", typ: $funcType([], [$UnsafePointer, _Socklen, $error], false)}]);
SockaddrInet4.init("syscall", [{prop: "Port", name: "Port", anonymous: false, exported: true, typ: $Int, tag: ""}, {prop: "Addr", name: "Addr", anonymous: false, exported: true, typ: arrayType$8, tag: ""}, {prop: "raw", name: "raw", anonymous: false, exported: false, typ: RawSockaddrInet4, tag: ""}]);
SockaddrInet6.init("syscall", [{prop: "Port", name: "Port", anonymous: false, exported: true, typ: $Int, tag: ""}, {prop: "ZoneId", name: "ZoneId", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Addr", name: "Addr", anonymous: false, exported: true, typ: arrayType$2, tag: ""}, {prop: "raw", name: "raw", anonymous: false, exported: false, typ: RawSockaddrInet6, tag: ""}]);
SockaddrUnix.init("syscall", [{prop: "Name", name: "Name", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "raw", name: "raw", anonymous: false, exported: false, typ: RawSockaddrUnix, tag: ""}]);
Timespec.init("", [{prop: "Sec", name: "Sec", anonymous: false, exported: true, typ: $Int64, tag: ""}, {prop: "Nsec", name: "Nsec", anonymous: false, exported: true, typ: $Int64, tag: ""}]);
Stat_t.init("", [{prop: "Dev", name: "Dev", anonymous: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Ino", name: "Ino", anonymous: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Nlink", name: "Nlink", anonymous: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Mode", name: "Mode", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Uid", name: "Uid", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Gid", name: "Gid", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "X__pad0", name: "X__pad0", anonymous: false, exported: true, typ: $Int32, tag: ""}, {prop: "Rdev", name: "Rdev", anonymous: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Size", name: "Size", anonymous: false, exported: true, typ: $Int64, tag: ""}, {prop: "Blksize", name: "Blksize", anonymous: false, exported: true, typ: $Int64, tag: ""}, {prop: "Blocks", name: "Blocks", anonymous: false, exported: true, typ: $Int64, tag: ""}, {prop: "Atim", name: "Atim", anonymous: false, exported: true, typ: Timespec, tag: ""}, {prop: "Mtim", name: "Mtim", anonymous: false, exported: true, typ: Timespec, tag: ""}, {prop: "Ctim", name: "Ctim", anonymous: false, exported: true, typ: Timespec, tag: ""}, {prop: "X__unused", name: "X__unused", anonymous: false, exported: true, typ: arrayType$15, tag: ""}]);
RawSockaddrInet4.init("", [{prop: "Family", name: "Family", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Port", name: "Port", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Addr", name: "Addr", anonymous: false, exported: true, typ: arrayType$8, tag: ""}, {prop: "Zero", name: "Zero", anonymous: false, exported: true, typ: arrayType$1, tag: ""}]);
RawSockaddrInet6.init("", [{prop: "Family", name: "Family", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Port", name: "Port", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Flowinfo", name: "Flowinfo", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Addr", name: "Addr", anonymous: false, exported: true, typ: arrayType$2, tag: ""}, {prop: "Scope_id", name: "Scope_id", anonymous: false, exported: true, typ: $Uint32, tag: ""}]);
RawSockaddrUnix.init("", [{prop: "Family", name: "Family", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Path", name: "Path", anonymous: false, exported: true, typ: arrayType$7, tag: ""}]);
RawSockaddrLinklayer.init("", [{prop: "Family", name: "Family", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Protocol", name: "Protocol", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Ifindex", name: "Ifindex", anonymous: false, exported: true, typ: $Int32, tag: ""}, {prop: "Hatype", name: "Hatype", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pkttype", name: "Pkttype", anonymous: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Halen", name: "Halen", anonymous: false, exported: true, typ: $Uint8, tag: ""}, {prop: "Addr", name: "Addr", anonymous: false, exported: true, typ: arrayType$1, tag: ""}]);
RawSockaddrNetlink.init("", [{prop: "Family", name: "Family", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pad", name: "Pad", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Pid", name: "Pid", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Groups", name: "Groups", anonymous: false, exported: true, typ: $Uint32, tag: ""}]);
RawSockaddr.init("", [{prop: "Family", name: "Family", anonymous: false, exported: true, typ: $Uint16, tag: ""}, {prop: "Data", name: "Data", anonymous: false, exported: true, typ: arrayType$9, tag: ""}]);
RawSockaddrAny.init("", [{prop: "Addr", name: "Addr", anonymous: false, exported: true, typ: RawSockaddr, tag: ""}, {prop: "Pad", name: "Pad", anonymous: false, exported: true, typ: arrayType$10, tag: ""}]);
Linger.init("", [{prop: "Onoff", name: "Onoff", anonymous: false, exported: true, typ: $Int32, tag: ""}, {prop: "Linger", name: "Linger", anonymous: false, exported: true, typ: $Int32, tag: ""}]);
Iovec.init("", [{prop: "Base", name: "Base", anonymous: false, exported: true, typ: ptrType$2, tag: ""}, {prop: "Len", name: "Len", anonymous: false, exported: true, typ: $Uint64, tag: ""}]);
IPMreq.init("", [{prop: "Multiaddr", name: "Multiaddr", anonymous: false, exported: true, typ: arrayType$8, tag: ""}, {prop: "Interface", name: "Interface", anonymous: false, exported: true, typ: arrayType$8, tag: ""}]);
IPMreqn.init("", [{prop: "Multiaddr", name: "Multiaddr", anonymous: false, exported: true, typ: arrayType$8, tag: ""}, {prop: "Address", name: "Address", anonymous: false, exported: true, typ: arrayType$8, tag: ""}, {prop: "Ifindex", name: "Ifindex", anonymous: false, exported: true, typ: $Int32, tag: ""}]);
IPv6Mreq.init("", [{prop: "Multiaddr", name: "Multiaddr", anonymous: false, exported: true, typ: arrayType$2, tag: ""}, {prop: "Interface", name: "Interface", anonymous: false, exported: true, typ: $Uint32, tag: ""}]);
Msghdr.init("", [{prop: "Name", name: "Name", anonymous: false, exported: true, typ: ptrType$2, tag: ""}, {prop: "Namelen", name: "Namelen", anonymous: false, exported: true, typ: $Uint32, tag: ""}, {prop: "Pad_cgo_0", name: "Pad_cgo_0", anonymous: false, exported: true, typ: arrayType$8, tag: ""}, {prop: "Iov", name: "Iov", anonymous: false, exported: true, typ: ptrType$19, tag: ""}, {prop: "Iovlen", name: "Iovlen", anonymous: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Control", name: "Control", anonymous: false, exported: true, typ: ptrType$2, tag: ""}, {prop: "Controllen", name: "Controllen", anonymous: false, exported: true, typ: $Uint64, tag: ""}, {prop: "Flags", name: "Flags", anonymous: false, exported: true, typ: $Int32, tag: ""}, {prop: "Pad_cgo_1", name: "Pad_cgo_1", anonymous: false, exported: true, typ: arrayType$8, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = js.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = race.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = runtime.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = sync.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
lineBuffer = sliceType.nil;
syscallModule = null;
ioSync = new $Int64(0, 0);
warningPrinted = false;
alreadyTriedToLoad = false;
minusOne = -1;
envs = runtime_envs();
$pkg.Stdin = 0;
$pkg.Stdout = 1;
$pkg.Stderr = 2;
errEAGAIN = new Errno(11);
errEINVAL = new Errno(22);
errENOENT = new Errno(2);
errors = $toNativeArray($kindString, ["", "operation not permitted", "no such file or directory", "no such process", "interrupted system call", "input/output error", "no such device or address", "argument list too long", "exec format error", "bad file descriptor", "no child processes", "resource temporarily unavailable", "cannot allocate memory", "permission denied", "bad address", "block device required", "device or resource busy", "file exists", "invalid cross-device link", "no such device", "not a directory", "is a directory", "invalid argument", "too many open files in system", "too many open files", "inappropriate ioctl for device", "text file busy", "file too large", "no space left on device", "illegal seek", "read-only file system", "too many links", "broken pipe", "numerical argument out of domain", "numerical result out of range", "resource deadlock avoided", "file name too long", "no locks available", "function not implemented", "directory not empty", "too many levels of symbolic links", "", "no message of desired type", "identifier removed", "channel number out of range", "level 2 not synchronized", "level 3 halted", "level 3 reset", "link number out of range", "protocol driver not attached", "no CSI structure available", "level 2 halted", "invalid exchange", "invalid request descriptor", "exchange full", "no anode", "invalid request code", "invalid slot", "", "bad font file format", "device not a stream", "no data available", "timer expired", "out of streams resources", "machine is not on the network", "package not installed", "object is remote", "link has been severed", "advertise error", "srmount error", "communication error on send", "protocol error", "multihop attempted", "RFS specific error", "bad message", "value too large for defined data type", "name not unique on network", "file descriptor in bad state", "remote address changed", "can not access a needed shared library", "accessing a corrupted shared library", ".lib section in a.out corrupted", "attempting to link in too many shared libraries", "cannot exec a shared library directly", "invalid or incomplete multibyte or wide character", "interrupted system call should be restarted", "streams pipe error", "too many users", "socket operation on non-socket", "destination address required", "message too long", "protocol wrong type for socket", "protocol not available", "protocol not supported", "socket type not supported", "operation not supported", "protocol family not supported", "address family not supported by protocol", "address already in use", "cannot assign requested address", "network is down", "network is unreachable", "network dropped connection on reset", "software caused connection abort", "connection reset by peer", "no buffer space available", "transport endpoint is already connected", "transport endpoint is not connected", "cannot send after transport endpoint shutdown", "too many references: cannot splice", "connection timed out", "connection refused", "host is down", "no route to host", "operation already in progress", "operation now in progress", "stale NFS file handle", "structure needs cleaning", "not a XENIX named type file", "no XENIX semaphores available", "is a named type file", "remote I/O error", "disk quota exceeded", "no medium found", "wrong medium type", "operation canceled", "required key not available", "key has expired", "key has been revoked", "key was rejected by service", "owner died", "state not recoverable", "operation not possible due to RF-kill"]);
mapper = new mmapper.ptr(new sync.Mutex.ptr(0, 0), {}, mmap, munmap);
init();
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["github.com/gopherjs/gopherjs/nosync"] = (function() {
var $pkg = {}, $init, Mutex, Once, ptrType$1, funcType$1, ptrType$4;
Mutex = $pkg.Mutex = $newType(0, $kindStruct, "nosync.Mutex", true, "github.com/gopherjs/gopherjs/nosync", true, function(locked_) {
this.$val = this;
if (arguments.length === 0) {
this.locked = false;
return;
}
this.locked = locked_;
});
Once = $pkg.Once = $newType(0, $kindStruct, "nosync.Once", true, "github.com/gopherjs/gopherjs/nosync", true, function(doing_, done_) {
this.$val = this;
if (arguments.length === 0) {
this.doing = false;
this.done = false;
return;
}
this.doing = doing_;
this.done = done_;
});
ptrType$1 = $ptrType(Mutex);
funcType$1 = $funcType([], [], false);
ptrType$4 = $ptrType(Once);
Mutex.ptr.prototype.Lock = function() {
var m;
m = this;
if (m.locked) {
$panic(new $String("nosync: mutex is already locked"));
}
m.locked = true;
};
Mutex.prototype.Lock = function() { return this.$val.Lock(); };
Mutex.ptr.prototype.Unlock = function() {
var m;
m = this;
if (!m.locked) {
$panic(new $String("nosync: unlock of unlocked mutex"));
}
m.locked = false;
};
Mutex.prototype.Unlock = function() { return this.$val.Unlock(); };
Once.ptr.prototype.Do = function(f) {
var f, o, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; f = $f.f; o = $f.o; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
o = [o];
o[0] = this;
if (o[0].done) {
$s = -1; return;
}
if (o[0].doing) {
$panic(new $String("nosync: Do called within f"));
}
o[0].doing = true;
$deferred.push([(function(o) { return function() {
o[0].doing = false;
o[0].done = true;
}; })(o), []]);
$r = f(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$s = -1; return;
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: Once.ptr.prototype.Do }; } $f.f = f; $f.o = o; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
Once.prototype.Do = function(f) { return this.$val.Do(f); };
ptrType$1.methods = [{prop: "Lock", name: "Lock", pkg: "", typ: $funcType([], [], false)}, {prop: "Unlock", name: "Unlock", pkg: "", typ: $funcType([], [], false)}];
ptrType$4.methods = [{prop: "Do", name: "Do", pkg: "", typ: $funcType([funcType$1], [], false)}];
Mutex.init("github.com/gopherjs/gopherjs/nosync", [{prop: "locked", name: "locked", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
Once.init("github.com/gopherjs/gopherjs/nosync", [{prop: "doing", name: "doing", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "done", name: "done", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["time"] = (function() {
var $pkg = {}, $init, errors, js, nosync, runtime, syscall, ParseError, Time, Month, Weekday, Duration, Location, zone, zoneTrans, sliceType, sliceType$1, ptrType, sliceType$2, arrayType, sliceType$3, arrayType$1, arrayType$2, ptrType$2, arrayType$4, ptrType$4, ptrType$7, std0x, longDayNames, shortDayNames, shortMonthNames, longMonthNames, atoiError, errBad, errLeadingInt, months, days, daysBefore, utcLoc, utcLoc$24ptr, localLoc, localLoc$24ptr, localOnce, errLocation, badData, zoneDirs, init, initLocal, indexByte, startsWithLowerCase, nextStdChunk, match, lookup, appendInt, atoi, formatNano, quote, isDigit, getnum, cutspace, skip, Parse, parse, parseTimeZone, parseGMT, parseNanoseconds, leadingInt, absWeekday, absClock, fmtFrac, fmtInt, lessThanHalf, absDate, daysIn, unixTime, Unix, isLeap, norm, Date, div, FixedZone;
errors = $packages["errors"];
js = $packages["github.com/gopherjs/gopherjs/js"];
nosync = $packages["github.com/gopherjs/gopherjs/nosync"];
runtime = $packages["runtime"];
syscall = $packages["syscall"];
ParseError = $pkg.ParseError = $newType(0, $kindStruct, "time.ParseError", true, "time", true, function(Layout_, Value_, LayoutElem_, ValueElem_, Message_) {
this.$val = this;
if (arguments.length === 0) {
this.Layout = "";
this.Value = "";
this.LayoutElem = "";
this.ValueElem = "";
this.Message = "";
return;
}
this.Layout = Layout_;
this.Value = Value_;
this.LayoutElem = LayoutElem_;
this.ValueElem = ValueElem_;
this.Message = Message_;
});
Time = $pkg.Time = $newType(0, $kindStruct, "time.Time", true, "time", true, function(wall_, ext_, loc_) {
this.$val = this;
if (arguments.length === 0) {
this.wall = new $Uint64(0, 0);
this.ext = new $Int64(0, 0);
this.loc = ptrType$2.nil;
return;
}
this.wall = wall_;
this.ext = ext_;
this.loc = loc_;
});
Month = $pkg.Month = $newType(4, $kindInt, "time.Month", true, "time", true, null);
Weekday = $pkg.Weekday = $newType(4, $kindInt, "time.Weekday", true, "time", true, null);
Duration = $pkg.Duration = $newType(8, $kindInt64, "time.Duration", true, "time", true, null);
Location = $pkg.Location = $newType(0, $kindStruct, "time.Location", true, "time", true, function(name_, zone_, tx_, cacheStart_, cacheEnd_, cacheZone_) {
this.$val = this;
if (arguments.length === 0) {
this.name = "";
this.zone = sliceType.nil;
this.tx = sliceType$1.nil;
this.cacheStart = new $Int64(0, 0);
this.cacheEnd = new $Int64(0, 0);
this.cacheZone = ptrType.nil;
return;
}
this.name = name_;
this.zone = zone_;
this.tx = tx_;
this.cacheStart = cacheStart_;
this.cacheEnd = cacheEnd_;
this.cacheZone = cacheZone_;
});
zone = $pkg.zone = $newType(0, $kindStruct, "time.zone", true, "time", false, function(name_, offset_, isDST_) {
this.$val = this;
if (arguments.length === 0) {
this.name = "";
this.offset = 0;
this.isDST = false;
return;
}
this.name = name_;
this.offset = offset_;
this.isDST = isDST_;
});
zoneTrans = $pkg.zoneTrans = $newType(0, $kindStruct, "time.zoneTrans", true, "time", false, function(when_, index_, isstd_, isutc_) {
this.$val = this;
if (arguments.length === 0) {
this.when = new $Int64(0, 0);
this.index = 0;
this.isstd = false;
this.isutc = false;
return;
}
this.when = when_;
this.index = index_;
this.isstd = isstd_;
this.isutc = isutc_;
});
sliceType = $sliceType(zone);
sliceType$1 = $sliceType(zoneTrans);
ptrType = $ptrType(zone);
sliceType$2 = $sliceType($String);
arrayType = $arrayType($Uint8, 20);
sliceType$3 = $sliceType($Uint8);
arrayType$1 = $arrayType($Uint8, 9);
arrayType$2 = $arrayType($Uint8, 64);
ptrType$2 = $ptrType(Location);
arrayType$4 = $arrayType($Uint8, 32);
ptrType$4 = $ptrType(ParseError);
ptrType$7 = $ptrType(Time);
init = function() {
$unused(Unix(new $Int64(0, 0), new $Int64(0, 0)));
};
initLocal = function() {
var d, i, j, s;
d = new ($global.Date)();
s = $internalize(d, $String);
i = indexByte(s, 40);
j = indexByte(s, 41);
if ((i === -1) || (j === -1)) {
localLoc.name = "UTC";
return;
}
localLoc.name = $substring(s, (i + 1 >> 0), j);
localLoc.zone = new sliceType([new zone.ptr(localLoc.name, $imul(($parseInt(d.getTimezoneOffset()) >> 0), -60), false)]);
};
indexByte = function(s, c) {
var c, s;
return $parseInt(s.indexOf($global.String.fromCharCode(c))) >> 0;
};
startsWithLowerCase = function(str) {
var c, str;
if (str.length === 0) {
return false;
}
c = str.charCodeAt(0);
return 97 <= c && c <= 122;
};
nextStdChunk = function(layout) {
var _1, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$18, _tmp$19, _tmp$2, _tmp$20, _tmp$21, _tmp$22, _tmp$23, _tmp$24, _tmp$25, _tmp$26, _tmp$27, _tmp$28, _tmp$29, _tmp$3, _tmp$30, _tmp$31, _tmp$32, _tmp$33, _tmp$34, _tmp$35, _tmp$36, _tmp$37, _tmp$38, _tmp$39, _tmp$4, _tmp$40, _tmp$41, _tmp$42, _tmp$43, _tmp$44, _tmp$45, _tmp$46, _tmp$47, _tmp$48, _tmp$49, _tmp$5, _tmp$50, _tmp$51, _tmp$52, _tmp$53, _tmp$54, _tmp$55, _tmp$56, _tmp$57, _tmp$58, _tmp$59, _tmp$6, _tmp$60, _tmp$61, _tmp$62, _tmp$63, _tmp$64, _tmp$65, _tmp$66, _tmp$67, _tmp$68, _tmp$69, _tmp$7, _tmp$70, _tmp$71, _tmp$72, _tmp$73, _tmp$74, _tmp$75, _tmp$76, _tmp$77, _tmp$78, _tmp$79, _tmp$8, _tmp$80, _tmp$81, _tmp$82, _tmp$83, _tmp$84, _tmp$85, _tmp$86, _tmp$9, c, ch, i, j, layout, prefix, std, std$1, suffix, x;
prefix = "";
std = 0;
suffix = "";
i = 0;
while (true) {
if (!(i < layout.length)) { break; }
c = ((layout.charCodeAt(i) >> 0));
_1 = c;
if (_1 === (74)) {
if (layout.length >= (i + 3 >> 0) && $substring(layout, i, (i + 3 >> 0)) === "Jan") {
if (layout.length >= (i + 7 >> 0) && $substring(layout, i, (i + 7 >> 0)) === "January") {
_tmp = $substring(layout, 0, i);
_tmp$1 = 257;
_tmp$2 = $substring(layout, (i + 7 >> 0));
prefix = _tmp;
std = _tmp$1;
suffix = _tmp$2;
return [prefix, std, suffix];
}
if (!startsWithLowerCase($substring(layout, (i + 3 >> 0)))) {
_tmp$3 = $substring(layout, 0, i);
_tmp$4 = 258;
_tmp$5 = $substring(layout, (i + 3 >> 0));
prefix = _tmp$3;
std = _tmp$4;
suffix = _tmp$5;
return [prefix, std, suffix];
}
}
} else if (_1 === (77)) {
if (layout.length >= (i + 3 >> 0)) {
if ($substring(layout, i, (i + 3 >> 0)) === "Mon") {
if (layout.length >= (i + 6 >> 0) && $substring(layout, i, (i + 6 >> 0)) === "Monday") {
_tmp$6 = $substring(layout, 0, i);
_tmp$7 = 261;
_tmp$8 = $substring(layout, (i + 6 >> 0));
prefix = _tmp$6;
std = _tmp$7;
suffix = _tmp$8;
return [prefix, std, suffix];
}
if (!startsWithLowerCase($substring(layout, (i + 3 >> 0)))) {
_tmp$9 = $substring(layout, 0, i);
_tmp$10 = 262;
_tmp$11 = $substring(layout, (i + 3 >> 0));
prefix = _tmp$9;
std = _tmp$10;
suffix = _tmp$11;
return [prefix, std, suffix];
}
}
if ($substring(layout, i, (i + 3 >> 0)) === "MST") {
_tmp$12 = $substring(layout, 0, i);
_tmp$13 = 21;
_tmp$14 = $substring(layout, (i + 3 >> 0));
prefix = _tmp$12;
std = _tmp$13;
suffix = _tmp$14;
return [prefix, std, suffix];
}
}
} else if (_1 === (48)) {
if (layout.length >= (i + 2 >> 0) && 49 <= layout.charCodeAt((i + 1 >> 0)) && layout.charCodeAt((i + 1 >> 0)) <= 54) {
_tmp$15 = $substring(layout, 0, i);
_tmp$16 = (x = layout.charCodeAt((i + 1 >> 0)) - 49 << 24 >>> 24, ((x < 0 || x >= std0x.length) ? ($throwRuntimeError("index out of range"), undefined) : std0x[x]));
_tmp$17 = $substring(layout, (i + 2 >> 0));
prefix = _tmp$15;
std = _tmp$16;
suffix = _tmp$17;
return [prefix, std, suffix];
}
} else if (_1 === (49)) {
if (layout.length >= (i + 2 >> 0) && (layout.charCodeAt((i + 1 >> 0)) === 53)) {
_tmp$18 = $substring(layout, 0, i);
_tmp$19 = 522;
_tmp$20 = $substring(layout, (i + 2 >> 0));
prefix = _tmp$18;
std = _tmp$19;
suffix = _tmp$20;
return [prefix, std, suffix];
}
_tmp$21 = $substring(layout, 0, i);
_tmp$22 = 259;
_tmp$23 = $substring(layout, (i + 1 >> 0));
prefix = _tmp$21;
std = _tmp$22;
suffix = _tmp$23;
return [prefix, std, suffix];
} else if (_1 === (50)) {
if (layout.length >= (i + 4 >> 0) && $substring(layout, i, (i + 4 >> 0)) === "2006") {
_tmp$24 = $substring(layout, 0, i);
_tmp$25 = 273;
_tmp$26 = $substring(layout, (i + 4 >> 0));
prefix = _tmp$24;
std = _tmp$25;
suffix = _tmp$26;
return [prefix, std, suffix];
}
_tmp$27 = $substring(layout, 0, i);
_tmp$28 = 263;
_tmp$29 = $substring(layout, (i + 1 >> 0));
prefix = _tmp$27;
std = _tmp$28;
suffix = _tmp$29;
return [prefix, std, suffix];
} else if (_1 === (95)) {
if (layout.length >= (i + 2 >> 0) && (layout.charCodeAt((i + 1 >> 0)) === 50)) {
if (layout.length >= (i + 5 >> 0) && $substring(layout, (i + 1 >> 0), (i + 5 >> 0)) === "2006") {
_tmp$30 = $substring(layout, 0, (i + 1 >> 0));
_tmp$31 = 273;
_tmp$32 = $substring(layout, (i + 5 >> 0));
prefix = _tmp$30;
std = _tmp$31;
suffix = _tmp$32;
return [prefix, std, suffix];
}
_tmp$33 = $substring(layout, 0, i);
_tmp$34 = 264;
_tmp$35 = $substring(layout, (i + 2 >> 0));
prefix = _tmp$33;
std = _tmp$34;
suffix = _tmp$35;
return [prefix, std, suffix];
}
} else if (_1 === (51)) {
_tmp$36 = $substring(layout, 0, i);
_tmp$37 = 523;
_tmp$38 = $substring(layout, (i + 1 >> 0));
prefix = _tmp$36;
std = _tmp$37;
suffix = _tmp$38;
return [prefix, std, suffix];
} else if (_1 === (52)) {
_tmp$39 = $substring(layout, 0, i);
_tmp$40 = 525;
_tmp$41 = $substring(layout, (i + 1 >> 0));
prefix = _tmp$39;
std = _tmp$40;
suffix = _tmp$41;
return [prefix, std, suffix];
} else if (_1 === (53)) {
_tmp$42 = $substring(layout, 0, i);
_tmp$43 = 527;
_tmp$44 = $substring(layout, (i + 1 >> 0));
prefix = _tmp$42;
std = _tmp$43;
suffix = _tmp$44;
return [prefix, std, suffix];
} else if (_1 === (80)) {
if (layout.length >= (i + 2 >> 0) && (layout.charCodeAt((i + 1 >> 0)) === 77)) {
_tmp$45 = $substring(layout, 0, i);
_tmp$46 = 531;
_tmp$47 = $substring(layout, (i + 2 >> 0));
prefix = _tmp$45;
std = _tmp$46;
suffix = _tmp$47;
return [prefix, std, suffix];
}
} else if (_1 === (112)) {
if (layout.length >= (i + 2 >> 0) && (layout.charCodeAt((i + 1 >> 0)) === 109)) {
_tmp$48 = $substring(layout, 0, i);
_tmp$49 = 532;
_tmp$50 = $substring(layout, (i + 2 >> 0));
prefix = _tmp$48;
std = _tmp$49;
suffix = _tmp$50;
return [prefix, std, suffix];
}
} else if (_1 === (45)) {
if (layout.length >= (i + 7 >> 0) && $substring(layout, i, (i + 7 >> 0)) === "-070000") {
_tmp$51 = $substring(layout, 0, i);
_tmp$52 = 28;
_tmp$53 = $substring(layout, (i + 7 >> 0));
prefix = _tmp$51;
std = _tmp$52;
suffix = _tmp$53;
return [prefix, std, suffix];
}
if (layout.length >= (i + 9 >> 0) && $substring(layout, i, (i + 9 >> 0)) === "-07:00:00") {
_tmp$54 = $substring(layout, 0, i);
_tmp$55 = 31;
_tmp$56 = $substring(layout, (i + 9 >> 0));
prefix = _tmp$54;
std = _tmp$55;
suffix = _tmp$56;
return [prefix, std, suffix];
}
if (layout.length >= (i + 5 >> 0) && $substring(layout, i, (i + 5 >> 0)) === "-0700") {
_tmp$57 = $substring(layout, 0, i);
_tmp$58 = 27;
_tmp$59 = $substring(layout, (i + 5 >> 0));
prefix = _tmp$57;
std = _tmp$58;
suffix = _tmp$59;
return [prefix, std, suffix];
}
if (layout.length >= (i + 6 >> 0) && $substring(layout, i, (i + 6 >> 0)) === "-07:00") {
_tmp$60 = $substring(layout, 0, i);
_tmp$61 = 30;
_tmp$62 = $substring(layout, (i + 6 >> 0));
prefix = _tmp$60;
std = _tmp$61;
suffix = _tmp$62;
return [prefix, std, suffix];
}
if (layout.length >= (i + 3 >> 0) && $substring(layout, i, (i + 3 >> 0)) === "-07") {
_tmp$63 = $substring(layout, 0, i);
_tmp$64 = 29;
_tmp$65 = $substring(layout, (i + 3 >> 0));
prefix = _tmp$63;
std = _tmp$64;
suffix = _tmp$65;
return [prefix, std, suffix];
}
} else if (_1 === (90)) {
if (layout.length >= (i + 7 >> 0) && $substring(layout, i, (i + 7 >> 0)) === "Z070000") {
_tmp$66 = $substring(layout, 0, i);
_tmp$67 = 23;
_tmp$68 = $substring(layout, (i + 7 >> 0));
prefix = _tmp$66;
std = _tmp$67;
suffix = _tmp$68;
return [prefix, std, suffix];
}
if (layout.length >= (i + 9 >> 0) && $substring(layout, i, (i + 9 >> 0)) === "Z07:00:00") {
_tmp$69 = $substring(layout, 0, i);
_tmp$70 = 26;
_tmp$71 = $substring(layout, (i + 9 >> 0));
prefix = _tmp$69;
std = _tmp$70;
suffix = _tmp$71;
return [prefix, std, suffix];
}
if (layout.length >= (i + 5 >> 0) && $substring(layout, i, (i + 5 >> 0)) === "Z0700") {
_tmp$72 = $substring(layout, 0, i);
_tmp$73 = 22;
_tmp$74 = $substring(layout, (i + 5 >> 0));
prefix = _tmp$72;
std = _tmp$73;
suffix = _tmp$74;
return [prefix, std, suffix];
}
if (layout.length >= (i + 6 >> 0) && $substring(layout, i, (i + 6 >> 0)) === "Z07:00") {
_tmp$75 = $substring(layout, 0, i);
_tmp$76 = 25;
_tmp$77 = $substring(layout, (i + 6 >> 0));
prefix = _tmp$75;
std = _tmp$76;
suffix = _tmp$77;
return [prefix, std, suffix];
}
if (layout.length >= (i + 3 >> 0) && $substring(layout, i, (i + 3 >> 0)) === "Z07") {
_tmp$78 = $substring(layout, 0, i);
_tmp$79 = 24;
_tmp$80 = $substring(layout, (i + 3 >> 0));
prefix = _tmp$78;
std = _tmp$79;
suffix = _tmp$80;
return [prefix, std, suffix];
}
} else if (_1 === (46)) {
if ((i + 1 >> 0) < layout.length && ((layout.charCodeAt((i + 1 >> 0)) === 48) || (layout.charCodeAt((i + 1 >> 0)) === 57))) {
ch = layout.charCodeAt((i + 1 >> 0));
j = i + 1 >> 0;
while (true) {
if (!(j < layout.length && (layout.charCodeAt(j) === ch))) { break; }
j = j + (1) >> 0;
}
if (!isDigit(layout, j)) {
std$1 = 32;
if (layout.charCodeAt((i + 1 >> 0)) === 57) {
std$1 = 33;
}
std$1 = std$1 | ((((j - ((i + 1 >> 0)) >> 0)) << 16 >> 0));
_tmp$81 = $substring(layout, 0, i);
_tmp$82 = std$1;
_tmp$83 = $substring(layout, j);
prefix = _tmp$81;
std = _tmp$82;
suffix = _tmp$83;
return [prefix, std, suffix];
}
}
}
i = i + (1) >> 0;
}
_tmp$84 = layout;
_tmp$85 = 0;
_tmp$86 = "";
prefix = _tmp$84;
std = _tmp$85;
suffix = _tmp$86;
return [prefix, std, suffix];
};
match = function(s1, s2) {
var c1, c2, i, s1, s2;
i = 0;
while (true) {
if (!(i < s1.length)) { break; }
c1 = s1.charCodeAt(i);
c2 = s2.charCodeAt(i);
if (!((c1 === c2))) {
c1 = (c1 | (32)) >>> 0;
c2 = (c2 | (32)) >>> 0;
if (!((c1 === c2)) || c1 < 97 || c1 > 122) {
return false;
}
}
i = i + (1) >> 0;
}
return true;
};
lookup = function(tab, val) {
var _i, _ref, i, tab, v, val;
_ref = tab;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
v = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
if (val.length >= v.length && match($substring(val, 0, v.length), v)) {
return [i, $substring(val, v.length), $ifaceNil];
}
_i++;
}
return [-1, val, errBad];
};
appendInt = function(b, x, width) {
var _q, b, buf, i, q, u, w, width, x;
u = ((x >>> 0));
if (x < 0) {
b = $append(b, 45);
u = ((-x >>> 0));
}
buf = arrayType.zero();
i = 20;
while (true) {
if (!(u >= 10)) { break; }
i = i - (1) >> 0;
q = (_q = u / 10, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = ((((48 + u >>> 0) - (q * 10 >>> 0) >>> 0) << 24 >>> 24)));
u = q;
}
i = i - (1) >> 0;
((i < 0 || i >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[i] = (((48 + u >>> 0) << 24 >>> 24)));
w = 20 - i >> 0;
while (true) {
if (!(w < width)) { break; }
b = $append(b, 48);
w = w + (1) >> 0;
}
return $appendSlice(b, $subslice(new sliceType$3(buf), i));
};
atoi = function(s) {
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, err, neg, q, rem, s, x;
x = 0;
err = $ifaceNil;
neg = false;
if (!(s === "") && ((s.charCodeAt(0) === 45) || (s.charCodeAt(0) === 43))) {
neg = s.charCodeAt(0) === 45;
s = $substring(s, 1);
}
_tuple = leadingInt(s);
q = _tuple[0];
rem = _tuple[1];
err = _tuple[2];
x = (((q.$low + ((q.$high >> 31) * 4294967296)) >> 0));
if (!($interfaceIsEqual(err, $ifaceNil)) || !(rem === "")) {
_tmp = 0;
_tmp$1 = atoiError;
x = _tmp;
err = _tmp$1;
return [x, err];
}
if (neg) {
x = -x;
}
_tmp$2 = x;
_tmp$3 = $ifaceNil;
x = _tmp$2;
err = _tmp$3;
return [x, err];
};
formatNano = function(b, nanosec, n, trim) {
var _q, _r, b, buf, n, nanosec, start, trim, u, x;
u = nanosec;
buf = arrayType$1.zero();
start = 9;
while (true) {
if (!(start > 0)) { break; }
start = start - (1) >> 0;
((start < 0 || start >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[start] = ((((_r = u % 10, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) + 48 >>> 0) << 24 >>> 24)));
u = (_q = u / (10), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
}
if (n > 9) {
n = 9;
}
if (trim) {
while (true) {
if (!(n > 0 && ((x = n - 1 >> 0, ((x < 0 || x >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[x])) === 48))) { break; }
n = n - (1) >> 0;
}
if (n === 0) {
return b;
}
}
b = $append(b, 46);
return $appendSlice(b, $subslice(new sliceType$3(buf), 0, n));
};
Time.ptr.prototype.String = function() {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, buf, m0, m1, m2, s, sign, t, wid, x, x$1, x$2, x$3, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; buf = $f.buf; m0 = $f.m0; m1 = $f.m1; m2 = $f.m2; s = $f.s; sign = $f.sign; t = $f.t; wid = $f.wid; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).Format("2006-01-02 15:04:05.999999999 -0700 MST"); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
s = _r;
if (!((x = (x$1 = t.wall, new $Uint64(x$1.$high & 2147483648, (x$1.$low & 0) >>> 0)), (x.$high === 0 && x.$low === 0)))) {
m2 = ((x$2 = t.ext, new $Uint64(x$2.$high, x$2.$low)));
sign = 43;
if ((x$3 = t.ext, (x$3.$high < 0 || (x$3.$high === 0 && x$3.$low < 0)))) {
sign = 45;
m2 = new $Uint64(-m2.$high, -m2.$low);
}
_tmp = $div64(m2, new $Uint64(0, 1000000000), false);
_tmp$1 = $div64(m2, new $Uint64(0, 1000000000), true);
m1 = _tmp;
m2 = _tmp$1;
_tmp$2 = $div64(m1, new $Uint64(0, 1000000000), false);
_tmp$3 = $div64(m1, new $Uint64(0, 1000000000), true);
m0 = _tmp$2;
m1 = _tmp$3;
buf = sliceType$3.nil;
buf = $appendSlice(buf, " m=");
buf = $append(buf, sign);
wid = 0;
if (!((m0.$high === 0 && m0.$low === 0))) {
buf = appendInt(buf, ((m0.$low >> 0)), 0);
wid = 9;
}
buf = appendInt(buf, ((m1.$low >> 0)), wid);
buf = $append(buf, 46);
buf = appendInt(buf, ((m2.$low >> 0)), 9);
s = s + (($bytesToString(buf)));
}
$s = -1; return s;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.String }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f.buf = buf; $f.m0 = m0; $f.m1 = m1; $f.m2 = m2; $f.s = s; $f.sign = sign; $f.t = t; $f.wid = wid; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.String = function() { return this.$val.String(); };
Time.ptr.prototype.Format = function(layout) {
var _r, b, buf, layout, max, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; b = $f.b; buf = $f.buf; layout = $f.layout; max = $f.max; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
b = sliceType$3.nil;
max = layout.length + 10 >> 0;
if (max < 64) {
buf = arrayType$2.zero();
b = $subslice(new sliceType$3(buf), 0, 0);
} else {
b = $makeSlice(sliceType$3, 0, max);
}
_r = $clone(t, Time).AppendFormat(b, layout); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
b = _r;
$s = -1; return ($bytesToString(b));
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Format }; } $f._r = _r; $f.b = b; $f.buf = buf; $f.layout = layout; $f.max = max; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Format = function(layout) { return this.$val.Format(layout); };
Time.ptr.prototype.AppendFormat = function(b, layout) {
var _1, _q, _q$1, _q$2, _q$3, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _tuple, _tuple$1, _tuple$2, _tuple$3, abs, absoffset, b, day, hour, hr, hr$1, layout, m, min, month, name, offset, prefix, s, sec, std, suffix, t, y, year, zone$1, zone$2, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _q = $f._q; _q$1 = $f._q$1; _q$2 = $f._q$2; _q$3 = $f._q$3; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; abs = $f.abs; absoffset = $f.absoffset; b = $f.b; day = $f.day; hour = $f.hour; hr = $f.hr; hr$1 = $f.hr$1; layout = $f.layout; m = $f.m; min = $f.min; month = $f.month; name = $f.name; offset = $f.offset; prefix = $f.prefix; s = $f.s; sec = $f.sec; std = $f.std; suffix = $f.suffix; t = $f.t; y = $f.y; year = $f.year; zone$1 = $f.zone$1; zone$2 = $f.zone$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).locabs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
name = _tuple[0];
offset = _tuple[1];
abs = _tuple[2];
year = -1;
month = 0;
day = 0;
hour = -1;
min = 0;
sec = 0;
while (true) {
if (!(!(layout === ""))) { break; }
_tuple$1 = nextStdChunk(layout);
prefix = _tuple$1[0];
std = _tuple$1[1];
suffix = _tuple$1[2];
if (!(prefix === "")) {
b = $appendSlice(b, prefix);
}
if (std === 0) {
break;
}
layout = suffix;
if (year < 0 && !(((std & 256) === 0))) {
_tuple$2 = absDate(abs, true);
year = _tuple$2[0];
month = _tuple$2[1];
day = _tuple$2[2];
}
if (hour < 0 && !(((std & 512) === 0))) {
_tuple$3 = absClock(abs);
hour = _tuple$3[0];
min = _tuple$3[1];
sec = _tuple$3[2];
}
switch (0) { default:
_1 = std & 65535;
if (_1 === (274)) {
y = year;
if (y < 0) {
y = -y;
}
b = appendInt(b, (_r$1 = y % 100, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")), 2);
} else if (_1 === (273)) {
b = appendInt(b, year, 4);
} else if (_1 === (258)) {
b = $appendSlice(b, $substring(new Month(month).String(), 0, 3));
} else if (_1 === (257)) {
m = new Month(month).String();
b = $appendSlice(b, m);
} else if (_1 === (259)) {
b = appendInt(b, ((month >> 0)), 0);
} else if (_1 === (260)) {
b = appendInt(b, ((month >> 0)), 2);
} else if (_1 === (262)) {
b = $appendSlice(b, $substring(new Weekday(absWeekday(abs)).String(), 0, 3));
} else if (_1 === (261)) {
s = new Weekday(absWeekday(abs)).String();
b = $appendSlice(b, s);
} else if (_1 === (263)) {
b = appendInt(b, day, 0);
} else if (_1 === (264)) {
if (day < 10) {
b = $append(b, 32);
}
b = appendInt(b, day, 0);
} else if (_1 === (265)) {
b = appendInt(b, day, 2);
} else if (_1 === (522)) {
b = appendInt(b, hour, 2);
} else if (_1 === (523)) {
hr = (_r$2 = hour % 12, _r$2 === _r$2 ? _r$2 : $throwRuntimeError("integer divide by zero"));
if (hr === 0) {
hr = 12;
}
b = appendInt(b, hr, 0);
} else if (_1 === (524)) {
hr$1 = (_r$3 = hour % 12, _r$3 === _r$3 ? _r$3 : $throwRuntimeError("integer divide by zero"));
if (hr$1 === 0) {
hr$1 = 12;
}
b = appendInt(b, hr$1, 2);
} else if (_1 === (525)) {
b = appendInt(b, min, 0);
} else if (_1 === (526)) {
b = appendInt(b, min, 2);
} else if (_1 === (527)) {
b = appendInt(b, sec, 0);
} else if (_1 === (528)) {
b = appendInt(b, sec, 2);
} else if (_1 === (531)) {
if (hour >= 12) {
b = $appendSlice(b, "PM");
} else {
b = $appendSlice(b, "AM");
}
} else if (_1 === (532)) {
if (hour >= 12) {
b = $appendSlice(b, "pm");
} else {
b = $appendSlice(b, "am");
}
} else if ((_1 === (22)) || (_1 === (25)) || (_1 === (23)) || (_1 === (24)) || (_1 === (26)) || (_1 === (27)) || (_1 === (30)) || (_1 === (28)) || (_1 === (29)) || (_1 === (31))) {
if ((offset === 0) && ((std === 22) || (std === 25) || (std === 23) || (std === 24) || (std === 26))) {
b = $append(b, 90);
break;
}
zone$1 = (_q = offset / 60, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
absoffset = offset;
if (zone$1 < 0) {
b = $append(b, 45);
zone$1 = -zone$1;
absoffset = -absoffset;
} else {
b = $append(b, 43);
}
b = appendInt(b, (_q$1 = zone$1 / 60, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero")), 2);
if ((std === 25) || (std === 30) || (std === 26) || (std === 31)) {
b = $append(b, 58);
}
if (!((std === 29)) && !((std === 24))) {
b = appendInt(b, (_r$4 = zone$1 % 60, _r$4 === _r$4 ? _r$4 : $throwRuntimeError("integer divide by zero")), 2);
}
if ((std === 23) || (std === 28) || (std === 31) || (std === 26)) {
if ((std === 31) || (std === 26)) {
b = $append(b, 58);
}
b = appendInt(b, (_r$5 = absoffset % 60, _r$5 === _r$5 ? _r$5 : $throwRuntimeError("integer divide by zero")), 2);
}
} else if (_1 === (21)) {
if (!(name === "")) {
b = $appendSlice(b, name);
break;
}
zone$2 = (_q$2 = offset / 60, (_q$2 === _q$2 && _q$2 !== 1/0 && _q$2 !== -1/0) ? _q$2 >> 0 : $throwRuntimeError("integer divide by zero"));
if (zone$2 < 0) {
b = $append(b, 45);
zone$2 = -zone$2;
} else {
b = $append(b, 43);
}
b = appendInt(b, (_q$3 = zone$2 / 60, (_q$3 === _q$3 && _q$3 !== 1/0 && _q$3 !== -1/0) ? _q$3 >> 0 : $throwRuntimeError("integer divide by zero")), 2);
b = appendInt(b, (_r$6 = zone$2 % 60, _r$6 === _r$6 ? _r$6 : $throwRuntimeError("integer divide by zero")), 2);
} else if ((_1 === (32)) || (_1 === (33))) {
b = formatNano(b, (($clone(t, Time).Nanosecond() >>> 0)), std >> 16 >> 0, (std & 65535) === 33);
}
}
}
$s = -1; return b;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.AppendFormat }; } $f._1 = _1; $f._q = _q; $f._q$1 = _q$1; $f._q$2 = _q$2; $f._q$3 = _q$3; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f.abs = abs; $f.absoffset = absoffset; $f.b = b; $f.day = day; $f.hour = hour; $f.hr = hr; $f.hr$1 = hr$1; $f.layout = layout; $f.m = m; $f.min = min; $f.month = month; $f.name = name; $f.offset = offset; $f.prefix = prefix; $f.s = s; $f.sec = sec; $f.std = std; $f.suffix = suffix; $f.t = t; $f.y = y; $f.year = year; $f.zone$1 = zone$1; $f.zone$2 = zone$2; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.AppendFormat = function(b, layout) { return this.$val.AppendFormat(b, layout); };
quote = function(s) {
var s;
return "\"" + s + "\"";
};
ParseError.ptr.prototype.Error = function() {
var e;
e = this;
if (e.Message === "") {
return "parsing time " + quote(e.Value) + " as " + quote(e.Layout) + ": cannot parse " + quote(e.ValueElem) + " as " + quote(e.LayoutElem);
}
return "parsing time " + quote(e.Value) + e.Message;
};
ParseError.prototype.Error = function() { return this.$val.Error(); };
isDigit = function(s, i) {
var c, i, s;
if (s.length <= i) {
return false;
}
c = s.charCodeAt(i);
return 48 <= c && c <= 57;
};
getnum = function(s, fixed) {
var fixed, s;
if (!isDigit(s, 0)) {
return [0, s, errBad];
}
if (!isDigit(s, 1)) {
if (fixed) {
return [0, s, errBad];
}
return [(((s.charCodeAt(0) - 48 << 24 >>> 24) >> 0)), $substring(s, 1), $ifaceNil];
}
return [($imul((((s.charCodeAt(0) - 48 << 24 >>> 24) >> 0)), 10)) + (((s.charCodeAt(1) - 48 << 24 >>> 24) >> 0)) >> 0, $substring(s, 2), $ifaceNil];
};
cutspace = function(s) {
var s;
while (true) {
if (!(s.length > 0 && (s.charCodeAt(0) === 32))) { break; }
s = $substring(s, 1);
}
return s;
};
skip = function(value, prefix) {
var prefix, value;
while (true) {
if (!(prefix.length > 0)) { break; }
if (prefix.charCodeAt(0) === 32) {
if (value.length > 0 && !((value.charCodeAt(0) === 32))) {
return [value, errBad];
}
prefix = cutspace(prefix);
value = cutspace(value);
continue;
}
if ((value.length === 0) || !((value.charCodeAt(0) === prefix.charCodeAt(0)))) {
return [value, errBad];
}
prefix = $substring(prefix, 1);
value = $substring(value, 1);
}
return [value, $ifaceNil];
};
Parse = function(layout, value) {
var _r, layout, value, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; layout = $f.layout; value = $f.value; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = parse(layout, value, $pkg.UTC, $pkg.Local); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Parse }; } $f._r = _r; $f.layout = layout; $f.value = value; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.Parse = Parse;
parse = function(layout, value, defaultLocation, local) {
var _1, _2, _3, _4, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$18, _tmp$19, _tmp$2, _tmp$20, _tmp$21, _tmp$22, _tmp$23, _tmp$24, _tmp$25, _tmp$26, _tmp$27, _tmp$28, _tmp$29, _tmp$3, _tmp$30, _tmp$31, _tmp$32, _tmp$33, _tmp$34, _tmp$35, _tmp$36, _tmp$37, _tmp$38, _tmp$39, _tmp$4, _tmp$40, _tmp$41, _tmp$42, _tmp$43, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, _tuple, _tuple$1, _tuple$10, _tuple$11, _tuple$12, _tuple$13, _tuple$14, _tuple$15, _tuple$16, _tuple$17, _tuple$18, _tuple$19, _tuple$2, _tuple$20, _tuple$21, _tuple$22, _tuple$23, _tuple$24, _tuple$3, _tuple$4, _tuple$5, _tuple$6, _tuple$7, _tuple$8, _tuple$9, alayout, amSet, avalue, day, defaultLocation, err, hour, hour$1, hr, i, layout, local, min, min$1, mm, month, n, n$1, name, ndigit, nsec, offset, offset$1, ok, ok$1, p, pmSet, prefix, rangeErrString, sec, seconds, sign, ss, std, stdstr, suffix, t, t$1, value, x, x$1, year, z, zoneName, zoneOffset, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _4 = $f._4; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$10 = $f._tmp$10; _tmp$11 = $f._tmp$11; _tmp$12 = $f._tmp$12; _tmp$13 = $f._tmp$13; _tmp$14 = $f._tmp$14; _tmp$15 = $f._tmp$15; _tmp$16 = $f._tmp$16; _tmp$17 = $f._tmp$17; _tmp$18 = $f._tmp$18; _tmp$19 = $f._tmp$19; _tmp$2 = $f._tmp$2; _tmp$20 = $f._tmp$20; _tmp$21 = $f._tmp$21; _tmp$22 = $f._tmp$22; _tmp$23 = $f._tmp$23; _tmp$24 = $f._tmp$24; _tmp$25 = $f._tmp$25; _tmp$26 = $f._tmp$26; _tmp$27 = $f._tmp$27; _tmp$28 = $f._tmp$28; _tmp$29 = $f._tmp$29; _tmp$3 = $f._tmp$3; _tmp$30 = $f._tmp$30; _tmp$31 = $f._tmp$31; _tmp$32 = $f._tmp$32; _tmp$33 = $f._tmp$33; _tmp$34 = $f._tmp$34; _tmp$35 = $f._tmp$35; _tmp$36 = $f._tmp$36; _tmp$37 = $f._tmp$37; _tmp$38 = $f._tmp$38; _tmp$39 = $f._tmp$39; _tmp$4 = $f._tmp$4; _tmp$40 = $f._tmp$40; _tmp$41 = $f._tmp$41; _tmp$42 = $f._tmp$42; _tmp$43 = $f._tmp$43; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tmp$8 = $f._tmp$8; _tmp$9 = $f._tmp$9; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$10 = $f._tuple$10; _tuple$11 = $f._tuple$11; _tuple$12 = $f._tuple$12; _tuple$13 = $f._tuple$13; _tuple$14 = $f._tuple$14; _tuple$15 = $f._tuple$15; _tuple$16 = $f._tuple$16; _tuple$17 = $f._tuple$17; _tuple$18 = $f._tuple$18; _tuple$19 = $f._tuple$19; _tuple$2 = $f._tuple$2; _tuple$20 = $f._tuple$20; _tuple$21 = $f._tuple$21; _tuple$22 = $f._tuple$22; _tuple$23 = $f._tuple$23; _tuple$24 = $f._tuple$24; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; _tuple$7 = $f._tuple$7; _tuple$8 = $f._tuple$8; _tuple$9 = $f._tuple$9; alayout = $f.alayout; amSet = $f.amSet; avalue = $f.avalue; day = $f.day; defaultLocation = $f.defaultLocation; err = $f.err; hour = $f.hour; hour$1 = $f.hour$1; hr = $f.hr; i = $f.i; layout = $f.layout; local = $f.local; min = $f.min; min$1 = $f.min$1; mm = $f.mm; month = $f.month; n = $f.n; n$1 = $f.n$1; name = $f.name; ndigit = $f.ndigit; nsec = $f.nsec; offset = $f.offset; offset$1 = $f.offset$1; ok = $f.ok; ok$1 = $f.ok$1; p = $f.p; pmSet = $f.pmSet; prefix = $f.prefix; rangeErrString = $f.rangeErrString; sec = $f.sec; seconds = $f.seconds; sign = $f.sign; ss = $f.ss; std = $f.std; stdstr = $f.stdstr; suffix = $f.suffix; t = $f.t; t$1 = $f.t$1; value = $f.value; x = $f.x; x$1 = $f.x$1; year = $f.year; z = $f.z; zoneName = $f.zoneName; zoneOffset = $f.zoneOffset; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_tmp = layout;
_tmp$1 = value;
alayout = _tmp;
avalue = _tmp$1;
rangeErrString = "";
amSet = false;
pmSet = false;
year = 0;
month = 1;
day = 1;
hour = 0;
min = 0;
sec = 0;
nsec = 0;
z = ptrType$2.nil;
zoneOffset = -1;
zoneName = "";
while (true) {
err = $ifaceNil;
_tuple = nextStdChunk(layout);
prefix = _tuple[0];
std = _tuple[1];
suffix = _tuple[2];
stdstr = $substring(layout, prefix.length, (layout.length - suffix.length >> 0));
_tuple$1 = skip(value, prefix);
value = _tuple$1[0];
err = _tuple$1[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, prefix, value, "")];
}
if (std === 0) {
if (!((value.length === 0))) {
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, "", value, ": extra text: " + value)];
}
break;
}
layout = suffix;
p = "";
switch (0) { default:
_1 = std & 65535;
if (_1 === (274)) {
if (value.length < 2) {
err = errBad;
break;
}
_tmp$2 = $substring(value, 0, 2);
_tmp$3 = $substring(value, 2);
p = _tmp$2;
value = _tmp$3;
_tuple$2 = atoi(p);
year = _tuple$2[0];
err = _tuple$2[1];
if (year >= 69) {
year = year + (1900) >> 0;
} else {
year = year + (2000) >> 0;
}
} else if (_1 === (273)) {
if (value.length < 4 || !isDigit(value, 0)) {
err = errBad;
break;
}
_tmp$4 = $substring(value, 0, 4);
_tmp$5 = $substring(value, 4);
p = _tmp$4;
value = _tmp$5;
_tuple$3 = atoi(p);
year = _tuple$3[0];
err = _tuple$3[1];
} else if (_1 === (258)) {
_tuple$4 = lookup(shortMonthNames, value);
month = _tuple$4[0];
value = _tuple$4[1];
err = _tuple$4[2];
} else if (_1 === (257)) {
_tuple$5 = lookup(longMonthNames, value);
month = _tuple$5[0];
value = _tuple$5[1];
err = _tuple$5[2];
} else if ((_1 === (259)) || (_1 === (260))) {
_tuple$6 = getnum(value, std === 260);
month = _tuple$6[0];
value = _tuple$6[1];
err = _tuple$6[2];
if (month <= 0 || 12 < month) {
rangeErrString = "month";
}
} else if (_1 === (262)) {
_tuple$7 = lookup(shortDayNames, value);
value = _tuple$7[1];
err = _tuple$7[2];
} else if (_1 === (261)) {
_tuple$8 = lookup(longDayNames, value);
value = _tuple$8[1];
err = _tuple$8[2];
} else if ((_1 === (263)) || (_1 === (264)) || (_1 === (265))) {
if ((std === 264) && value.length > 0 && (value.charCodeAt(0) === 32)) {
value = $substring(value, 1);
}
_tuple$9 = getnum(value, std === 265);
day = _tuple$9[0];
value = _tuple$9[1];
err = _tuple$9[2];
if (day < 0) {
rangeErrString = "day";
}
} else if (_1 === (522)) {
_tuple$10 = getnum(value, false);
hour = _tuple$10[0];
value = _tuple$10[1];
err = _tuple$10[2];
if (hour < 0 || 24 <= hour) {
rangeErrString = "hour";
}
} else if ((_1 === (523)) || (_1 === (524))) {
_tuple$11 = getnum(value, std === 524);
hour = _tuple$11[0];
value = _tuple$11[1];
err = _tuple$11[2];
if (hour < 0 || 12 < hour) {
rangeErrString = "hour";
}
} else if ((_1 === (525)) || (_1 === (526))) {
_tuple$12 = getnum(value, std === 526);
min = _tuple$12[0];
value = _tuple$12[1];
err = _tuple$12[2];
if (min < 0 || 60 <= min) {
rangeErrString = "minute";
}
} else if ((_1 === (527)) || (_1 === (528))) {
_tuple$13 = getnum(value, std === 528);
sec = _tuple$13[0];
value = _tuple$13[1];
err = _tuple$13[2];
if (sec < 0 || 60 <= sec) {
rangeErrString = "second";
break;
}
if (value.length >= 2 && (value.charCodeAt(0) === 46) && isDigit(value, 1)) {
_tuple$14 = nextStdChunk(layout);
std = _tuple$14[1];
std = std & (65535);
if ((std === 32) || (std === 33)) {
break;
}
n = 2;
while (true) {
if (!(n < value.length && isDigit(value, n))) { break; }
n = n + (1) >> 0;
}
_tuple$15 = parseNanoseconds(value, n);
nsec = _tuple$15[0];
rangeErrString = _tuple$15[1];
err = _tuple$15[2];
value = $substring(value, n);
}
} else if (_1 === (531)) {
if (value.length < 2) {
err = errBad;
break;
}
_tmp$6 = $substring(value, 0, 2);
_tmp$7 = $substring(value, 2);
p = _tmp$6;
value = _tmp$7;
_2 = p;
if (_2 === ("PM")) {
pmSet = true;
} else if (_2 === ("AM")) {
amSet = true;
} else {
err = errBad;
}
} else if (_1 === (532)) {
if (value.length < 2) {
err = errBad;
break;
}
_tmp$8 = $substring(value, 0, 2);
_tmp$9 = $substring(value, 2);
p = _tmp$8;
value = _tmp$9;
_3 = p;
if (_3 === ("pm")) {
pmSet = true;
} else if (_3 === ("am")) {
amSet = true;
} else {
err = errBad;
}
} else if ((_1 === (22)) || (_1 === (25)) || (_1 === (23)) || (_1 === (24)) || (_1 === (26)) || (_1 === (27)) || (_1 === (29)) || (_1 === (30)) || (_1 === (28)) || (_1 === (31))) {
if (((std === 22) || (std === 24) || (std === 25)) && value.length >= 1 && (value.charCodeAt(0) === 90)) {
value = $substring(value, 1);
z = $pkg.UTC;
break;
}
_tmp$10 = "";
_tmp$11 = "";
_tmp$12 = "";
_tmp$13 = "";
sign = _tmp$10;
hour$1 = _tmp$11;
min$1 = _tmp$12;
seconds = _tmp$13;
if ((std === 25) || (std === 30)) {
if (value.length < 6) {
err = errBad;
break;
}
if (!((value.charCodeAt(3) === 58))) {
err = errBad;
break;
}
_tmp$14 = $substring(value, 0, 1);
_tmp$15 = $substring(value, 1, 3);
_tmp$16 = $substring(value, 4, 6);
_tmp$17 = "00";
_tmp$18 = $substring(value, 6);
sign = _tmp$14;
hour$1 = _tmp$15;
min$1 = _tmp$16;
seconds = _tmp$17;
value = _tmp$18;
} else if ((std === 29) || (std === 24)) {
if (value.length < 3) {
err = errBad;
break;
}
_tmp$19 = $substring(value, 0, 1);
_tmp$20 = $substring(value, 1, 3);
_tmp$21 = "00";
_tmp$22 = "00";
_tmp$23 = $substring(value, 3);
sign = _tmp$19;
hour$1 = _tmp$20;
min$1 = _tmp$21;
seconds = _tmp$22;
value = _tmp$23;
} else if ((std === 26) || (std === 31)) {
if (value.length < 9) {
err = errBad;
break;
}
if (!((value.charCodeAt(3) === 58)) || !((value.charCodeAt(6) === 58))) {
err = errBad;
break;
}
_tmp$24 = $substring(value, 0, 1);
_tmp$25 = $substring(value, 1, 3);
_tmp$26 = $substring(value, 4, 6);
_tmp$27 = $substring(value, 7, 9);
_tmp$28 = $substring(value, 9);
sign = _tmp$24;
hour$1 = _tmp$25;
min$1 = _tmp$26;
seconds = _tmp$27;
value = _tmp$28;
} else if ((std === 23) || (std === 28)) {
if (value.length < 7) {
err = errBad;
break;
}
_tmp$29 = $substring(value, 0, 1);
_tmp$30 = $substring(value, 1, 3);
_tmp$31 = $substring(value, 3, 5);
_tmp$32 = $substring(value, 5, 7);
_tmp$33 = $substring(value, 7);
sign = _tmp$29;
hour$1 = _tmp$30;
min$1 = _tmp$31;
seconds = _tmp$32;
value = _tmp$33;
} else {
if (value.length < 5) {
err = errBad;
break;
}
_tmp$34 = $substring(value, 0, 1);
_tmp$35 = $substring(value, 1, 3);
_tmp$36 = $substring(value, 3, 5);
_tmp$37 = "00";
_tmp$38 = $substring(value, 5);
sign = _tmp$34;
hour$1 = _tmp$35;
min$1 = _tmp$36;
seconds = _tmp$37;
value = _tmp$38;
}
_tmp$39 = 0;
_tmp$40 = 0;
_tmp$41 = 0;
hr = _tmp$39;
mm = _tmp$40;
ss = _tmp$41;
_tuple$16 = atoi(hour$1);
hr = _tuple$16[0];
err = _tuple$16[1];
if ($interfaceIsEqual(err, $ifaceNil)) {
_tuple$17 = atoi(min$1);
mm = _tuple$17[0];
err = _tuple$17[1];
}
if ($interfaceIsEqual(err, $ifaceNil)) {
_tuple$18 = atoi(seconds);
ss = _tuple$18[0];
err = _tuple$18[1];
}
zoneOffset = ($imul(((($imul(hr, 60)) + mm >> 0)), 60)) + ss >> 0;
_4 = sign.charCodeAt(0);
if (_4 === (43)) {
} else if (_4 === (45)) {
zoneOffset = -zoneOffset;
} else {
err = errBad;
}
} else if (_1 === (21)) {
if (value.length >= 3 && $substring(value, 0, 3) === "UTC") {
z = $pkg.UTC;
value = $substring(value, 3);
break;
}
_tuple$19 = parseTimeZone(value);
n$1 = _tuple$19[0];
ok = _tuple$19[1];
if (!ok) {
err = errBad;
break;
}
_tmp$42 = $substring(value, 0, n$1);
_tmp$43 = $substring(value, n$1);
zoneName = _tmp$42;
value = _tmp$43;
} else if (_1 === (32)) {
ndigit = 1 + ((std >> 16 >> 0)) >> 0;
if (value.length < ndigit) {
err = errBad;
break;
}
_tuple$20 = parseNanoseconds(value, ndigit);
nsec = _tuple$20[0];
rangeErrString = _tuple$20[1];
err = _tuple$20[2];
value = $substring(value, ndigit);
} else if (_1 === (33)) {
if (value.length < 2 || !((value.charCodeAt(0) === 46)) || value.charCodeAt(1) < 48 || 57 < value.charCodeAt(1)) {
break;
}
i = 0;
while (true) {
if (!(i < 9 && (i + 1 >> 0) < value.length && 48 <= value.charCodeAt((i + 1 >> 0)) && value.charCodeAt((i + 1 >> 0)) <= 57)) { break; }
i = i + (1) >> 0;
}
_tuple$21 = parseNanoseconds(value, 1 + i >> 0);
nsec = _tuple$21[0];
rangeErrString = _tuple$21[1];
err = _tuple$21[2];
value = $substring(value, (1 + i >> 0));
}
}
if (!(rangeErrString === "")) {
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, stdstr, value, ": " + rangeErrString + " out of range")];
}
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, stdstr, value, "")];
}
}
if (pmSet && hour < 12) {
hour = hour + (12) >> 0;
} else if (amSet && (hour === 12)) {
hour = 0;
}
if (day < 1 || day > daysIn(((month >> 0)), year)) {
$s = -1; return [new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil), new ParseError.ptr(alayout, avalue, "", value, ": day out of range")];
}
/* */ if (!(z === ptrType$2.nil)) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!(z === ptrType$2.nil)) { */ case 1:
_r = Date(year, ((month >> 0)), day, hour, min, sec, nsec, z); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return [_r, $ifaceNil];
/* } */ case 2:
/* */ if (!((zoneOffset === -1))) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (!((zoneOffset === -1))) { */ case 4:
_r$1 = Date(year, ((month >> 0)), day, hour, min, sec, nsec, $pkg.UTC); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
t = $clone(_r$1, Time);
t.addSec((x = (new $Int64(0, zoneOffset)), new $Int64(-x.$high, -x.$low)));
_r$2 = local.lookup(t.unixSec()); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_tuple$22 = _r$2;
name = _tuple$22[0];
offset = _tuple$22[1];
if ((offset === zoneOffset) && (zoneName === "" || name === zoneName)) {
t.setLoc(local);
$s = -1; return [t, $ifaceNil];
}
t.setLoc(FixedZone(zoneName, zoneOffset));
$s = -1; return [t, $ifaceNil];
/* } */ case 5:
/* */ if (!(zoneName === "")) { $s = 8; continue; }
/* */ $s = 9; continue;
/* if (!(zoneName === "")) { */ case 8:
_r$3 = Date(year, ((month >> 0)), day, hour, min, sec, nsec, $pkg.UTC); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
t$1 = $clone(_r$3, Time);
_r$4 = local.lookupName(zoneName, t$1.unixSec()); /* */ $s = 11; case 11: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
_tuple$23 = _r$4;
offset$1 = _tuple$23[0];
ok$1 = _tuple$23[2];
if (ok$1) {
t$1.addSec((x$1 = (new $Int64(0, offset$1)), new $Int64(-x$1.$high, -x$1.$low)));
t$1.setLoc(local);
$s = -1; return [t$1, $ifaceNil];
}
if (zoneName.length > 3 && $substring(zoneName, 0, 3) === "GMT") {
_tuple$24 = atoi($substring(zoneName, 3));
offset$1 = _tuple$24[0];
offset$1 = $imul(offset$1, (3600));
}
t$1.setLoc(FixedZone(zoneName, offset$1));
$s = -1; return [t$1, $ifaceNil];
/* } */ case 9:
_r$5 = Date(year, ((month >> 0)), day, hour, min, sec, nsec, defaultLocation); /* */ $s = 12; case 12: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
$s = -1; return [_r$5, $ifaceNil];
/* */ } return; } if ($f === undefined) { $f = { $blk: parse }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._4 = _4; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$10 = _tmp$10; $f._tmp$11 = _tmp$11; $f._tmp$12 = _tmp$12; $f._tmp$13 = _tmp$13; $f._tmp$14 = _tmp$14; $f._tmp$15 = _tmp$15; $f._tmp$16 = _tmp$16; $f._tmp$17 = _tmp$17; $f._tmp$18 = _tmp$18; $f._tmp$19 = _tmp$19; $f._tmp$2 = _tmp$2; $f._tmp$20 = _tmp$20; $f._tmp$21 = _tmp$21; $f._tmp$22 = _tmp$22; $f._tmp$23 = _tmp$23; $f._tmp$24 = _tmp$24; $f._tmp$25 = _tmp$25; $f._tmp$26 = _tmp$26; $f._tmp$27 = _tmp$27; $f._tmp$28 = _tmp$28; $f._tmp$29 = _tmp$29; $f._tmp$3 = _tmp$3; $f._tmp$30 = _tmp$30; $f._tmp$31 = _tmp$31; $f._tmp$32 = _tmp$32; $f._tmp$33 = _tmp$33; $f._tmp$34 = _tmp$34; $f._tmp$35 = _tmp$35; $f._tmp$36 = _tmp$36; $f._tmp$37 = _tmp$37; $f._tmp$38 = _tmp$38; $f._tmp$39 = _tmp$39; $f._tmp$4 = _tmp$4; $f._tmp$40 = _tmp$40; $f._tmp$41 = _tmp$41; $f._tmp$42 = _tmp$42; $f._tmp$43 = _tmp$43; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tmp$8 = _tmp$8; $f._tmp$9 = _tmp$9; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$10 = _tuple$10; $f._tuple$11 = _tuple$11; $f._tuple$12 = _tuple$12; $f._tuple$13 = _tuple$13; $f._tuple$14 = _tuple$14; $f._tuple$15 = _tuple$15; $f._tuple$16 = _tuple$16; $f._tuple$17 = _tuple$17; $f._tuple$18 = _tuple$18; $f._tuple$19 = _tuple$19; $f._tuple$2 = _tuple$2; $f._tuple$20 = _tuple$20; $f._tuple$21 = _tuple$21; $f._tuple$22 = _tuple$22; $f._tuple$23 = _tuple$23; $f._tuple$24 = _tuple$24; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f._tuple$7 = _tuple$7; $f._tuple$8 = _tuple$8; $f._tuple$9 = _tuple$9; $f.alayout = alayout; $f.amSet = amSet; $f.avalue = avalue; $f.day = day; $f.defaultLocation = defaultLocation; $f.err = err; $f.hour = hour; $f.hour$1 = hour$1; $f.hr = hr; $f.i = i; $f.layout = layout; $f.local = local; $f.min = min; $f.min$1 = min$1; $f.mm = mm; $f.month = month; $f.n = n; $f.n$1 = n$1; $f.name = name; $f.ndigit = ndigit; $f.nsec = nsec; $f.offset = offset; $f.offset$1 = offset$1; $f.ok = ok; $f.ok$1 = ok$1; $f.p = p; $f.pmSet = pmSet; $f.prefix = prefix; $f.rangeErrString = rangeErrString; $f.sec = sec; $f.seconds = seconds; $f.sign = sign; $f.ss = ss; $f.std = std; $f.stdstr = stdstr; $f.suffix = suffix; $f.t = t; $f.t$1 = t$1; $f.value = value; $f.x = x; $f.x$1 = x$1; $f.year = year; $f.z = z; $f.zoneName = zoneName; $f.zoneOffset = zoneOffset; $f.$s = $s; $f.$r = $r; return $f;
};
parseTimeZone = function(value) {
var _1, _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, c, length, nUpper, ok, value;
length = 0;
ok = false;
if (value.length < 3) {
_tmp = 0;
_tmp$1 = false;
length = _tmp;
ok = _tmp$1;
return [length, ok];
}
if (value.length >= 4 && ($substring(value, 0, 4) === "ChST" || $substring(value, 0, 4) === "MeST")) {
_tmp$2 = 4;
_tmp$3 = true;
length = _tmp$2;
ok = _tmp$3;
return [length, ok];
}
if ($substring(value, 0, 3) === "GMT") {
length = parseGMT(value);
_tmp$4 = length;
_tmp$5 = true;
length = _tmp$4;
ok = _tmp$5;
return [length, ok];
}
nUpper = 0;
nUpper = 0;
while (true) {
if (!(nUpper < 6)) { break; }
if (nUpper >= value.length) {
break;
}
c = value.charCodeAt(nUpper);
if (c < 65 || 90 < c) {
break;
}
nUpper = nUpper + (1) >> 0;
}
_1 = nUpper;
if ((_1 === (0)) || (_1 === (1)) || (_1 === (2)) || (_1 === (6))) {
_tmp$6 = 0;
_tmp$7 = false;
length = _tmp$6;
ok = _tmp$7;
return [length, ok];
} else if (_1 === (5)) {
if (value.charCodeAt(4) === 84) {
_tmp$8 = 5;
_tmp$9 = true;
length = _tmp$8;
ok = _tmp$9;
return [length, ok];
}
} else if (_1 === (4)) {
if ((value.charCodeAt(3) === 84) || $substring(value, 0, 4) === "WITA") {
_tmp$10 = 4;
_tmp$11 = true;
length = _tmp$10;
ok = _tmp$11;
return [length, ok];
}
} else if (_1 === (3)) {
_tmp$12 = 3;
_tmp$13 = true;
length = _tmp$12;
ok = _tmp$13;
return [length, ok];
}
_tmp$14 = 0;
_tmp$15 = false;
length = _tmp$14;
ok = _tmp$15;
return [length, ok];
};
parseGMT = function(value) {
var _tuple, err, rem, sign, value, x;
value = $substring(value, 3);
if (value.length === 0) {
return 3;
}
sign = value.charCodeAt(0);
if (!((sign === 45)) && !((sign === 43))) {
return 3;
}
_tuple = leadingInt($substring(value, 1));
x = _tuple[0];
rem = _tuple[1];
err = _tuple[2];
if (!($interfaceIsEqual(err, $ifaceNil))) {
return 3;
}
if (sign === 45) {
x = new $Int64(-x.$high, -x.$low);
}
if ((x.$high === 0 && x.$low === 0) || (x.$high < -1 || (x.$high === -1 && x.$low < 4294967282)) || (0 < x.$high || (0 === x.$high && 12 < x.$low))) {
return 3;
}
return (3 + value.length >> 0) - rem.length >> 0;
};
parseNanoseconds = function(value, nbytes) {
var _tuple, err, i, nbytes, ns, rangeErrString, scaleDigits, value;
ns = 0;
rangeErrString = "";
err = $ifaceNil;
if (!((value.charCodeAt(0) === 46))) {
err = errBad;
return [ns, rangeErrString, err];
}
_tuple = atoi($substring(value, 1, nbytes));
ns = _tuple[0];
err = _tuple[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
return [ns, rangeErrString, err];
}
if (ns < 0 || 1000000000 <= ns) {
rangeErrString = "fractional second";
return [ns, rangeErrString, err];
}
scaleDigits = 10 - nbytes >> 0;
i = 0;
while (true) {
if (!(i < scaleDigits)) { break; }
ns = $imul(ns, (10));
i = i + (1) >> 0;
}
return [ns, rangeErrString, err];
};
leadingInt = function(s) {
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, c, err, i, rem, s, x, x$1, x$2, x$3;
x = new $Int64(0, 0);
rem = "";
err = $ifaceNil;
i = 0;
while (true) {
if (!(i < s.length)) { break; }
c = s.charCodeAt(i);
if (c < 48 || c > 57) {
break;
}
if ((x.$high > 214748364 || (x.$high === 214748364 && x.$low > 3435973836))) {
_tmp = new $Int64(0, 0);
_tmp$1 = "";
_tmp$2 = errLeadingInt;
x = _tmp;
rem = _tmp$1;
err = _tmp$2;
return [x, rem, err];
}
x = (x$1 = (x$2 = $mul64(x, new $Int64(0, 10)), x$3 = (new $Int64(0, c)), new $Int64(x$2.$high + x$3.$high, x$2.$low + x$3.$low)), new $Int64(x$1.$high - 0, x$1.$low - 48));
if ((x.$high < 0 || (x.$high === 0 && x.$low < 0))) {
_tmp$3 = new $Int64(0, 0);
_tmp$4 = "";
_tmp$5 = errLeadingInt;
x = _tmp$3;
rem = _tmp$4;
err = _tmp$5;
return [x, rem, err];
}
i = i + (1) >> 0;
}
_tmp$6 = x;
_tmp$7 = $substring(s, i);
_tmp$8 = $ifaceNil;
x = _tmp$6;
rem = _tmp$7;
err = _tmp$8;
return [x, rem, err];
};
Time.ptr.prototype.nsec = function() {
var t, x;
t = this;
return (((x = t.wall, new $Uint64(x.$high & 0, (x.$low & 1073741823) >>> 0)).$low >> 0));
};
Time.prototype.nsec = function() { return this.$val.nsec(); };
Time.ptr.prototype.sec = function() {
var t, x, x$1, x$2, x$3;
t = this;
if (!((x = (x$1 = t.wall, new $Uint64(x$1.$high & 2147483648, (x$1.$low & 0) >>> 0)), (x.$high === 0 && x.$low === 0)))) {
return (x$2 = ((x$3 = $shiftRightUint64($shiftLeft64(t.wall, 1), 31), new $Int64(x$3.$high, x$3.$low))), new $Int64(13 + x$2.$high, 3618733952 + x$2.$low));
}
return (t.ext);
};
Time.prototype.sec = function() { return this.$val.sec(); };
Time.ptr.prototype.unixSec = function() {
var t, x;
t = this;
return (x = t.sec(), new $Int64(x.$high + -15, x.$low + 2288912640));
};
Time.prototype.unixSec = function() { return this.$val.unixSec(); };
Time.ptr.prototype.addSec = function(d) {
var d, dsec, sec, t, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8;
t = this;
if (!((x = (x$1 = t.wall, new $Uint64(x$1.$high & 2147483648, (x$1.$low & 0) >>> 0)), (x.$high === 0 && x.$low === 0)))) {
sec = ((x$2 = $shiftRightUint64($shiftLeft64(t.wall, 1), 31), new $Int64(x$2.$high, x$2.$low)));
dsec = new $Int64(sec.$high + d.$high, sec.$low + d.$low);
if ((0 < dsec.$high || (0 === dsec.$high && 0 <= dsec.$low)) && (dsec.$high < 1 || (dsec.$high === 1 && dsec.$low <= 4294967295))) {
t.wall = (x$3 = (x$4 = (x$5 = t.wall, new $Uint64(x$5.$high & 0, (x$5.$low & 1073741823) >>> 0)), x$6 = $shiftLeft64((new $Uint64(dsec.$high, dsec.$low)), 30), new $Uint64(x$4.$high | x$6.$high, (x$4.$low | x$6.$low) >>> 0)), new $Uint64(x$3.$high | 2147483648, (x$3.$low | 0) >>> 0));
return;
}
t.stripMono();
}
t.ext = (x$7 = t.ext, x$8 = d, new $Int64(x$7.$high + x$8.$high, x$7.$low + x$8.$low));
};
Time.prototype.addSec = function(d) { return this.$val.addSec(d); };
Time.ptr.prototype.setLoc = function(loc) {
var loc, t;
t = this;
if (loc === utcLoc) {
loc = ptrType$2.nil;
}
t.stripMono();
t.loc = loc;
};
Time.prototype.setLoc = function(loc) { return this.$val.setLoc(loc); };
Time.ptr.prototype.stripMono = function() {
var t, x, x$1, x$2, x$3;
t = this;
if (!((x = (x$1 = t.wall, new $Uint64(x$1.$high & 2147483648, (x$1.$low & 0) >>> 0)), (x.$high === 0 && x.$low === 0)))) {
t.ext = t.sec();
t.wall = (x$2 = t.wall, x$3 = new $Uint64(0, 1073741823), new $Uint64(x$2.$high & x$3.$high, (x$2.$low & x$3.$low) >>> 0));
}
};
Time.prototype.stripMono = function() { return this.$val.stripMono(); };
Time.ptr.prototype.After = function(u) {
var t, ts, u, us, x, x$1, x$2, x$3, x$4, x$5;
t = this;
if (!((x = (x$1 = (x$2 = t.wall, x$3 = u.wall, new $Uint64(x$2.$high & x$3.$high, (x$2.$low & x$3.$low) >>> 0)), new $Uint64(x$1.$high & 2147483648, (x$1.$low & 0) >>> 0)), (x.$high === 0 && x.$low === 0)))) {
return (x$4 = t.ext, x$5 = u.ext, (x$4.$high > x$5.$high || (x$4.$high === x$5.$high && x$4.$low > x$5.$low)));
}
ts = t.sec();
us = u.sec();
return (ts.$high > us.$high || (ts.$high === us.$high && ts.$low > us.$low)) || (ts.$high === us.$high && ts.$low === us.$low) && t.nsec() > u.nsec();
};
Time.prototype.After = function(u) { return this.$val.After(u); };
Time.ptr.prototype.Before = function(u) {
var t, u, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
t = this;
if (!((x = (x$1 = (x$2 = t.wall, x$3 = u.wall, new $Uint64(x$2.$high & x$3.$high, (x$2.$low & x$3.$low) >>> 0)), new $Uint64(x$1.$high & 2147483648, (x$1.$low & 0) >>> 0)), (x.$high === 0 && x.$low === 0)))) {
return (x$4 = t.ext, x$5 = u.ext, (x$4.$high < x$5.$high || (x$4.$high === x$5.$high && x$4.$low < x$5.$low)));
}
return (x$6 = t.sec(), x$7 = u.sec(), (x$6.$high < x$7.$high || (x$6.$high === x$7.$high && x$6.$low < x$7.$low))) || (x$8 = t.sec(), x$9 = u.sec(), (x$8.$high === x$9.$high && x$8.$low === x$9.$low)) && t.nsec() < u.nsec();
};
Time.prototype.Before = function(u) { return this.$val.Before(u); };
Time.ptr.prototype.Equal = function(u) {
var t, u, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7;
t = this;
if (!((x = (x$1 = (x$2 = t.wall, x$3 = u.wall, new $Uint64(x$2.$high & x$3.$high, (x$2.$low & x$3.$low) >>> 0)), new $Uint64(x$1.$high & 2147483648, (x$1.$low & 0) >>> 0)), (x.$high === 0 && x.$low === 0)))) {
return (x$4 = t.ext, x$5 = u.ext, (x$4.$high === x$5.$high && x$4.$low === x$5.$low));
}
return (x$6 = t.sec(), x$7 = u.sec(), (x$6.$high === x$7.$high && x$6.$low === x$7.$low)) && (t.nsec() === u.nsec());
};
Time.prototype.Equal = function(u) { return this.$val.Equal(u); };
Month.prototype.String = function() {
var buf, m, n, x;
m = this.$val;
if (1 <= m && m <= 12) {
return (x = m - 1 >> 0, ((x < 0 || x >= months.length) ? ($throwRuntimeError("index out of range"), undefined) : months[x]));
}
buf = $makeSlice(sliceType$3, 20);
n = fmtInt(buf, (new $Uint64(0, m)));
return "%!Month(" + ($bytesToString($subslice(buf, n))) + ")";
};
$ptrType(Month).prototype.String = function() { return new Month(this.$get()).String(); };
Weekday.prototype.String = function() {
var d;
d = this.$val;
return ((d < 0 || d >= days.length) ? ($throwRuntimeError("index out of range"), undefined) : days[d]);
};
$ptrType(Weekday).prototype.String = function() { return new Weekday(this.$get()).String(); };
Time.ptr.prototype.IsZero = function() {
var t, x;
t = this;
return (x = t.sec(), (x.$high === 0 && x.$low === 0)) && (t.nsec() === 0);
};
Time.prototype.IsZero = function() { return this.$val.IsZero(); };
Time.ptr.prototype.abs = function() {
var _r, _r$1, _tuple, l, offset, sec, t, x, x$1, x$2, x$3, x$4, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; l = $f.l; offset = $f.offset; sec = $f.sec; t = $f.t; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
l = t.loc;
/* */ if (l === ptrType$2.nil || l === localLoc) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (l === ptrType$2.nil || l === localLoc) { */ case 1:
_r = l.get(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
l = _r;
/* } */ case 2:
sec = t.unixSec();
/* */ if (!(l === utcLoc)) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (!(l === utcLoc)) { */ case 4:
/* */ if (!(l.cacheZone === ptrType.nil) && (x = l.cacheStart, (x.$high < sec.$high || (x.$high === sec.$high && x.$low <= sec.$low))) && (x$1 = l.cacheEnd, (sec.$high < x$1.$high || (sec.$high === x$1.$high && sec.$low < x$1.$low)))) { $s = 6; continue; }
/* */ $s = 7; continue;
/* if (!(l.cacheZone === ptrType.nil) && (x = l.cacheStart, (x.$high < sec.$high || (x.$high === sec.$high && x.$low <= sec.$low))) && (x$1 = l.cacheEnd, (sec.$high < x$1.$high || (sec.$high === x$1.$high && sec.$low < x$1.$low)))) { */ case 6:
sec = (x$2 = (new $Int64(0, l.cacheZone.offset)), new $Int64(sec.$high + x$2.$high, sec.$low + x$2.$low));
$s = 8; continue;
/* } else { */ case 7:
_r$1 = l.lookup(sec); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple = _r$1;
offset = _tuple[1];
sec = (x$3 = (new $Int64(0, offset)), new $Int64(sec.$high + x$3.$high, sec.$low + x$3.$low));
/* } */ case 8:
/* } */ case 5:
$s = -1; return ((x$4 = new $Int64(sec.$high + 2147483646, sec.$low + 450480384), new $Uint64(x$4.$high, x$4.$low)));
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.abs }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.l = l; $f.offset = offset; $f.sec = sec; $f.t = t; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.abs = function() { return this.$val.abs(); };
Time.ptr.prototype.locabs = function() {
var _r, _r$1, _tuple, abs, l, name, offset, sec, t, x, x$1, x$2, x$3, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; abs = $f.abs; l = $f.l; name = $f.name; offset = $f.offset; sec = $f.sec; t = $f.t; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
name = "";
offset = 0;
abs = new $Uint64(0, 0);
t = this;
l = t.loc;
/* */ if (l === ptrType$2.nil || l === localLoc) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (l === ptrType$2.nil || l === localLoc) { */ case 1:
_r = l.get(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
l = _r;
/* } */ case 2:
sec = t.unixSec();
/* */ if (!(l === utcLoc)) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (!(l === utcLoc)) { */ case 4:
/* */ if (!(l.cacheZone === ptrType.nil) && (x = l.cacheStart, (x.$high < sec.$high || (x.$high === sec.$high && x.$low <= sec.$low))) && (x$1 = l.cacheEnd, (sec.$high < x$1.$high || (sec.$high === x$1.$high && sec.$low < x$1.$low)))) { $s = 7; continue; }
/* */ $s = 8; continue;
/* if (!(l.cacheZone === ptrType.nil) && (x = l.cacheStart, (x.$high < sec.$high || (x.$high === sec.$high && x.$low <= sec.$low))) && (x$1 = l.cacheEnd, (sec.$high < x$1.$high || (sec.$high === x$1.$high && sec.$low < x$1.$low)))) { */ case 7:
name = l.cacheZone.name;
offset = l.cacheZone.offset;
$s = 9; continue;
/* } else { */ case 8:
_r$1 = l.lookup(sec); /* */ $s = 10; case 10: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple = _r$1;
name = _tuple[0];
offset = _tuple[1];
/* } */ case 9:
sec = (x$2 = (new $Int64(0, offset)), new $Int64(sec.$high + x$2.$high, sec.$low + x$2.$low));
$s = 6; continue;
/* } else { */ case 5:
name = "UTC";
/* } */ case 6:
abs = ((x$3 = new $Int64(sec.$high + 2147483646, sec.$low + 450480384), new $Uint64(x$3.$high, x$3.$low)));
$s = -1; return [name, offset, abs];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.locabs }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.abs = abs; $f.l = l; $f.name = name; $f.offset = offset; $f.sec = sec; $f.t = t; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.locabs = function() { return this.$val.locabs(); };
Time.ptr.prototype.Date = function() {
var _r, _tuple, day, month, t, year, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; day = $f.day; month = $f.month; t = $f.t; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
year = 0;
month = 0;
day = 0;
t = this;
_r = $clone(t, Time).date(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
year = _tuple[0];
month = _tuple[1];
day = _tuple[2];
$s = -1; return [year, month, day];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Date }; } $f._r = _r; $f._tuple = _tuple; $f.day = day; $f.month = month; $f.t = t; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Date = function() { return this.$val.Date(); };
Time.ptr.prototype.Year = function() {
var _r, _tuple, t, year, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; t = $f.t; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).date(false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
year = _tuple[0];
$s = -1; return year;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Year }; } $f._r = _r; $f._tuple = _tuple; $f.t = t; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Year = function() { return this.$val.Year(); };
Time.ptr.prototype.Month = function() {
var _r, _tuple, month, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; month = $f.month; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).date(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
month = _tuple[1];
$s = -1; return month;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Month }; } $f._r = _r; $f._tuple = _tuple; $f.month = month; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Month = function() { return this.$val.Month(); };
Time.ptr.prototype.Day = function() {
var _r, _tuple, day, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; day = $f.day; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).date(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
day = _tuple[2];
$s = -1; return day;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Day }; } $f._r = _r; $f._tuple = _tuple; $f.day = day; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Day = function() { return this.$val.Day(); };
Time.ptr.prototype.Weekday = function() {
var _r, _r$1, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = absWeekday(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Weekday }; } $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Weekday = function() { return this.$val.Weekday(); };
absWeekday = function(abs) {
var _q, abs, sec;
sec = $div64((new $Uint64(abs.$high + 0, abs.$low + 86400)), new $Uint64(0, 604800), true);
return (((_q = ((sec.$low >> 0)) / 86400, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0));
};
Time.ptr.prototype.ISOWeek = function() {
var _q, _r, _r$1, _r$2, _r$3, _r$4, _tuple, day, dec31wday, jan1wday, month, t, wday, week, yday, year, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _tuple = $f._tuple; day = $f.day; dec31wday = $f.dec31wday; jan1wday = $f.jan1wday; month = $f.month; t = $f.t; wday = $f.wday; week = $f.week; yday = $f.yday; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
year = 0;
week = 0;
t = this;
_r = $clone(t, Time).date(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
year = _tuple[0];
month = _tuple[1];
day = _tuple[2];
yday = _tuple[3];
_r$2 = $clone(t, Time).Weekday(); /* */ $s = 2; case 2: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
wday = (_r$1 = (((_r$2 + 6 >> 0) >> 0)) % 7, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero"));
week = (_q = (((yday - wday >> 0) + 7 >> 0)) / 7, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
jan1wday = (_r$3 = (((wday - yday >> 0) + 371 >> 0)) % 7, _r$3 === _r$3 ? _r$3 : $throwRuntimeError("integer divide by zero"));
if (1 <= jan1wday && jan1wday <= 3) {
week = week + (1) >> 0;
}
if (week === 0) {
year = year - (1) >> 0;
week = 52;
if ((jan1wday === 4) || ((jan1wday === 5) && isLeap(year))) {
week = week + (1) >> 0;
}
}
if ((month === 12) && day >= 29 && wday < 3) {
dec31wday = (_r$4 = (((wday + 31 >> 0) - day >> 0)) % 7, _r$4 === _r$4 ? _r$4 : $throwRuntimeError("integer divide by zero"));
if (0 <= dec31wday && dec31wday <= 2) {
year = year + (1) >> 0;
week = 1;
}
}
$s = -1; return [year, week];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.ISOWeek }; } $f._q = _q; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._tuple = _tuple; $f.day = day; $f.dec31wday = dec31wday; $f.jan1wday = jan1wday; $f.month = month; $f.t = t; $f.wday = wday; $f.week = week; $f.yday = yday; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.ISOWeek = function() { return this.$val.ISOWeek(); };
Time.ptr.prototype.Clock = function() {
var _r, _r$1, _tuple, hour, min, sec, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; hour = $f.hour; min = $f.min; sec = $f.sec; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
hour = 0;
min = 0;
sec = 0;
t = this;
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = absClock(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple = _r$1;
hour = _tuple[0];
min = _tuple[1];
sec = _tuple[2];
$s = -1; return [hour, min, sec];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Clock }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.hour = hour; $f.min = min; $f.sec = sec; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Clock = function() { return this.$val.Clock(); };
absClock = function(abs) {
var _q, _q$1, abs, hour, min, sec;
hour = 0;
min = 0;
sec = 0;
sec = (($div64(abs, new $Uint64(0, 86400), true).$low >> 0));
hour = (_q = sec / 3600, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
sec = sec - (($imul(hour, 3600))) >> 0;
min = (_q$1 = sec / 60, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero"));
sec = sec - (($imul(min, 60))) >> 0;
return [hour, min, sec];
};
Time.ptr.prototype.Hour = function() {
var _q, _r, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return (_q = (($div64(_r, new $Uint64(0, 86400), true).$low >> 0)) / 3600, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Hour }; } $f._q = _q; $f._r = _r; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Hour = function() { return this.$val.Hour(); };
Time.ptr.prototype.Minute = function() {
var _q, _r, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return (_q = (($div64(_r, new $Uint64(0, 3600), true).$low >> 0)) / 60, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Minute }; } $f._q = _q; $f._r = _r; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Minute = function() { return this.$val.Minute(); };
Time.ptr.prototype.Second = function() {
var _r, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return (($div64(_r, new $Uint64(0, 60), true).$low >> 0));
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Second }; } $f._r = _r; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Second = function() { return this.$val.Second(); };
Time.ptr.prototype.Nanosecond = function() {
var t;
t = this;
return ((t.nsec() >> 0));
};
Time.prototype.Nanosecond = function() { return this.$val.Nanosecond(); };
Time.ptr.prototype.YearDay = function() {
var _r, _tuple, t, yday, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; t = $f.t; yday = $f.yday; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).date(false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
yday = _tuple[3];
$s = -1; return yday + 1 >> 0;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.YearDay }; } $f._r = _r; $f._tuple = _tuple; $f.t = t; $f.yday = yday; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.YearDay = function() { return this.$val.YearDay(); };
Duration.prototype.String = function() {
var _tuple, _tuple$1, buf, d, neg, prec, u, w;
d = this;
buf = arrayType$4.zero();
w = 32;
u = (new $Uint64(d.$high, d.$low));
neg = (d.$high < 0 || (d.$high === 0 && d.$low < 0));
if (neg) {
u = new $Uint64(-u.$high, -u.$low);
}
if ((u.$high < 0 || (u.$high === 0 && u.$low < 1000000000))) {
prec = 0;
w = w - (1) >> 0;
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 115);
w = w - (1) >> 0;
if ((u.$high === 0 && u.$low === 0)) {
return "0s";
} else if ((u.$high < 0 || (u.$high === 0 && u.$low < 1000))) {
prec = 0;
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 110);
} else if ((u.$high < 0 || (u.$high === 0 && u.$low < 1000000))) {
prec = 3;
w = w - (1) >> 0;
$copyString($subslice(new sliceType$3(buf), w), "\xC2\xB5");
} else {
prec = 6;
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 109);
}
_tuple = fmtFrac($subslice(new sliceType$3(buf), 0, w), u, prec);
w = _tuple[0];
u = _tuple[1];
w = fmtInt($subslice(new sliceType$3(buf), 0, w), u);
} else {
w = w - (1) >> 0;
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 115);
_tuple$1 = fmtFrac($subslice(new sliceType$3(buf), 0, w), u, 9);
w = _tuple$1[0];
u = _tuple$1[1];
w = fmtInt($subslice(new sliceType$3(buf), 0, w), $div64(u, new $Uint64(0, 60), true));
u = $div64(u, (new $Uint64(0, 60)), false);
if ((u.$high > 0 || (u.$high === 0 && u.$low > 0))) {
w = w - (1) >> 0;
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 109);
w = fmtInt($subslice(new sliceType$3(buf), 0, w), $div64(u, new $Uint64(0, 60), true));
u = $div64(u, (new $Uint64(0, 60)), false);
if ((u.$high > 0 || (u.$high === 0 && u.$low > 0))) {
w = w - (1) >> 0;
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 104);
w = fmtInt($subslice(new sliceType$3(buf), 0, w), u);
}
}
}
if (neg) {
w = w - (1) >> 0;
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 45);
}
return ($bytesToString($subslice(new sliceType$3(buf), w)));
};
$ptrType(Duration).prototype.String = function() { return this.$get().String(); };
fmtFrac = function(buf, v, prec) {
var _tmp, _tmp$1, buf, digit, i, nv, nw, prec, print, v, w;
nw = 0;
nv = new $Uint64(0, 0);
w = buf.$length;
print = false;
i = 0;
while (true) {
if (!(i < prec)) { break; }
digit = $div64(v, new $Uint64(0, 10), true);
print = print || !((digit.$high === 0 && digit.$low === 0));
if (print) {
w = w - (1) >> 0;
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = (((digit.$low << 24 >>> 24)) + 48 << 24 >>> 24));
}
v = $div64(v, (new $Uint64(0, 10)), false);
i = i + (1) >> 0;
}
if (print) {
w = w - (1) >> 0;
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = 46);
}
_tmp = w;
_tmp$1 = v;
nw = _tmp;
nv = _tmp$1;
return [nw, nv];
};
fmtInt = function(buf, v) {
var buf, v, w;
w = buf.$length;
if ((v.$high === 0 && v.$low === 0)) {
w = w - (1) >> 0;
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = 48);
} else {
while (true) {
if (!((v.$high > 0 || (v.$high === 0 && v.$low > 0)))) { break; }
w = w - (1) >> 0;
((w < 0 || w >= buf.$length) ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + w] = ((($div64(v, new $Uint64(0, 10), true).$low << 24 >>> 24)) + 48 << 24 >>> 24));
v = $div64(v, (new $Uint64(0, 10)), false);
}
}
return w;
};
Duration.prototype.Nanoseconds = function() {
var d;
d = this;
return (new $Int64(d.$high, d.$low));
};
$ptrType(Duration).prototype.Nanoseconds = function() { return this.$get().Nanoseconds(); };
Duration.prototype.Seconds = function() {
var d, nsec, sec;
d = this;
sec = $div64(d, new Duration(0, 1000000000), false);
nsec = $div64(d, new Duration(0, 1000000000), true);
return ($flatten64(sec)) + ($flatten64(nsec)) / 1e+09;
};
$ptrType(Duration).prototype.Seconds = function() { return this.$get().Seconds(); };
Duration.prototype.Minutes = function() {
var d, min, nsec;
d = this;
min = $div64(d, new Duration(13, 4165425152), false);
nsec = $div64(d, new Duration(13, 4165425152), true);
return ($flatten64(min)) + ($flatten64(nsec)) / 6e+10;
};
$ptrType(Duration).prototype.Minutes = function() { return this.$get().Minutes(); };
Duration.prototype.Hours = function() {
var d, hour, nsec;
d = this;
hour = $div64(d, new Duration(838, 817405952), false);
nsec = $div64(d, new Duration(838, 817405952), true);
return ($flatten64(hour)) + ($flatten64(nsec)) / 3.6e+12;
};
$ptrType(Duration).prototype.Hours = function() { return this.$get().Hours(); };
Duration.prototype.Truncate = function(m) {
var d, m, x;
d = this;
if ((m.$high < 0 || (m.$high === 0 && m.$low <= 0))) {
return d;
}
return (x = $div64(d, m, true), new Duration(d.$high - x.$high, d.$low - x.$low));
};
$ptrType(Duration).prototype.Truncate = function(m) { return this.$get().Truncate(m); };
lessThanHalf = function(x, y) {
var x, x$1, x$2, x$3, x$4, y;
return (x$1 = (x$2 = (new $Uint64(x.$high, x.$low)), x$3 = (new $Uint64(x.$high, x.$low)), new $Uint64(x$2.$high + x$3.$high, x$2.$low + x$3.$low)), x$4 = (new $Uint64(y.$high, y.$low)), (x$1.$high < x$4.$high || (x$1.$high === x$4.$high && x$1.$low < x$4.$low)));
};
Duration.prototype.Round = function(m) {
var d, d1, d1$1, m, r, x, x$1;
d = this;
if ((m.$high < 0 || (m.$high === 0 && m.$low <= 0))) {
return d;
}
r = $div64(d, m, true);
if ((d.$high < 0 || (d.$high === 0 && d.$low < 0))) {
r = new Duration(-r.$high, -r.$low);
if (lessThanHalf(r, m)) {
return new Duration(d.$high + r.$high, d.$low + r.$low);
}
d1 = (x = new Duration(d.$high - m.$high, d.$low - m.$low), new Duration(x.$high + r.$high, x.$low + r.$low));
if ((d1.$high < d.$high || (d1.$high === d.$high && d1.$low < d.$low))) {
return d1;
}
return new Duration(-2147483648, 0);
}
if (lessThanHalf(r, m)) {
return new Duration(d.$high - r.$high, d.$low - r.$low);
}
d1$1 = (x$1 = new Duration(d.$high + m.$high, d.$low + m.$low), new Duration(x$1.$high - r.$high, x$1.$low - r.$low));
if ((d1$1.$high > d.$high || (d1$1.$high === d.$high && d1$1.$low > d.$low))) {
return d1$1;
}
return new Duration(2147483647, 4294967295);
};
$ptrType(Duration).prototype.Round = function(m) { return this.$get().Round(m); };
Time.ptr.prototype.Add = function(d) {
var d, dsec, nsec, t, te, x, x$1, x$10, x$11, x$12, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
t = this;
dsec = ((x = $div64(d, new Duration(0, 1000000000), false), new $Int64(x.$high, x.$low)));
nsec = t.nsec() + (((x$1 = $div64(d, new Duration(0, 1000000000), true), x$1.$low + ((x$1.$high >> 31) * 4294967296)) >> 0)) >> 0;
if (nsec >= 1000000000) {
dsec = (x$2 = new $Int64(0, 1), new $Int64(dsec.$high + x$2.$high, dsec.$low + x$2.$low));
nsec = nsec - (1000000000) >> 0;
} else if (nsec < 0) {
dsec = (x$3 = new $Int64(0, 1), new $Int64(dsec.$high - x$3.$high, dsec.$low - x$3.$low));
nsec = nsec + (1000000000) >> 0;
}
t.wall = (x$4 = (x$5 = t.wall, new $Uint64(x$5.$high & ~0, (x$5.$low & ~1073741823) >>> 0)), x$6 = (new $Uint64(0, nsec)), new $Uint64(x$4.$high | x$6.$high, (x$4.$low | x$6.$low) >>> 0));
t.addSec(dsec);
if (!((x$7 = (x$8 = t.wall, new $Uint64(x$8.$high & 2147483648, (x$8.$low & 0) >>> 0)), (x$7.$high === 0 && x$7.$low === 0)))) {
te = (x$9 = t.ext, x$10 = (new $Int64(d.$high, d.$low)), new $Int64(x$9.$high + x$10.$high, x$9.$low + x$10.$low));
if ((d.$high < 0 || (d.$high === 0 && d.$low < 0)) && (x$11 = (t.ext), (te.$high > x$11.$high || (te.$high === x$11.$high && te.$low > x$11.$low))) || (d.$high > 0 || (d.$high === 0 && d.$low > 0)) && (x$12 = (t.ext), (te.$high < x$12.$high || (te.$high === x$12.$high && te.$low < x$12.$low)))) {
t.stripMono();
} else {
t.ext = te;
}
}
return t;
};
Time.prototype.Add = function(d) { return this.$val.Add(d); };
Time.ptr.prototype.Sub = function(u) {
var d, d$1, t, te, u, ue, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
t = this;
if (!((x = (x$1 = (x$2 = t.wall, x$3 = u.wall, new $Uint64(x$2.$high & x$3.$high, (x$2.$low & x$3.$low) >>> 0)), new $Uint64(x$1.$high & 2147483648, (x$1.$low & 0) >>> 0)), (x.$high === 0 && x.$low === 0)))) {
te = (t.ext);
ue = (u.ext);
d = ((x$4 = new $Int64(te.$high - ue.$high, te.$low - ue.$low), new Duration(x$4.$high, x$4.$low)));
if ((d.$high < 0 || (d.$high === 0 && d.$low < 0)) && (te.$high > ue.$high || (te.$high === ue.$high && te.$low > ue.$low))) {
return new Duration(2147483647, 4294967295);
}
if ((d.$high > 0 || (d.$high === 0 && d.$low > 0)) && (te.$high < ue.$high || (te.$high === ue.$high && te.$low < ue.$low))) {
return new Duration(-2147483648, 0);
}
return d;
}
d$1 = (x$5 = $mul64(((x$6 = (x$7 = t.sec(), x$8 = u.sec(), new $Int64(x$7.$high - x$8.$high, x$7.$low - x$8.$low)), new Duration(x$6.$high, x$6.$low))), new Duration(0, 1000000000)), x$9 = (new Duration(0, (t.nsec() - u.nsec() >> 0))), new Duration(x$5.$high + x$9.$high, x$5.$low + x$9.$low));
if ($clone($clone(u, Time).Add(d$1), Time).Equal($clone(t, Time))) {
return d$1;
} else if ($clone(t, Time).Before($clone(u, Time))) {
return new Duration(-2147483648, 0);
} else {
return new Duration(2147483647, 4294967295);
}
};
Time.prototype.Sub = function(u) { return this.$val.Sub(u); };
Time.ptr.prototype.AddDate = function(years, months$1, days$1) {
var _r, _r$1, _r$2, _tuple, _tuple$1, day, days$1, hour, min, month, months$1, sec, t, year, years, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; day = $f.day; days$1 = $f.days$1; hour = $f.hour; min = $f.min; month = $f.month; months$1 = $f.months$1; sec = $f.sec; t = $f.t; year = $f.year; years = $f.years; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).Date(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
year = _tuple[0];
month = _tuple[1];
day = _tuple[2];
_r$1 = $clone(t, Time).Clock(); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple$1 = _r$1;
hour = _tuple$1[0];
min = _tuple$1[1];
sec = _tuple$1[2];
_r$2 = Date(year + years >> 0, month + ((months$1 >> 0)) >> 0, day + days$1 >> 0, hour, min, sec, ((t.nsec() >> 0)), $clone(t, Time).Location()); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
$s = -1; return _r$2;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.AddDate }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.day = day; $f.days$1 = days$1; $f.hour = hour; $f.min = min; $f.month = month; $f.months$1 = months$1; $f.sec = sec; $f.t = t; $f.year = year; $f.years = years; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.AddDate = function(years, months$1, days$1) { return this.$val.AddDate(years, months$1, days$1); };
Time.ptr.prototype.date = function(full) {
var _r, _r$1, _tuple, day, full, month, t, yday, year, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; day = $f.day; full = $f.full; month = $f.month; t = $f.t; yday = $f.yday; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
year = 0;
month = 0;
day = 0;
yday = 0;
t = this;
_r = $clone(t, Time).abs(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = absDate(_r, full); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple = _r$1;
year = _tuple[0];
month = _tuple[1];
day = _tuple[2];
yday = _tuple[3];
$s = -1; return [year, month, day, yday];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.date }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.day = day; $f.full = full; $f.month = month; $f.t = t; $f.yday = yday; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.date = function(full) { return this.$val.date(full); };
absDate = function(abs, full) {
var _q, abs, begin, d, day, end, full, month, n, x, x$1, x$10, x$11, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, y, yday, year;
year = 0;
month = 0;
day = 0;
yday = 0;
d = $div64(abs, new $Uint64(0, 86400), false);
n = $div64(d, new $Uint64(0, 146097), false);
y = $mul64(new $Uint64(0, 400), n);
d = (x = $mul64(new $Uint64(0, 146097), n), new $Uint64(d.$high - x.$high, d.$low - x.$low));
n = $div64(d, new $Uint64(0, 36524), false);
n = (x$1 = $shiftRightUint64(n, 2), new $Uint64(n.$high - x$1.$high, n.$low - x$1.$low));
y = (x$2 = $mul64(new $Uint64(0, 100), n), new $Uint64(y.$high + x$2.$high, y.$low + x$2.$low));
d = (x$3 = $mul64(new $Uint64(0, 36524), n), new $Uint64(d.$high - x$3.$high, d.$low - x$3.$low));
n = $div64(d, new $Uint64(0, 1461), false);
y = (x$4 = $mul64(new $Uint64(0, 4), n), new $Uint64(y.$high + x$4.$high, y.$low + x$4.$low));
d = (x$5 = $mul64(new $Uint64(0, 1461), n), new $Uint64(d.$high - x$5.$high, d.$low - x$5.$low));
n = $div64(d, new $Uint64(0, 365), false);
n = (x$6 = $shiftRightUint64(n, 2), new $Uint64(n.$high - x$6.$high, n.$low - x$6.$low));
y = (x$7 = n, new $Uint64(y.$high + x$7.$high, y.$low + x$7.$low));
d = (x$8 = $mul64(new $Uint64(0, 365), n), new $Uint64(d.$high - x$8.$high, d.$low - x$8.$low));
year = (((x$9 = (x$10 = (new $Int64(y.$high, y.$low)), new $Int64(x$10.$high + -69, x$10.$low + 4075721025)), x$9.$low + ((x$9.$high >> 31) * 4294967296)) >> 0));
yday = ((d.$low >> 0));
if (!full) {
return [year, month, day, yday];
}
day = yday;
if (isLeap(year)) {
if (day > 59) {
day = day - (1) >> 0;
} else if ((day === 59)) {
month = 2;
day = 29;
return [year, month, day, yday];
}
}
month = (((_q = day / 31, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0));
end = (((x$11 = month + 1 >> 0, ((x$11 < 0 || x$11 >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[x$11])) >> 0));
begin = 0;
if (day >= end) {
month = month + (1) >> 0;
begin = end;
} else {
begin = ((((month < 0 || month >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[month]) >> 0));
}
month = month + (1) >> 0;
day = (day - begin >> 0) + 1 >> 0;
return [year, month, day, yday];
};
daysIn = function(m, year) {
var m, x, year;
if ((m === 2) && isLeap(year)) {
return 29;
}
return (((((m < 0 || m >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[m]) - (x = m - 1 >> 0, ((x < 0 || x >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[x])) >> 0) >> 0));
};
unixTime = function(sec, nsec) {
var nsec, sec;
return new Time.ptr((new $Uint64(0, nsec)), new $Int64(sec.$high + 14, sec.$low + 2006054656), $pkg.Local);
};
Time.ptr.prototype.UTC = function() {
var t;
t = this;
t.setLoc(utcLoc);
return t;
};
Time.prototype.UTC = function() { return this.$val.UTC(); };
Time.ptr.prototype.Local = function() {
var t;
t = this;
t.setLoc($pkg.Local);
return t;
};
Time.prototype.Local = function() { return this.$val.Local(); };
Time.ptr.prototype.In = function(loc) {
var loc, t;
t = this;
if (loc === ptrType$2.nil) {
$panic(new $String("time: missing Location in call to Time.In"));
}
t.setLoc(loc);
return t;
};
Time.prototype.In = function(loc) { return this.$val.In(loc); };
Time.ptr.prototype.Location = function() {
var l, t;
t = this;
l = t.loc;
if (l === ptrType$2.nil) {
l = $pkg.UTC;
}
return l;
};
Time.prototype.Location = function() { return this.$val.Location(); };
Time.ptr.prototype.Zone = function() {
var _r, _tuple, name, offset, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; name = $f.name; offset = $f.offset; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
name = "";
offset = 0;
t = this;
_r = t.loc.lookup(t.unixSec()); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
name = _tuple[0];
offset = _tuple[1];
$s = -1; return [name, offset];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.Zone }; } $f._r = _r; $f._tuple = _tuple; $f.name = name; $f.offset = offset; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.Zone = function() { return this.$val.Zone(); };
Time.ptr.prototype.Unix = function() {
var t;
t = this;
return t.unixSec();
};
Time.prototype.Unix = function() { return this.$val.Unix(); };
Time.ptr.prototype.UnixNano = function() {
var t, x, x$1;
t = this;
return (x = $mul64((t.unixSec()), new $Int64(0, 1000000000)), x$1 = (new $Int64(0, t.nsec())), new $Int64(x.$high + x$1.$high, x.$low + x$1.$low));
};
Time.prototype.UnixNano = function() { return this.$val.UnixNano(); };
Time.ptr.prototype.MarshalBinary = function() {
var _q, _r, _r$1, _tuple, enc, nsec, offset, offsetMin, sec, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; enc = $f.enc; nsec = $f.nsec; offset = $f.offset; offsetMin = $f.offsetMin; sec = $f.sec; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
offsetMin = 0;
/* */ if ($clone(t, Time).Location() === $pkg.UTC) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if ($clone(t, Time).Location() === $pkg.UTC) { */ case 1:
offsetMin = -1;
$s = 3; continue;
/* } else { */ case 2:
_r = $clone(t, Time).Zone(); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
offset = _tuple[1];
if (!(((_r$1 = offset % 60, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) === 0))) {
$s = -1; return [sliceType$3.nil, errors.New("Time.MarshalBinary: zone offset has fractional minute")];
}
offset = (_q = offset / (60), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
if (offset < -32768 || (offset === -1) || offset > 32767) {
$s = -1; return [sliceType$3.nil, errors.New("Time.MarshalBinary: unexpected zone offset")];
}
offsetMin = ((offset << 16 >> 16));
/* } */ case 3:
sec = t.sec();
nsec = t.nsec();
enc = new sliceType$3([1, (($shiftRightInt64(sec, 56).$low << 24 >>> 24)), (($shiftRightInt64(sec, 48).$low << 24 >>> 24)), (($shiftRightInt64(sec, 40).$low << 24 >>> 24)), (($shiftRightInt64(sec, 32).$low << 24 >>> 24)), (($shiftRightInt64(sec, 24).$low << 24 >>> 24)), (($shiftRightInt64(sec, 16).$low << 24 >>> 24)), (($shiftRightInt64(sec, 8).$low << 24 >>> 24)), ((sec.$low << 24 >>> 24)), (((nsec >> 24 >> 0) << 24 >>> 24)), (((nsec >> 16 >> 0) << 24 >>> 24)), (((nsec >> 8 >> 0) << 24 >>> 24)), ((nsec << 24 >>> 24)), (((offsetMin >> 8 << 16 >> 16) << 24 >>> 24)), ((offsetMin << 24 >>> 24))]);
$s = -1; return [enc, $ifaceNil];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.MarshalBinary }; } $f._q = _q; $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.enc = enc; $f.nsec = nsec; $f.offset = offset; $f.offsetMin = offsetMin; $f.sec = sec; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.MarshalBinary = function() { return this.$val.MarshalBinary(); };
Time.ptr.prototype.UnmarshalBinary = function(data$1) {
var _r, _tuple, buf, data$1, localoff, nsec, offset, sec, t, x, x$1, x$10, x$11, x$12, x$13, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; buf = $f.buf; data$1 = $f.data$1; localoff = $f.localoff; nsec = $f.nsec; offset = $f.offset; sec = $f.sec; t = $f.t; x = $f.x; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$13 = $f.x$13; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
buf = data$1;
if (buf.$length === 0) {
$s = -1; return errors.New("Time.UnmarshalBinary: no data");
}
if (!(((0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]) === 1))) {
$s = -1; return errors.New("Time.UnmarshalBinary: unsupported version");
}
if (!((buf.$length === 15))) {
$s = -1; return errors.New("Time.UnmarshalBinary: invalid length");
}
buf = $subslice(buf, 1);
sec = (x = (x$1 = (x$2 = (x$3 = (x$4 = (x$5 = (x$6 = (new $Int64(0, (7 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 7]))), x$7 = $shiftLeft64((new $Int64(0, (6 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 6]))), 8), new $Int64(x$6.$high | x$7.$high, (x$6.$low | x$7.$low) >>> 0)), x$8 = $shiftLeft64((new $Int64(0, (5 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 5]))), 16), new $Int64(x$5.$high | x$8.$high, (x$5.$low | x$8.$low) >>> 0)), x$9 = $shiftLeft64((new $Int64(0, (4 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 4]))), 24), new $Int64(x$4.$high | x$9.$high, (x$4.$low | x$9.$low) >>> 0)), x$10 = $shiftLeft64((new $Int64(0, (3 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 3]))), 32), new $Int64(x$3.$high | x$10.$high, (x$3.$low | x$10.$low) >>> 0)), x$11 = $shiftLeft64((new $Int64(0, (2 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 2]))), 40), new $Int64(x$2.$high | x$11.$high, (x$2.$low | x$11.$low) >>> 0)), x$12 = $shiftLeft64((new $Int64(0, (1 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 1]))), 48), new $Int64(x$1.$high | x$12.$high, (x$1.$low | x$12.$low) >>> 0)), x$13 = $shiftLeft64((new $Int64(0, (0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]))), 56), new $Int64(x.$high | x$13.$high, (x.$low | x$13.$low) >>> 0));
buf = $subslice(buf, 8);
nsec = (((((3 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 3]) >> 0)) | ((((2 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 2]) >> 0)) << 8 >> 0)) | ((((1 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 1]) >> 0)) << 16 >> 0)) | ((((0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]) >> 0)) << 24 >> 0);
buf = $subslice(buf, 4);
offset = $imul(((((((1 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 1]) << 16 >> 16)) | ((((0 >= buf.$length ? ($throwRuntimeError("index out of range"), undefined) : buf.$array[buf.$offset + 0]) << 16 >> 16)) << 8 << 16 >> 16)) >> 0)), 60);
Time.copy(t, new Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$2.nil));
t.wall = (new $Uint64(0, nsec));
t.ext = sec;
/* */ if (offset === -60) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (offset === -60) { */ case 1:
t.setLoc(utcLoc);
$s = 3; continue;
/* } else { */ case 2:
_r = $pkg.Local.lookup(t.unixSec()); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
localoff = _tuple[1];
if (offset === localoff) {
t.setLoc($pkg.Local);
} else {
t.setLoc(FixedZone("", offset));
}
/* } */ case 3:
$s = -1; return $ifaceNil;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.UnmarshalBinary }; } $f._r = _r; $f._tuple = _tuple; $f.buf = buf; $f.data$1 = data$1; $f.localoff = localoff; $f.nsec = nsec; $f.offset = offset; $f.sec = sec; $f.t = t; $f.x = x; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$13 = x$13; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.UnmarshalBinary = function(data$1) { return this.$val.UnmarshalBinary(data$1); };
Time.ptr.prototype.GobEncode = function() {
var _r, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).MarshalBinary(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.GobEncode }; } $f._r = _r; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.GobEncode = function() { return this.$val.GobEncode(); };
Time.ptr.prototype.GobDecode = function(data$1) {
var _r, data$1, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; data$1 = $f.data$1; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = t.UnmarshalBinary(data$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.GobDecode }; } $f._r = _r; $f.data$1 = data$1; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.GobDecode = function(data$1) { return this.$val.GobDecode(data$1); };
Time.ptr.prototype.MarshalJSON = function() {
var _r, _r$1, b, t, y, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; b = $f.b; t = $f.t; y = $f.y; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).Year(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
y = _r;
if (y < 0 || y >= 10000) {
$s = -1; return [sliceType$3.nil, errors.New("Time.MarshalJSON: year outside of range [0,9999]")];
}
b = $makeSlice(sliceType$3, 0, 37);
b = $append(b, 34);
_r$1 = $clone(t, Time).AppendFormat(b, "2006-01-02T15:04:05.999999999Z07:00"); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
b = _r$1;
b = $append(b, 34);
$s = -1; return [b, $ifaceNil];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.MarshalJSON }; } $f._r = _r; $f._r$1 = _r$1; $f.b = b; $f.t = t; $f.y = y; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.MarshalJSON = function() { return this.$val.MarshalJSON(); };
Time.ptr.prototype.UnmarshalJSON = function(data$1) {
var _r, _tuple, data$1, err, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; data$1 = $f.data$1; err = $f.err; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
if (($bytesToString(data$1)) === "null") {
$s = -1; return $ifaceNil;
}
err = $ifaceNil;
_r = Parse("\"2006-01-02T15:04:05Z07:00\"", ($bytesToString(data$1))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
Time.copy(t, _tuple[0]);
err = _tuple[1];
$s = -1; return err;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.UnmarshalJSON }; } $f._r = _r; $f._tuple = _tuple; $f.data$1 = data$1; $f.err = err; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.UnmarshalJSON = function(data$1) { return this.$val.UnmarshalJSON(data$1); };
Time.ptr.prototype.MarshalText = function() {
var _r, _r$1, b, t, y, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; b = $f.b; t = $f.t; y = $f.y; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = $clone(t, Time).Year(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
y = _r;
if (y < 0 || y >= 10000) {
$s = -1; return [sliceType$3.nil, errors.New("Time.MarshalText: year outside of range [0,9999]")];
}
b = $makeSlice(sliceType$3, 0, 35);
_r$1 = $clone(t, Time).AppendFormat(b, "2006-01-02T15:04:05.999999999Z07:00"); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return [_r$1, $ifaceNil];
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.MarshalText }; } $f._r = _r; $f._r$1 = _r$1; $f.b = b; $f.t = t; $f.y = y; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.MarshalText = function() { return this.$val.MarshalText(); };
Time.ptr.prototype.UnmarshalText = function(data$1) {
var _r, _tuple, data$1, err, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; data$1 = $f.data$1; err = $f.err; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
err = $ifaceNil;
_r = Parse("2006-01-02T15:04:05Z07:00", ($bytesToString(data$1))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
Time.copy(t, _tuple[0]);
err = _tuple[1];
$s = -1; return err;
/* */ } return; } if ($f === undefined) { $f = { $blk: Time.ptr.prototype.UnmarshalText }; } $f._r = _r; $f._tuple = _tuple; $f.data$1 = data$1; $f.err = err; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
Time.prototype.UnmarshalText = function(data$1) { return this.$val.UnmarshalText(data$1); };
Unix = function(sec, nsec) {
var n, nsec, sec, x, x$1, x$2, x$3;
if ((nsec.$high < 0 || (nsec.$high === 0 && nsec.$low < 0)) || (nsec.$high > 0 || (nsec.$high === 0 && nsec.$low >= 1000000000))) {
n = $div64(nsec, new $Int64(0, 1000000000), false);
sec = (x = n, new $Int64(sec.$high + x.$high, sec.$low + x.$low));
nsec = (x$1 = $mul64(n, new $Int64(0, 1000000000)), new $Int64(nsec.$high - x$1.$high, nsec.$low - x$1.$low));
if ((nsec.$high < 0 || (nsec.$high === 0 && nsec.$low < 0))) {
nsec = (x$2 = new $Int64(0, 1000000000), new $Int64(nsec.$high + x$2.$high, nsec.$low + x$2.$low));
sec = (x$3 = new $Int64(0, 1), new $Int64(sec.$high - x$3.$high, sec.$low - x$3.$low));
}
}
return unixTime(sec, (((nsec.$low + ((nsec.$high >> 31) * 4294967296)) >> 0)));
};
$pkg.Unix = Unix;
isLeap = function(year) {
var _r, _r$1, _r$2, year;
return ((_r = year % 4, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) === 0) && (!(((_r$1 = year % 100, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) === 0)) || ((_r$2 = year % 400, _r$2 === _r$2 ? _r$2 : $throwRuntimeError("integer divide by zero")) === 0));
};
norm = function(hi, lo, base) {
var _q, _q$1, _tmp, _tmp$1, base, hi, lo, n, n$1, nhi, nlo;
nhi = 0;
nlo = 0;
if (lo < 0) {
n = (_q = ((-lo - 1 >> 0)) / base, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) + 1 >> 0;
hi = hi - (n) >> 0;
lo = lo + (($imul(n, base))) >> 0;
}
if (lo >= base) {
n$1 = (_q$1 = lo / base, (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >> 0 : $throwRuntimeError("integer divide by zero"));
hi = hi + (n$1) >> 0;
lo = lo - (($imul(n$1, base))) >> 0;
}
_tmp = hi;
_tmp$1 = lo;
nhi = _tmp;
nlo = _tmp$1;
return [nhi, nlo];
};
Date = function(year, month, day, hour, min, sec, nsec, loc) {
var _r, _r$1, _r$2, _tuple, _tuple$1, _tuple$2, _tuple$3, _tuple$4, _tuple$5, _tuple$6, _tuple$7, abs, d, day, end, hour, loc, m, min, month, n, nsec, offset, sec, start, t, unix, utc, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, y, year, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; _tuple$3 = $f._tuple$3; _tuple$4 = $f._tuple$4; _tuple$5 = $f._tuple$5; _tuple$6 = $f._tuple$6; _tuple$7 = $f._tuple$7; abs = $f.abs; d = $f.d; day = $f.day; end = $f.end; hour = $f.hour; loc = $f.loc; m = $f.m; min = $f.min; month = $f.month; n = $f.n; nsec = $f.nsec; offset = $f.offset; sec = $f.sec; start = $f.start; t = $f.t; unix = $f.unix; utc = $f.utc; x = $f.x; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$13 = $f.x$13; x$14 = $f.x$14; x$15 = $f.x$15; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; y = $f.y; year = $f.year; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
if (loc === ptrType$2.nil) {
$panic(new $String("time: missing Location in call to Date"));
}
m = ((month >> 0)) - 1 >> 0;
_tuple = norm(year, m, 12);
year = _tuple[0];
m = _tuple[1];
month = ((m >> 0)) + 1 >> 0;
_tuple$1 = norm(sec, nsec, 1000000000);
sec = _tuple$1[0];
nsec = _tuple$1[1];
_tuple$2 = norm(min, sec, 60);
min = _tuple$2[0];
sec = _tuple$2[1];
_tuple$3 = norm(hour, min, 60);
hour = _tuple$3[0];
min = _tuple$3[1];
_tuple$4 = norm(day, hour, 24);
day = _tuple$4[0];
hour = _tuple$4[1];
y = ((x = (x$1 = (new $Int64(0, year)), new $Int64(x$1.$high - -69, x$1.$low - 4075721025)), new $Uint64(x.$high, x.$low)));
n = $div64(y, new $Uint64(0, 400), false);
y = (x$2 = $mul64(new $Uint64(0, 400), n), new $Uint64(y.$high - x$2.$high, y.$low - x$2.$low));
d = $mul64(new $Uint64(0, 146097), n);
n = $div64(y, new $Uint64(0, 100), false);
y = (x$3 = $mul64(new $Uint64(0, 100), n), new $Uint64(y.$high - x$3.$high, y.$low - x$3.$low));
d = (x$4 = $mul64(new $Uint64(0, 36524), n), new $Uint64(d.$high + x$4.$high, d.$low + x$4.$low));
n = $div64(y, new $Uint64(0, 4), false);
y = (x$5 = $mul64(new $Uint64(0, 4), n), new $Uint64(y.$high - x$5.$high, y.$low - x$5.$low));
d = (x$6 = $mul64(new $Uint64(0, 1461), n), new $Uint64(d.$high + x$6.$high, d.$low + x$6.$low));
n = y;
d = (x$7 = $mul64(new $Uint64(0, 365), n), new $Uint64(d.$high + x$7.$high, d.$low + x$7.$low));
d = (x$8 = (new $Uint64(0, (x$9 = month - 1 >> 0, ((x$9 < 0 || x$9 >= daysBefore.length) ? ($throwRuntimeError("index out of range"), undefined) : daysBefore[x$9])))), new $Uint64(d.$high + x$8.$high, d.$low + x$8.$low));
if (isLeap(year) && month >= 3) {
d = (x$10 = new $Uint64(0, 1), new $Uint64(d.$high + x$10.$high, d.$low + x$10.$low));
}
d = (x$11 = (new $Uint64(0, (day - 1 >> 0))), new $Uint64(d.$high + x$11.$high, d.$low + x$11.$low));
abs = $mul64(d, new $Uint64(0, 86400));
abs = (x$12 = (new $Uint64(0, ((($imul(hour, 3600)) + ($imul(min, 60)) >> 0) + sec >> 0))), new $Uint64(abs.$high + x$12.$high, abs.$low + x$12.$low));
unix = (x$13 = (new $Int64(abs.$high, abs.$low)), new $Int64(x$13.$high + -2147483647, x$13.$low + 3844486912));
_r = loc.lookup(unix); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple$5 = _r;
offset = _tuple$5[1];
start = _tuple$5[3];
end = _tuple$5[4];
/* */ if (!((offset === 0))) { $s = 2; continue; }
/* */ $s = 3; continue;
/* if (!((offset === 0))) { */ case 2:
utc = (x$14 = (new $Int64(0, offset)), new $Int64(unix.$high - x$14.$high, unix.$low - x$14.$low));
/* */ if ((utc.$high < start.$high || (utc.$high === start.$high && utc.$low < start.$low))) { $s = 5; continue; }
/* */ if ((utc.$high > end.$high || (utc.$high === end.$high && utc.$low >= end.$low))) { $s = 6; continue; }
/* */ $s = 7; continue;
/* if ((utc.$high < start.$high || (utc.$high === start.$high && utc.$low < start.$low))) { */ case 5:
_r$1 = loc.lookup(new $Int64(start.$high - 0, start.$low - 1)); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple$6 = _r$1;
offset = _tuple$6[1];
$s = 7; continue;
/* } else if ((utc.$high > end.$high || (utc.$high === end.$high && utc.$low >= end.$low))) { */ case 6:
_r$2 = loc.lookup(end); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_tuple$7 = _r$2;
offset = _tuple$7[1];
/* } */ case 7:
case 4:
unix = (x$15 = (new $Int64(0, offset)), new $Int64(unix.$high - x$15.$high, unix.$low - x$15.$low));
/* } */ case 3:
t = $clone(unixTime(unix, ((nsec >> 0))), Time);
t.setLoc(loc);
$s = -1; return t;
/* */ } return; } if ($f === undefined) { $f = { $blk: Date }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f._tuple$3 = _tuple$3; $f._tuple$4 = _tuple$4; $f._tuple$5 = _tuple$5; $f._tuple$6 = _tuple$6; $f._tuple$7 = _tuple$7; $f.abs = abs; $f.d = d; $f.day = day; $f.end = end; $f.hour = hour; $f.loc = loc; $f.m = m; $f.min = min; $f.month = month; $f.n = n; $f.nsec = nsec; $f.offset = offset; $f.sec = sec; $f.start = start; $f.t = t; $f.unix = unix; $f.utc = utc; $f.x = x; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$13 = x$13; $f.x$14 = x$14; $f.x$15 = x$15; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.y = y; $f.year = year; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.Date = Date;
Time.ptr.prototype.Truncate = function(d) {
var _tuple, d, r, t;
t = this;
t.stripMono();
if ((d.$high < 0 || (d.$high === 0 && d.$low <= 0))) {
return t;
}
_tuple = div($clone(t, Time), d);
r = _tuple[1];
return $clone(t, Time).Add(new Duration(-r.$high, -r.$low));
};
Time.prototype.Truncate = function(d) { return this.$val.Truncate(d); };
Time.ptr.prototype.Round = function(d) {
var _tuple, d, r, t;
t = this;
t.stripMono();
if ((d.$high < 0 || (d.$high === 0 && d.$low <= 0))) {
return t;
}
_tuple = div($clone(t, Time), d);
r = _tuple[1];
if (lessThanHalf(r, d)) {
return $clone(t, Time).Add(new Duration(-r.$high, -r.$low));
}
return $clone(t, Time).Add(new Duration(d.$high - r.$high, d.$low - r.$low));
};
Time.prototype.Round = function(d) { return this.$val.Round(d); };
div = function(t, d) {
var _q, _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, d, d0, d1, d1$1, neg, nsec, qmod2, r, sec, sec$1, t, tmp, u0, u0x, u1, x, x$1, x$10, x$11, x$12, x$13, x$14, x$15, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
qmod2 = 0;
r = new Duration(0, 0);
neg = false;
nsec = t.nsec();
sec = t.sec();
if ((sec.$high < 0 || (sec.$high === 0 && sec.$low < 0))) {
neg = true;
sec = new $Int64(-sec.$high, -sec.$low);
nsec = -nsec;
if (nsec < 0) {
nsec = nsec + (1000000000) >> 0;
sec = (x = new $Int64(0, 1), new $Int64(sec.$high - x.$high, sec.$low - x.$low));
}
}
if ((d.$high < 0 || (d.$high === 0 && d.$low < 1000000000)) && (x$1 = $div64(new Duration(0, 1000000000), (new Duration(d.$high + d.$high, d.$low + d.$low)), true), (x$1.$high === 0 && x$1.$low === 0))) {
qmod2 = (((_q = nsec / (((d.$low + ((d.$high >> 31) * 4294967296)) >> 0)), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0)) & 1;
r = (new Duration(0, (_r = nsec % (((d.$low + ((d.$high >> 31) * 4294967296)) >> 0)), _r === _r ? _r : $throwRuntimeError("integer divide by zero"))));
} else if ((x$2 = $div64(d, new Duration(0, 1000000000), true), (x$2.$high === 0 && x$2.$low === 0))) {
d1 = ((x$3 = $div64(d, new Duration(0, 1000000000), false), new $Int64(x$3.$high, x$3.$low)));
qmod2 = (((x$4 = $div64(sec, d1, false), x$4.$low + ((x$4.$high >> 31) * 4294967296)) >> 0)) & 1;
r = (x$5 = $mul64(((x$6 = $div64(sec, d1, true), new Duration(x$6.$high, x$6.$low))), new Duration(0, 1000000000)), x$7 = (new Duration(0, nsec)), new Duration(x$5.$high + x$7.$high, x$5.$low + x$7.$low));
} else {
sec$1 = (new $Uint64(sec.$high, sec.$low));
tmp = $mul64(($shiftRightUint64(sec$1, 32)), new $Uint64(0, 1000000000));
u1 = $shiftRightUint64(tmp, 32);
u0 = $shiftLeft64(tmp, 32);
tmp = $mul64((new $Uint64(sec$1.$high & 0, (sec$1.$low & 4294967295) >>> 0)), new $Uint64(0, 1000000000));
_tmp = u0;
_tmp$1 = new $Uint64(u0.$high + tmp.$high, u0.$low + tmp.$low);
u0x = _tmp;
u0 = _tmp$1;
if ((u0.$high < u0x.$high || (u0.$high === u0x.$high && u0.$low < u0x.$low))) {
u1 = (x$8 = new $Uint64(0, 1), new $Uint64(u1.$high + x$8.$high, u1.$low + x$8.$low));
}
_tmp$2 = u0;
_tmp$3 = (x$9 = (new $Uint64(0, nsec)), new $Uint64(u0.$high + x$9.$high, u0.$low + x$9.$low));
u0x = _tmp$2;
u0 = _tmp$3;
if ((u0.$high < u0x.$high || (u0.$high === u0x.$high && u0.$low < u0x.$low))) {
u1 = (x$10 = new $Uint64(0, 1), new $Uint64(u1.$high + x$10.$high, u1.$low + x$10.$low));
}
d1$1 = (new $Uint64(d.$high, d.$low));
while (true) {
if (!(!((x$11 = $shiftRightUint64(d1$1, 63), (x$11.$high === 0 && x$11.$low === 1))))) { break; }
d1$1 = $shiftLeft64(d1$1, (1));
}
d0 = new $Uint64(0, 0);
while (true) {
qmod2 = 0;
if ((u1.$high > d1$1.$high || (u1.$high === d1$1.$high && u1.$low > d1$1.$low)) || (u1.$high === d1$1.$high && u1.$low === d1$1.$low) && (u0.$high > d0.$high || (u0.$high === d0.$high && u0.$low >= d0.$low))) {
qmod2 = 1;
_tmp$4 = u0;
_tmp$5 = new $Uint64(u0.$high - d0.$high, u0.$low - d0.$low);
u0x = _tmp$4;
u0 = _tmp$5;
if ((u0.$high > u0x.$high || (u0.$high === u0x.$high && u0.$low > u0x.$low))) {
u1 = (x$12 = new $Uint64(0, 1), new $Uint64(u1.$high - x$12.$high, u1.$low - x$12.$low));
}
u1 = (x$13 = d1$1, new $Uint64(u1.$high - x$13.$high, u1.$low - x$13.$low));
}
if ((d1$1.$high === 0 && d1$1.$low === 0) && (x$14 = (new $Uint64(d.$high, d.$low)), (d0.$high === x$14.$high && d0.$low === x$14.$low))) {
break;
}
d0 = $shiftRightUint64(d0, (1));
d0 = (x$15 = $shiftLeft64((new $Uint64(d1$1.$high & 0, (d1$1.$low & 1) >>> 0)), 63), new $Uint64(d0.$high | x$15.$high, (d0.$low | x$15.$low) >>> 0));
d1$1 = $shiftRightUint64(d1$1, (1));
}
r = (new Duration(u0.$high, u0.$low));
}
if (neg && !((r.$high === 0 && r.$low === 0))) {
qmod2 = (qmod2 ^ (1)) >> 0;
r = new Duration(d.$high - r.$high, d.$low - r.$low);
}
return [qmod2, r];
};
Location.ptr.prototype.get = function() {
var l, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; l = $f.l; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
l = this;
if (l === ptrType$2.nil) {
$s = -1; return utcLoc;
}
/* */ if (l === localLoc) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (l === localLoc) { */ case 1:
$r = localOnce.Do(initLocal); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* } */ case 2:
$s = -1; return l;
/* */ } return; } if ($f === undefined) { $f = { $blk: Location.ptr.prototype.get }; } $f.l = l; $f.$s = $s; $f.$r = $r; return $f;
};
Location.prototype.get = function() { return this.$val.get(); };
Location.ptr.prototype.String = function() {
var _r, l, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; l = $f.l; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
l = this;
_r = l.get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r.name;
/* */ } return; } if ($f === undefined) { $f = { $blk: Location.ptr.prototype.String }; } $f._r = _r; $f.l = l; $f.$s = $s; $f.$r = $r; return $f;
};
Location.prototype.String = function() { return this.$val.String(); };
FixedZone = function(name, offset) {
var l, name, offset, x;
l = new Location.ptr(name, new sliceType([new zone.ptr(name, offset, false)]), new sliceType$1([new zoneTrans.ptr(new $Int64(-2147483648, 0), 0, false, false)]), new $Int64(-2147483648, 0), new $Int64(2147483647, 4294967295), ptrType.nil);
l.cacheZone = (x = l.zone, (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0]));
return l;
};
$pkg.FixedZone = FixedZone;
Location.ptr.prototype.lookup = function(sec) {
var _q, _r, end, hi, isDST, l, lim, lo, m, name, offset, sec, start, tx, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, zone$1, zone$2, zone$3, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _q = $f._q; _r = $f._r; end = $f.end; hi = $f.hi; isDST = $f.isDST; l = $f.l; lim = $f.lim; lo = $f.lo; m = $f.m; name = $f.name; offset = $f.offset; sec = $f.sec; start = $f.start; tx = $f.tx; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; zone$1 = $f.zone$1; zone$2 = $f.zone$2; zone$3 = $f.zone$3; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
name = "";
offset = 0;
isDST = false;
start = new $Int64(0, 0);
end = new $Int64(0, 0);
l = this;
_r = l.get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
l = _r;
if (l.zone.$length === 0) {
name = "UTC";
offset = 0;
isDST = false;
start = new $Int64(-2147483648, 0);
end = new $Int64(2147483647, 4294967295);
$s = -1; return [name, offset, isDST, start, end];
}
zone$1 = l.cacheZone;
if (!(zone$1 === ptrType.nil) && (x = l.cacheStart, (x.$high < sec.$high || (x.$high === sec.$high && x.$low <= sec.$low))) && (x$1 = l.cacheEnd, (sec.$high < x$1.$high || (sec.$high === x$1.$high && sec.$low < x$1.$low)))) {
name = zone$1.name;
offset = zone$1.offset;
isDST = zone$1.isDST;
start = l.cacheStart;
end = l.cacheEnd;
$s = -1; return [name, offset, isDST, start, end];
}
if ((l.tx.$length === 0) || (x$2 = (x$3 = l.tx, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0])).when, (sec.$high < x$2.$high || (sec.$high === x$2.$high && sec.$low < x$2.$low)))) {
zone$2 = (x$4 = l.zone, x$5 = l.lookupFirstZone(), ((x$5 < 0 || x$5 >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + x$5]));
name = zone$2.name;
offset = zone$2.offset;
isDST = zone$2.isDST;
start = new $Int64(-2147483648, 0);
if (l.tx.$length > 0) {
end = (x$6 = l.tx, (0 >= x$6.$length ? ($throwRuntimeError("index out of range"), undefined) : x$6.$array[x$6.$offset + 0])).when;
} else {
end = new $Int64(2147483647, 4294967295);
}
$s = -1; return [name, offset, isDST, start, end];
}
tx = l.tx;
end = new $Int64(2147483647, 4294967295);
lo = 0;
hi = tx.$length;
while (true) {
if (!((hi - lo >> 0) > 1)) { break; }
m = lo + (_q = ((hi - lo >> 0)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")) >> 0;
lim = ((m < 0 || m >= tx.$length) ? ($throwRuntimeError("index out of range"), undefined) : tx.$array[tx.$offset + m]).when;
if ((sec.$high < lim.$high || (sec.$high === lim.$high && sec.$low < lim.$low))) {
end = lim;
hi = m;
} else {
lo = m;
}
}
zone$3 = (x$7 = l.zone, x$8 = ((lo < 0 || lo >= tx.$length) ? ($throwRuntimeError("index out of range"), undefined) : tx.$array[tx.$offset + lo]).index, ((x$8 < 0 || x$8 >= x$7.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$7.$array[x$7.$offset + x$8]));
name = zone$3.name;
offset = zone$3.offset;
isDST = zone$3.isDST;
start = ((lo < 0 || lo >= tx.$length) ? ($throwRuntimeError("index out of range"), undefined) : tx.$array[tx.$offset + lo]).when;
$s = -1; return [name, offset, isDST, start, end];
/* */ } return; } if ($f === undefined) { $f = { $blk: Location.ptr.prototype.lookup }; } $f._q = _q; $f._r = _r; $f.end = end; $f.hi = hi; $f.isDST = isDST; $f.l = l; $f.lim = lim; $f.lo = lo; $f.m = m; $f.name = name; $f.offset = offset; $f.sec = sec; $f.start = start; $f.tx = tx; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.zone$1 = zone$1; $f.zone$2 = zone$2; $f.zone$3 = zone$3; $f.$s = $s; $f.$r = $r; return $f;
};
Location.prototype.lookup = function(sec) { return this.$val.lookup(sec); };
Location.ptr.prototype.lookupFirstZone = function() {
var _i, _ref, l, x, x$1, x$2, x$3, x$4, x$5, zi, zi$1;
l = this;
if (!l.firstZoneUsed()) {
return 0;
}
if (l.tx.$length > 0 && (x = l.zone, x$1 = (x$2 = l.tx, (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0])).index, ((x$1 < 0 || x$1 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + x$1])).isDST) {
zi = (((x$3 = l.tx, (0 >= x$3.$length ? ($throwRuntimeError("index out of range"), undefined) : x$3.$array[x$3.$offset + 0])).index >> 0)) - 1 >> 0;
while (true) {
if (!(zi >= 0)) { break; }
if (!(x$4 = l.zone, ((zi < 0 || zi >= x$4.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$4.$array[x$4.$offset + zi])).isDST) {
return zi;
}
zi = zi - (1) >> 0;
}
}
_ref = l.zone;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
zi$1 = _i;
if (!(x$5 = l.zone, ((zi$1 < 0 || zi$1 >= x$5.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$5.$array[x$5.$offset + zi$1])).isDST) {
return zi$1;
}
_i++;
}
return 0;
};
Location.prototype.lookupFirstZone = function() { return this.$val.lookupFirstZone(); };
Location.ptr.prototype.firstZoneUsed = function() {
var _i, _ref, l, tx;
l = this;
_ref = l.tx;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
tx = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), zoneTrans);
if (tx.index === 0) {
return true;
}
_i++;
}
return false;
};
Location.prototype.firstZoneUsed = function() { return this.$val.firstZoneUsed(); };
Location.ptr.prototype.lookupName = function(name, unix) {
var _i, _i$1, _r, _r$1, _ref, _ref$1, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, i, i$1, isDST, isDST$1, l, nam, name, offset, offset$1, ok, unix, x, x$1, x$2, zone$1, zone$2, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _ref$1 = $f._ref$1; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; i = $f.i; i$1 = $f.i$1; isDST = $f.isDST; isDST$1 = $f.isDST$1; l = $f.l; nam = $f.nam; name = $f.name; offset = $f.offset; offset$1 = $f.offset$1; ok = $f.ok; unix = $f.unix; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; zone$1 = $f.zone$1; zone$2 = $f.zone$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
offset = 0;
isDST = false;
ok = false;
l = this;
_r = l.get(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
l = _r;
_ref = l.zone;
_i = 0;
/* while (true) { */ case 2:
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 3; continue; }
i = _i;
zone$1 = (x = l.zone, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
/* */ if (zone$1.name === name) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (zone$1.name === name) { */ case 4:
_r$1 = l.lookup((x$1 = (new $Int64(0, zone$1.offset)), new $Int64(unix.$high - x$1.$high, unix.$low - x$1.$low))); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple = _r$1;
nam = _tuple[0];
offset$1 = _tuple[1];
isDST$1 = _tuple[2];
if (nam === zone$1.name) {
_tmp = offset$1;
_tmp$1 = isDST$1;
_tmp$2 = true;
offset = _tmp;
isDST = _tmp$1;
ok = _tmp$2;
$s = -1; return [offset, isDST, ok];
}
/* } */ case 5:
_i++;
/* } */ $s = 2; continue; case 3:
_ref$1 = l.zone;
_i$1 = 0;
while (true) {
if (!(_i$1 < _ref$1.$length)) { break; }
i$1 = _i$1;
zone$2 = (x$2 = l.zone, ((i$1 < 0 || i$1 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + i$1]));
if (zone$2.name === name) {
_tmp$3 = zone$2.offset;
_tmp$4 = zone$2.isDST;
_tmp$5 = true;
offset = _tmp$3;
isDST = _tmp$4;
ok = _tmp$5;
$s = -1; return [offset, isDST, ok];
}
_i$1++;
}
$s = -1; return [offset, isDST, ok];
/* */ } return; } if ($f === undefined) { $f = { $blk: Location.ptr.prototype.lookupName }; } $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._ref$1 = _ref$1; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f.i = i; $f.i$1 = i$1; $f.isDST = isDST; $f.isDST$1 = isDST$1; $f.l = l; $f.nam = nam; $f.name = name; $f.offset = offset; $f.offset$1 = offset$1; $f.ok = ok; $f.unix = unix; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.zone$1 = zone$1; $f.zone$2 = zone$2; $f.$s = $s; $f.$r = $r; return $f;
};
Location.prototype.lookupName = function(name, unix) { return this.$val.lookupName(name, unix); };
ptrType$4.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
Time.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Format", name: "Format", pkg: "", typ: $funcType([$String], [$String], false)}, {prop: "AppendFormat", name: "AppendFormat", pkg: "", typ: $funcType([sliceType$3, $String], [sliceType$3], false)}, {prop: "After", name: "After", pkg: "", typ: $funcType([Time], [$Bool], false)}, {prop: "Before", name: "Before", pkg: "", typ: $funcType([Time], [$Bool], false)}, {prop: "Equal", name: "Equal", pkg: "", typ: $funcType([Time], [$Bool], false)}, {prop: "IsZero", name: "IsZero", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "abs", name: "abs", pkg: "time", typ: $funcType([], [$Uint64], false)}, {prop: "locabs", name: "locabs", pkg: "time", typ: $funcType([], [$String, $Int, $Uint64], false)}, {prop: "Date", name: "Date", pkg: "", typ: $funcType([], [$Int, Month, $Int], false)}, {prop: "Year", name: "Year", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Month", name: "Month", pkg: "", typ: $funcType([], [Month], false)}, {prop: "Day", name: "Day", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Weekday", name: "Weekday", pkg: "", typ: $funcType([], [Weekday], false)}, {prop: "ISOWeek", name: "ISOWeek", pkg: "", typ: $funcType([], [$Int, $Int], false)}, {prop: "Clock", name: "Clock", pkg: "", typ: $funcType([], [$Int, $Int, $Int], false)}, {prop: "Hour", name: "Hour", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Minute", name: "Minute", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Second", name: "Second", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Nanosecond", name: "Nanosecond", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "YearDay", name: "YearDay", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Add", name: "Add", pkg: "", typ: $funcType([Duration], [Time], false)}, {prop: "Sub", name: "Sub", pkg: "", typ: $funcType([Time], [Duration], false)}, {prop: "AddDate", name: "AddDate", pkg: "", typ: $funcType([$Int, $Int, $Int], [Time], false)}, {prop: "date", name: "date", pkg: "time", typ: $funcType([$Bool], [$Int, Month, $Int, $Int], false)}, {prop: "UTC", name: "UTC", pkg: "", typ: $funcType([], [Time], false)}, {prop: "Local", name: "Local", pkg: "", typ: $funcType([], [Time], false)}, {prop: "In", name: "In", pkg: "", typ: $funcType([ptrType$2], [Time], false)}, {prop: "Location", name: "Location", pkg: "", typ: $funcType([], [ptrType$2], false)}, {prop: "Zone", name: "Zone", pkg: "", typ: $funcType([], [$String, $Int], false)}, {prop: "Unix", name: "Unix", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "UnixNano", name: "UnixNano", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "MarshalBinary", name: "MarshalBinary", pkg: "", typ: $funcType([], [sliceType$3, $error], false)}, {prop: "GobEncode", name: "GobEncode", pkg: "", typ: $funcType([], [sliceType$3, $error], false)}, {prop: "MarshalJSON", name: "MarshalJSON", pkg: "", typ: $funcType([], [sliceType$3, $error], false)}, {prop: "MarshalText", name: "MarshalText", pkg: "", typ: $funcType([], [sliceType$3, $error], false)}, {prop: "Truncate", name: "Truncate", pkg: "", typ: $funcType([Duration], [Time], false)}, {prop: "Round", name: "Round", pkg: "", typ: $funcType([Duration], [Time], false)}];
ptrType$7.methods = [{prop: "nsec", name: "nsec", pkg: "time", typ: $funcType([], [$Int32], false)}, {prop: "sec", name: "sec", pkg: "time", typ: $funcType([], [$Int64], false)}, {prop: "unixSec", name: "unixSec", pkg: "time", typ: $funcType([], [$Int64], false)}, {prop: "addSec", name: "addSec", pkg: "time", typ: $funcType([$Int64], [], false)}, {prop: "setLoc", name: "setLoc", pkg: "time", typ: $funcType([ptrType$2], [], false)}, {prop: "stripMono", name: "stripMono", pkg: "time", typ: $funcType([], [], false)}, {prop: "setMono", name: "setMono", pkg: "time", typ: $funcType([$Int64], [], false)}, {prop: "mono", name: "mono", pkg: "time", typ: $funcType([], [$Int64], false)}, {prop: "UnmarshalBinary", name: "UnmarshalBinary", pkg: "", typ: $funcType([sliceType$3], [$error], false)}, {prop: "GobDecode", name: "GobDecode", pkg: "", typ: $funcType([sliceType$3], [$error], false)}, {prop: "UnmarshalJSON", name: "UnmarshalJSON", pkg: "", typ: $funcType([sliceType$3], [$error], false)}, {prop: "UnmarshalText", name: "UnmarshalText", pkg: "", typ: $funcType([sliceType$3], [$error], false)}];
Month.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
Weekday.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
Duration.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Nanoseconds", name: "Nanoseconds", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Seconds", name: "Seconds", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Minutes", name: "Minutes", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Hours", name: "Hours", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Truncate", name: "Truncate", pkg: "", typ: $funcType([Duration], [Duration], false)}, {prop: "Round", name: "Round", pkg: "", typ: $funcType([Duration], [Duration], false)}];
ptrType$2.methods = [{prop: "get", name: "get", pkg: "time", typ: $funcType([], [ptrType$2], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "lookup", name: "lookup", pkg: "time", typ: $funcType([$Int64], [$String, $Int, $Bool, $Int64, $Int64], false)}, {prop: "lookupFirstZone", name: "lookupFirstZone", pkg: "time", typ: $funcType([], [$Int], false)}, {prop: "firstZoneUsed", name: "firstZoneUsed", pkg: "time", typ: $funcType([], [$Bool], false)}, {prop: "lookupName", name: "lookupName", pkg: "time", typ: $funcType([$String, $Int64], [$Int, $Bool, $Bool], false)}];
ParseError.init("", [{prop: "Layout", name: "Layout", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Value", name: "Value", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "LayoutElem", name: "LayoutElem", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "ValueElem", name: "ValueElem", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Message", name: "Message", anonymous: false, exported: true, typ: $String, tag: ""}]);
Time.init("time", [{prop: "wall", name: "wall", anonymous: false, exported: false, typ: $Uint64, tag: ""}, {prop: "ext", name: "ext", anonymous: false, exported: false, typ: $Int64, tag: ""}, {prop: "loc", name: "loc", anonymous: false, exported: false, typ: ptrType$2, tag: ""}]);
Location.init("time", [{prop: "name", name: "name", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "zone", name: "zone", anonymous: false, exported: false, typ: sliceType, tag: ""}, {prop: "tx", name: "tx", anonymous: false, exported: false, typ: sliceType$1, tag: ""}, {prop: "cacheStart", name: "cacheStart", anonymous: false, exported: false, typ: $Int64, tag: ""}, {prop: "cacheEnd", name: "cacheEnd", anonymous: false, exported: false, typ: $Int64, tag: ""}, {prop: "cacheZone", name: "cacheZone", anonymous: false, exported: false, typ: ptrType, tag: ""}]);
zone.init("time", [{prop: "name", name: "name", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "offset", name: "offset", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "isDST", name: "isDST", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
zoneTrans.init("time", [{prop: "when", name: "when", anonymous: false, exported: false, typ: $Int64, tag: ""}, {prop: "index", name: "index", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "isstd", name: "isstd", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "isutc", name: "isutc", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = js.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = nosync.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = runtime.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = syscall.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
localLoc = new Location.ptr("", sliceType.nil, sliceType$1.nil, new $Int64(0, 0), new $Int64(0, 0), ptrType.nil);
localOnce = new nosync.Once.ptr(false, false);
std0x = $toNativeArray($kindInt, [260, 265, 524, 526, 528, 274]);
longDayNames = new sliceType$2(["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]);
shortDayNames = new sliceType$2(["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]);
shortMonthNames = new sliceType$2(["---", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]);
longMonthNames = new sliceType$2(["---", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]);
atoiError = errors.New("time: invalid number");
errBad = errors.New("bad value for field");
errLeadingInt = errors.New("time: bad [0-9]*");
months = $toNativeArray($kindString, ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]);
days = $toNativeArray($kindString, ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]);
daysBefore = $toNativeArray($kindInt32, [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]);
utcLoc = new Location.ptr("UTC", sliceType.nil, sliceType$1.nil, new $Int64(0, 0), new $Int64(0, 0), ptrType.nil);
$pkg.UTC = utcLoc;
$pkg.Local = localLoc;
errLocation = errors.New("time: invalid location name");
badData = errors.New("malformed time zone information");
zoneDirs = new sliceType$2(["/usr/share/zoneinfo/", "/usr/share/lib/zoneinfo/", "/usr/lib/locale/TZ/", runtime.GOROOT() + "/lib/time/zoneinfo.zip"]);
init();
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["internal/poll"] = (function() {
var $pkg = {}, $init, errors, io, atomic, syscall, time, pollDesc, TimeoutError, fdMutex, FD, ptrType, ptrType$1, arrayType, sliceType, ptrType$3, ptrType$4, ptrType$5, ptrType$6, ptrType$7, ptrType$8, sliceType$1, ptrType$9, funcType, funcType$1, ptrType$10, ptrType$11, ptrType$12, ptrType$13, sliceType$2, ptrType$14, errClosing, consume, runtime_Semacquire, runtime_Semrelease, accept;
errors = $packages["errors"];
io = $packages["io"];
atomic = $packages["sync/atomic"];
syscall = $packages["syscall"];
time = $packages["time"];
pollDesc = $pkg.pollDesc = $newType(0, $kindStruct, "poll.pollDesc", true, "internal/poll", false, function(closing_) {
this.$val = this;
if (arguments.length === 0) {
this.closing = false;
return;
}
this.closing = closing_;
});
TimeoutError = $pkg.TimeoutError = $newType(0, $kindStruct, "poll.TimeoutError", true, "internal/poll", true, function() {
this.$val = this;
if (arguments.length === 0) {
return;
}
});
fdMutex = $pkg.fdMutex = $newType(0, $kindStruct, "poll.fdMutex", true, "internal/poll", false, function(state_, rsema_, wsema_) {
this.$val = this;
if (arguments.length === 0) {
this.state = new $Uint64(0, 0);
this.rsema = 0;
this.wsema = 0;
return;
}
this.state = state_;
this.rsema = rsema_;
this.wsema = wsema_;
});
FD = $pkg.FD = $newType(0, $kindStruct, "poll.FD", true, "internal/poll", true, function(fdmu_, Sysfd_, pd_, iovecs_, IsStream_, ZeroReadIsEOF_, isFile_) {
this.$val = this;
if (arguments.length === 0) {
this.fdmu = new fdMutex.ptr(new $Uint64(0, 0), 0, 0);
this.Sysfd = 0;
this.pd = new pollDesc.ptr(false);
this.iovecs = ptrType$3.nil;
this.IsStream = false;
this.ZeroReadIsEOF = false;
this.isFile = false;
return;
}
this.fdmu = fdmu_;
this.Sysfd = Sysfd_;
this.pd = pd_;
this.iovecs = iovecs_;
this.IsStream = IsStream_;
this.ZeroReadIsEOF = ZeroReadIsEOF_;
this.isFile = isFile_;
});
ptrType = $ptrType($Uint64);
ptrType$1 = $ptrType($Uint32);
arrayType = $arrayType($Uint8, 4);
sliceType = $sliceType(syscall.Iovec);
ptrType$3 = $ptrType(sliceType);
ptrType$4 = $ptrType($Uint8);
ptrType$5 = $ptrType(FD);
ptrType$6 = $ptrType(pollDesc);
ptrType$7 = $ptrType(TimeoutError);
ptrType$8 = $ptrType(fdMutex);
sliceType$1 = $sliceType($Uint8);
ptrType$9 = $ptrType(syscall.Stat_t);
funcType = $funcType([$Uintptr], [], false);
funcType$1 = $funcType([$Uintptr], [$Bool], false);
ptrType$10 = $ptrType(syscall.Linger);
ptrType$11 = $ptrType(syscall.IPMreqn);
ptrType$12 = $ptrType(syscall.IPMreq);
ptrType$13 = $ptrType(syscall.IPv6Mreq);
sliceType$2 = $sliceType(sliceType$1);
ptrType$14 = $ptrType(sliceType$2);
pollDesc.ptr.prototype.init = function(fd) {
var fd, pd;
pd = this;
return $ifaceNil;
};
pollDesc.prototype.init = function(fd) { return this.$val.init(fd); };
pollDesc.ptr.prototype.close = function() {
var pd;
pd = this;
};
pollDesc.prototype.close = function() { return this.$val.close(); };
pollDesc.ptr.prototype.evict = function() {
var pd;
pd = this;
pd.closing = true;
};
pollDesc.prototype.evict = function() { return this.$val.evict(); };
pollDesc.ptr.prototype.prepare = function(mode, isFile) {
var isFile, mode, pd;
pd = this;
if (pd.closing) {
return errClosing(isFile);
}
return $ifaceNil;
};
pollDesc.prototype.prepare = function(mode, isFile) { return this.$val.prepare(mode, isFile); };
pollDesc.ptr.prototype.prepareRead = function(isFile) {
var isFile, pd;
pd = this;
return pd.prepare(114, isFile);
};
pollDesc.prototype.prepareRead = function(isFile) { return this.$val.prepareRead(isFile); };
pollDesc.ptr.prototype.prepareWrite = function(isFile) {
var isFile, pd;
pd = this;
return pd.prepare(119, isFile);
};
pollDesc.prototype.prepareWrite = function(isFile) { return this.$val.prepareWrite(isFile); };
pollDesc.ptr.prototype.wait = function(mode, isFile) {
var isFile, mode, pd;
pd = this;
if (pd.closing) {
return errClosing(isFile);
}
return $pkg.ErrTimeout;
};
pollDesc.prototype.wait = function(mode, isFile) { return this.$val.wait(mode, isFile); };
pollDesc.ptr.prototype.waitRead = function(isFile) {
var isFile, pd;
pd = this;
return pd.wait(114, isFile);
};
pollDesc.prototype.waitRead = function(isFile) { return this.$val.waitRead(isFile); };
pollDesc.ptr.prototype.waitWrite = function(isFile) {
var isFile, pd;
pd = this;
return pd.wait(119, isFile);
};
pollDesc.prototype.waitWrite = function(isFile) { return this.$val.waitWrite(isFile); };
pollDesc.ptr.prototype.pollable = function() {
return true;
};
pollDesc.prototype.pollable = function() { return this.$val.pollable(); };
FD.ptr.prototype.SetDeadline = function(t) {
var t;
return $ifaceNil;
};
FD.prototype.SetDeadline = function(t) { return this.$val.SetDeadline(t); };
FD.ptr.prototype.SetReadDeadline = function(t) {
var t;
return $ifaceNil;
};
FD.prototype.SetReadDeadline = function(t) { return this.$val.SetReadDeadline(t); };
FD.ptr.prototype.SetWriteDeadline = function(t) {
var t;
return $ifaceNil;
};
FD.prototype.SetWriteDeadline = function(t) { return this.$val.SetWriteDeadline(t); };
errClosing = function(isFile) {
var isFile;
if (isFile) {
return $pkg.ErrFileClosing;
}
return $pkg.ErrNetClosing;
};
TimeoutError.ptr.prototype.Error = function() {
var e;
e = this;
return "i/o timeout";
};
TimeoutError.prototype.Error = function() { return this.$val.Error(); };
TimeoutError.ptr.prototype.Timeout = function() {
var e;
e = this;
return true;
};
TimeoutError.prototype.Timeout = function() { return this.$val.Timeout(); };
TimeoutError.ptr.prototype.Temporary = function() {
var e;
e = this;
return true;
};
TimeoutError.prototype.Temporary = function() { return this.$val.Temporary(); };
consume = function(v, n) {
var ln0, n, v, x, x$1, x$2, x$3;
while (true) {
if (!(v.$get().$length > 0)) { break; }
ln0 = (new $Int64(0, (x = v.$get(), (0 >= x.$length ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + 0])).$length));
if ((ln0.$high > n.$high || (ln0.$high === n.$high && ln0.$low > n.$low))) {
(x$2 = v.$get(), (0 >= x$2.$length ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + 0] = $subslice((x$1 = v.$get(), (0 >= x$1.$length ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + 0])), $flatten64(n))));
return;
}
n = (x$3 = ln0, new $Int64(n.$high - x$3.$high, n.$low - x$3.$low));
v.$set($subslice((v.$get()), 1));
}
};
fdMutex.ptr.prototype.incref = function() {
var mu, new$1, old, x, x$1;
mu = this;
while (true) {
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
if (!((x = new $Uint64(old.$high & 0, (old.$low & 1) >>> 0), (x.$high === 0 && x.$low === 0)))) {
return false;
}
new$1 = new $Uint64(old.$high + 0, old.$low + 8);
if ((x$1 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388600) >>> 0), (x$1.$high === 0 && x$1.$low === 0))) {
$panic(new $String("inconsistent poll.fdMutex"));
}
if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) {
return true;
}
}
};
fdMutex.prototype.incref = function() { return this.$val.incref(); };
fdMutex.ptr.prototype.increfAndClose = function() {
var mu, new$1, old, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7;
mu = this;
while (true) {
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
if (!((x = new $Uint64(old.$high & 0, (old.$low & 1) >>> 0), (x.$high === 0 && x.$low === 0)))) {
return false;
}
new$1 = (x$1 = new $Uint64(old.$high | 0, (old.$low | 1) >>> 0), new $Uint64(x$1.$high + 0, x$1.$low + 8));
if ((x$2 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388600) >>> 0), (x$2.$high === 0 && x$2.$low === 0))) {
$panic(new $String("inconsistent poll.fdMutex"));
}
new$1 = (x$3 = new $Uint64(2147483647, 4286578688), new $Uint64(new$1.$high & ~x$3.$high, (new$1.$low & ~x$3.$low) >>> 0));
if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) {
while (true) {
if (!(!((x$4 = new $Uint64(old.$high & 2047, (old.$low & 4286578688) >>> 0), (x$4.$high === 0 && x$4.$low === 0))))) { break; }
old = (x$5 = new $Uint64(0, 8388608), new $Uint64(old.$high - x$5.$high, old.$low - x$5.$low));
runtime_Semrelease((mu.$ptr_rsema || (mu.$ptr_rsema = new ptrType$1(function() { return this.$target.rsema; }, function($v) { this.$target.rsema = $v; }, mu))));
}
while (true) {
if (!(!((x$6 = new $Uint64(old.$high & 2147481600, (old.$low & 0) >>> 0), (x$6.$high === 0 && x$6.$low === 0))))) { break; }
old = (x$7 = new $Uint64(2048, 0), new $Uint64(old.$high - x$7.$high, old.$low - x$7.$low));
runtime_Semrelease((mu.$ptr_wsema || (mu.$ptr_wsema = new ptrType$1(function() { return this.$target.wsema; }, function($v) { this.$target.wsema = $v; }, mu))));
}
return true;
}
}
};
fdMutex.prototype.increfAndClose = function() { return this.$val.increfAndClose(); };
fdMutex.ptr.prototype.decref = function() {
var mu, new$1, old, x, x$1;
mu = this;
while (true) {
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
if ((x = new $Uint64(old.$high & 0, (old.$low & 8388600) >>> 0), (x.$high === 0 && x.$low === 0))) {
$panic(new $String("inconsistent poll.fdMutex"));
}
new$1 = new $Uint64(old.$high - 0, old.$low - 8);
if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) {
return (x$1 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388601) >>> 0), (x$1.$high === 0 && x$1.$low === 1));
}
}
};
fdMutex.prototype.decref = function() { return this.$val.decref(); };
fdMutex.ptr.prototype.rwlock = function(read) {
var _tmp, _tmp$1, _tmp$2, mu, mutexBit, mutexMask, mutexSema, mutexWait, new$1, old, read, x, x$1, x$2, x$3, x$4, x$5;
mu = this;
_tmp = new $Uint64(0, 0);
_tmp$1 = new $Uint64(0, 0);
_tmp$2 = new $Uint64(0, 0);
mutexBit = _tmp;
mutexWait = _tmp$1;
mutexMask = _tmp$2;
mutexSema = ptrType$1.nil;
if (read) {
mutexBit = new $Uint64(0, 2);
mutexWait = new $Uint64(0, 8388608);
mutexMask = new $Uint64(2047, 4286578688);
mutexSema = (mu.$ptr_rsema || (mu.$ptr_rsema = new ptrType$1(function() { return this.$target.rsema; }, function($v) { this.$target.rsema = $v; }, mu)));
} else {
mutexBit = new $Uint64(0, 4);
mutexWait = new $Uint64(2048, 0);
mutexMask = new $Uint64(2147481600, 0);
mutexSema = (mu.$ptr_wsema || (mu.$ptr_wsema = new ptrType$1(function() { return this.$target.wsema; }, function($v) { this.$target.wsema = $v; }, mu)));
}
while (true) {
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
if (!((x = new $Uint64(old.$high & 0, (old.$low & 1) >>> 0), (x.$high === 0 && x.$low === 0)))) {
return false;
}
new$1 = new $Uint64(0, 0);
if ((x$1 = new $Uint64(old.$high & mutexBit.$high, (old.$low & mutexBit.$low) >>> 0), (x$1.$high === 0 && x$1.$low === 0))) {
new$1 = (x$2 = new $Uint64(old.$high | mutexBit.$high, (old.$low | mutexBit.$low) >>> 0), new $Uint64(x$2.$high + 0, x$2.$low + 8));
if ((x$3 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388600) >>> 0), (x$3.$high === 0 && x$3.$low === 0))) {
$panic(new $String("inconsistent poll.fdMutex"));
}
} else {
new$1 = new $Uint64(old.$high + mutexWait.$high, old.$low + mutexWait.$low);
if ((x$4 = new $Uint64(new$1.$high & mutexMask.$high, (new$1.$low & mutexMask.$low) >>> 0), (x$4.$high === 0 && x$4.$low === 0))) {
$panic(new $String("inconsistent poll.fdMutex"));
}
}
if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) {
if ((x$5 = new $Uint64(old.$high & mutexBit.$high, (old.$low & mutexBit.$low) >>> 0), (x$5.$high === 0 && x$5.$low === 0))) {
return true;
}
runtime_Semacquire(mutexSema);
}
}
};
fdMutex.prototype.rwlock = function(read) { return this.$val.rwlock(read); };
fdMutex.ptr.prototype.rwunlock = function(read) {
var _tmp, _tmp$1, _tmp$2, mu, mutexBit, mutexMask, mutexSema, mutexWait, new$1, old, read, x, x$1, x$2, x$3, x$4, x$5, x$6;
mu = this;
_tmp = new $Uint64(0, 0);
_tmp$1 = new $Uint64(0, 0);
_tmp$2 = new $Uint64(0, 0);
mutexBit = _tmp;
mutexWait = _tmp$1;
mutexMask = _tmp$2;
mutexSema = ptrType$1.nil;
if (read) {
mutexBit = new $Uint64(0, 2);
mutexWait = new $Uint64(0, 8388608);
mutexMask = new $Uint64(2047, 4286578688);
mutexSema = (mu.$ptr_rsema || (mu.$ptr_rsema = new ptrType$1(function() { return this.$target.rsema; }, function($v) { this.$target.rsema = $v; }, mu)));
} else {
mutexBit = new $Uint64(0, 4);
mutexWait = new $Uint64(2048, 0);
mutexMask = new $Uint64(2147481600, 0);
mutexSema = (mu.$ptr_wsema || (mu.$ptr_wsema = new ptrType$1(function() { return this.$target.wsema; }, function($v) { this.$target.wsema = $v; }, mu)));
}
while (true) {
old = atomic.LoadUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))));
if ((x = new $Uint64(old.$high & mutexBit.$high, (old.$low & mutexBit.$low) >>> 0), (x.$high === 0 && x.$low === 0)) || (x$1 = new $Uint64(old.$high & 0, (old.$low & 8388600) >>> 0), (x$1.$high === 0 && x$1.$low === 0))) {
$panic(new $String("inconsistent poll.fdMutex"));
}
new$1 = (x$2 = new $Uint64(old.$high & ~mutexBit.$high, (old.$low & ~mutexBit.$low) >>> 0), new $Uint64(x$2.$high - 0, x$2.$low - 8));
if (!((x$3 = new $Uint64(old.$high & mutexMask.$high, (old.$low & mutexMask.$low) >>> 0), (x$3.$high === 0 && x$3.$low === 0)))) {
new$1 = (x$4 = mutexWait, new $Uint64(new$1.$high - x$4.$high, new$1.$low - x$4.$low));
}
if (atomic.CompareAndSwapUint64((mu.$ptr_state || (mu.$ptr_state = new ptrType(function() { return this.$target.state; }, function($v) { this.$target.state = $v; }, mu))), old, new$1)) {
if (!((x$5 = new $Uint64(old.$high & mutexMask.$high, (old.$low & mutexMask.$low) >>> 0), (x$5.$high === 0 && x$5.$low === 0)))) {
runtime_Semrelease(mutexSema);
}
return (x$6 = new $Uint64(new$1.$high & 0, (new$1.$low & 8388601) >>> 0), (x$6.$high === 0 && x$6.$low === 1));
}
}
};
fdMutex.prototype.rwunlock = function(read) { return this.$val.rwunlock(read); };
runtime_Semacquire = function() {
$throwRuntimeError("native function not implemented: internal/poll.runtime_Semacquire");
};
runtime_Semrelease = function() {
$throwRuntimeError("native function not implemented: internal/poll.runtime_Semrelease");
};
FD.ptr.prototype.incref = function() {
var fd;
fd = this;
if (!fd.fdmu.incref()) {
return errClosing(fd.isFile);
}
return $ifaceNil;
};
FD.prototype.incref = function() { return this.$val.incref(); };
FD.ptr.prototype.decref = function() {
var _r, fd, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fd = this;
/* */ if (fd.fdmu.decref()) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (fd.fdmu.decref()) { */ case 1:
_r = fd.destroy(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } */ case 2:
$s = -1; return $ifaceNil;
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.decref }; } $f._r = _r; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
};
FD.prototype.decref = function() { return this.$val.decref(); };
FD.ptr.prototype.readLock = function() {
var fd;
fd = this;
if (!fd.fdmu.rwlock(true)) {
return errClosing(fd.isFile);
}
return $ifaceNil;
};
FD.prototype.readLock = function() { return this.$val.readLock(); };
FD.ptr.prototype.readUnlock = function() {
var _r, fd, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fd = this;
/* */ if (fd.fdmu.rwunlock(true)) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (fd.fdmu.rwunlock(true)) { */ case 1:
_r = fd.destroy(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r;
/* } */ case 2:
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.readUnlock }; } $f._r = _r; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
};
FD.prototype.readUnlock = function() { return this.$val.readUnlock(); };
FD.ptr.prototype.writeLock = function() {
var fd;
fd = this;
if (!fd.fdmu.rwlock(false)) {
return errClosing(fd.isFile);
}
return $ifaceNil;
};
FD.prototype.writeLock = function() { return this.$val.writeLock(); };
FD.ptr.prototype.writeUnlock = function() {
var _r, fd, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fd = this;
/* */ if (fd.fdmu.rwunlock(false)) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (fd.fdmu.rwunlock(false)) { */ case 1:
_r = fd.destroy(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r;
/* } */ case 2:
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.writeUnlock }; } $f._r = _r; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
};
FD.prototype.writeUnlock = function() { return this.$val.writeUnlock(); };
FD.ptr.prototype.eofError = function(n, err) {
var err, fd, n;
fd = this;
if ((n === 0) && $interfaceIsEqual(err, $ifaceNil) && fd.ZeroReadIsEOF) {
return io.EOF;
}
return err;
};
FD.prototype.eofError = function(n, err) { return this.$val.eofError(n, err); };
FD.ptr.prototype.Fchmod = function(mode) {
var err, fd, mode, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; mode = $f.mode; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.Fchmod(fd.Sysfd, mode);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fchmod }; } $f.err = err; $f.fd = fd; $f.mode = mode; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Fchmod = function(mode) { return this.$val.Fchmod(mode); };
FD.ptr.prototype.Fchown = function(uid, gid) {
var err, fd, gid, uid, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; gid = $f.gid; uid = $f.uid; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.Fchown(fd.Sysfd, uid, gid);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fchown }; } $f.err = err; $f.fd = fd; $f.gid = gid; $f.uid = uid; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Fchown = function(uid, gid) { return this.$val.Fchown(uid, gid); };
FD.ptr.prototype.Ftruncate = function(size) {
var err, fd, size, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; size = $f.size; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.Ftruncate(fd.Sysfd, size);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Ftruncate }; } $f.err = err; $f.fd = fd; $f.size = size; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Ftruncate = function(size) { return this.$val.Ftruncate(size); };
FD.ptr.prototype.Fsync = function() {
var err, fd, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.Fsync(fd.Sysfd);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fsync }; } $f.err = err; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Fsync = function() { return this.$val.Fsync(); };
FD.ptr.prototype.Init = function(net, pollable) {
var fd, net, pollable;
fd = this;
if (net === "file") {
fd.isFile = true;
}
if (!pollable) {
return $ifaceNil;
}
return fd.pd.init(fd);
};
FD.prototype.Init = function(net, pollable) { return this.$val.Init(net, pollable); };
FD.ptr.prototype.destroy = function() {
var _r, err, fd, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fd = this;
fd.pd.close();
_r = $pkg.CloseFunc(fd.Sysfd); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
err = _r;
fd.Sysfd = -1;
$s = -1; return err;
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.destroy }; } $f._r = _r; $f.err = err; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
};
FD.prototype.destroy = function() { return this.$val.destroy(); };
FD.ptr.prototype.Close = function() {
var _r, fd, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; fd = $f.fd; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fd = this;
if (!fd.fdmu.increfAndClose()) {
$s = -1; return errClosing(fd.isFile);
}
fd.pd.evict();
_r = fd.decref(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Close }; } $f._r = _r; $f.fd = fd; $f.$s = $s; $f.$r = $r; return $f;
};
FD.prototype.Close = function() { return this.$val.Close(); };
FD.ptr.prototype.Shutdown = function(how) {
var err, fd, how, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; how = $f.how; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.Shutdown(fd.Sysfd, how);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Shutdown }; } $f.err = err; $f.fd = fd; $f.how = how; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Shutdown = function(how) { return this.$val.Shutdown(how); };
FD.ptr.prototype.Read = function(p) {
var _tuple, err, err$1, err$2, fd, n, p, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; n = $f.n; p = $f.p; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.readLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, err];
}
$deferred.push([$methodVal(fd, "readUnlock"), []]);
if (p.$length === 0) {
$s = -1; return [0, $ifaceNil];
}
err$1 = fd.pd.prepareRead(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [0, err$1];
}
if (fd.IsStream && p.$length > 1073741824) {
p = $subslice(p, 0, 1073741824);
}
while (true) {
_tuple = syscall.Read(fd.Sysfd, p);
n = _tuple[0];
err$2 = _tuple[1];
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
n = 0;
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
err$2 = fd.pd.waitRead(fd.isFile);
if ($interfaceIsEqual(err$2, $ifaceNil)) {
continue;
}
}
}
err$2 = fd.eofError(n, err$2);
$s = -1; return [n, err$2];
}
$s = -1; return [0, $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Read }; } $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.n = n; $f.p = p; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Read = function(p) { return this.$val.Read(p); };
FD.ptr.prototype.Pread = function(p, off) {
var _r, _tuple, err, err$1, fd, n, off, p, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; fd = $f.fd; n = $f.n; off = $f.off; p = $f.p; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, err];
}
if (fd.IsStream && p.$length > 1073741824) {
p = $subslice(p, 0, 1073741824);
}
_tuple = syscall.Pread(fd.Sysfd, p, off);
n = _tuple[0];
err$1 = _tuple[1];
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
n = 0;
}
_r = fd.decref(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r;
err$1 = fd.eofError(n, err$1);
$s = -1; return [n, err$1];
/* */ } return; } if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Pread }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.fd = fd; $f.n = n; $f.off = off; $f.p = p; $f.$s = $s; $f.$r = $r; return $f;
};
FD.prototype.Pread = function(p, off) { return this.$val.Pread(p, off); };
FD.ptr.prototype.ReadFrom = function(p) {
var _tuple, err, err$1, err$2, fd, n, p, sa, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; n = $f.n; p = $f.p; sa = $f.sa; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.readLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, $ifaceNil, err];
}
$deferred.push([$methodVal(fd, "readUnlock"), []]);
err$1 = fd.pd.prepareRead(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [0, $ifaceNil, err$1];
}
while (true) {
_tuple = syscall.Recvfrom(fd.Sysfd, p, 0);
n = _tuple[0];
sa = _tuple[1];
err$2 = _tuple[2];
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
n = 0;
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
err$2 = fd.pd.waitRead(fd.isFile);
if ($interfaceIsEqual(err$2, $ifaceNil)) {
continue;
}
}
}
err$2 = fd.eofError(n, err$2);
$s = -1; return [n, sa, err$2];
}
$s = -1; return [0, $ifaceNil, $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.ReadFrom }; } $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.n = n; $f.p = p; $f.sa = sa; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.ReadFrom = function(p) { return this.$val.ReadFrom(p); };
FD.ptr.prototype.ReadMsg = function(p, oob) {
var _tuple, err, err$1, err$2, fd, flags, n, oob, oobn, p, sa, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; flags = $f.flags; n = $f.n; oob = $f.oob; oobn = $f.oobn; p = $f.p; sa = $f.sa; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.readLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, 0, 0, $ifaceNil, err];
}
$deferred.push([$methodVal(fd, "readUnlock"), []]);
err$1 = fd.pd.prepareRead(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [0, 0, 0, $ifaceNil, err$1];
}
while (true) {
_tuple = syscall.Recvmsg(fd.Sysfd, p, oob, 0);
n = _tuple[0];
oobn = _tuple[1];
flags = _tuple[2];
sa = _tuple[3];
err$2 = _tuple[4];
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
err$2 = fd.pd.waitRead(fd.isFile);
if ($interfaceIsEqual(err$2, $ifaceNil)) {
continue;
}
}
}
err$2 = fd.eofError(n, err$2);
$s = -1; return [n, oobn, flags, sa, err$2];
}
$s = -1; return [0, 0, 0, $ifaceNil, $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, 0, 0, $ifaceNil, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.ReadMsg }; } $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.flags = flags; $f.n = n; $f.oob = oob; $f.oobn = oobn; $f.p = p; $f.sa = sa; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.ReadMsg = function(p, oob) { return this.$val.ReadMsg(p, oob); };
FD.ptr.prototype.Write = function(p) {
var _tuple, err, err$1, err$2, fd, max, n, nn, p, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; max = $f.max; n = $f.n; nn = $f.nn; p = $f.p; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.writeLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, err];
}
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
err$1 = fd.pd.prepareWrite(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [0, err$1];
}
nn = 0;
while (true) {
max = p.$length;
if (fd.IsStream && (max - nn >> 0) > 1073741824) {
max = nn + 1073741824 >> 0;
}
_tuple = syscall.Write(fd.Sysfd, $subslice(p, nn, max));
n = _tuple[0];
err$2 = _tuple[1];
if (n > 0) {
nn = nn + (n) >> 0;
}
if (nn === p.$length) {
$s = -1; return [nn, err$2];
}
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
err$2 = fd.pd.waitWrite(fd.isFile);
if ($interfaceIsEqual(err$2, $ifaceNil)) {
continue;
}
}
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
$s = -1; return [nn, err$2];
}
if (n === 0) {
$s = -1; return [nn, io.ErrUnexpectedEOF];
}
}
$s = -1; return [0, $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Write }; } $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.max = max; $f.n = n; $f.nn = nn; $f.p = p; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Write = function(p) { return this.$val.Write(p); };
FD.ptr.prototype.Pwrite = function(p, off) {
var _tuple, err, err$1, fd, max, n, nn, off, p, x, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; fd = $f.fd; max = $f.max; n = $f.n; nn = $f.nn; off = $f.off; p = $f.p; x = $f.x; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, err];
}
$deferred.push([$methodVal(fd, "decref"), []]);
nn = 0;
while (true) {
max = p.$length;
if (fd.IsStream && (max - nn >> 0) > 1073741824) {
max = nn + 1073741824 >> 0;
}
_tuple = syscall.Pwrite(fd.Sysfd, $subslice(p, nn, max), (x = (new $Int64(0, nn)), new $Int64(off.$high + x.$high, off.$low + x.$low)));
n = _tuple[0];
err$1 = _tuple[1];
if (n > 0) {
nn = nn + (n) >> 0;
}
if (nn === p.$length) {
$s = -1; return [nn, err$1];
}
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [nn, err$1];
}
if (n === 0) {
$s = -1; return [nn, io.ErrUnexpectedEOF];
}
}
$s = -1; return [0, $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Pwrite }; } $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.fd = fd; $f.max = max; $f.n = n; $f.nn = nn; $f.off = off; $f.p = p; $f.x = x; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Pwrite = function(p, off) { return this.$val.Pwrite(p, off); };
FD.ptr.prototype.WriteTo = function(p, sa) {
var _r, err, err$1, err$2, fd, p, sa, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; p = $f.p; sa = $f.sa; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.writeLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, err];
}
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
err$1 = fd.pd.prepareWrite(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [0, err$1];
}
/* while (true) { */ case 1:
_r = syscall.Sendto(fd.Sysfd, p, 0, sa); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
err$2 = _r;
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
err$2 = fd.pd.waitWrite(fd.isFile);
if ($interfaceIsEqual(err$2, $ifaceNil)) {
/* continue; */ $s = 1; continue;
}
}
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
$s = -1; return [0, err$2];
}
$s = -1; return [p.$length, $ifaceNil];
/* } */ $s = 1; continue; case 2:
$s = -1; return [0, $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.WriteTo }; } $f._r = _r; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.p = p; $f.sa = sa; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.WriteTo = function(p, sa) { return this.$val.WriteTo(p, sa); };
FD.ptr.prototype.WriteMsg = function(p, oob, sa) {
var _r, _tuple, err, err$1, err$2, fd, n, oob, p, sa, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; n = $f.n; oob = $f.oob; p = $f.p; sa = $f.sa; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.writeLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, 0, err];
}
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
err$1 = fd.pd.prepareWrite(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [0, 0, err$1];
}
/* while (true) { */ case 1:
_r = syscall.SendmsgN(fd.Sysfd, p, oob, sa, 0); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
err$2 = _tuple[1];
if ($interfaceIsEqual(err$2, new syscall.Errno(11)) && fd.pd.pollable()) {
err$2 = fd.pd.waitWrite(fd.isFile);
if ($interfaceIsEqual(err$2, $ifaceNil)) {
/* continue; */ $s = 1; continue;
}
}
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
$s = -1; return [n, 0, err$2];
}
$s = -1; return [n, oob.$length, err$2];
/* } */ $s = 1; continue; case 2:
$s = -1; return [0, 0, $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, 0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.WriteMsg }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.n = n; $f.oob = oob; $f.p = p; $f.sa = sa; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.WriteMsg = function(p, oob, sa) { return this.$val.WriteMsg(p, oob, sa); };
FD.ptr.prototype.Accept = function() {
var _1, _r, _tuple, err, err$1, err$2, errcall, fd, rsa, s, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _tuple = $f._tuple; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; errcall = $f.errcall; fd = $f.fd; rsa = $f.rsa; s = $f.s; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.readLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [-1, $ifaceNil, "", err];
}
$deferred.push([$methodVal(fd, "readUnlock"), []]);
err$1 = fd.pd.prepareRead(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [-1, $ifaceNil, "", err$1];
}
/* while (true) { */ case 1:
_r = accept(fd.Sysfd); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
s = _tuple[0];
rsa = _tuple[1];
errcall = _tuple[2];
err$2 = _tuple[3];
if ($interfaceIsEqual(err$2, $ifaceNil)) {
$s = -1; return [s, rsa, "", err$2];
}
_1 = err$2;
if ($interfaceIsEqual(_1, new syscall.Errno((11)))) {
if (fd.pd.pollable()) {
err$2 = fd.pd.waitRead(fd.isFile);
if ($interfaceIsEqual(err$2, $ifaceNil)) {
/* continue; */ $s = 1; continue;
}
}
} else if ($interfaceIsEqual(_1, new syscall.Errno((103)))) {
/* continue; */ $s = 1; continue;
}
$s = -1; return [-1, $ifaceNil, errcall, err$2];
/* } */ $s = 1; continue; case 2:
$s = -1; return [0, $ifaceNil, "", $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil, "", $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Accept }; } $f._1 = _1; $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.errcall = errcall; $f.fd = fd; $f.rsa = rsa; $f.s = s; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Accept = function() { return this.$val.Accept(); };
FD.ptr.prototype.Seek = function(offset, whence) {
var err, fd, offset, whence, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; offset = $f.offset; whence = $f.whence; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [new $Int64(0, 0), err];
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.Seek(fd.Sysfd, offset, whence);
/* */ } return; } } catch(err) { $err = err; $s = -1; return [new $Int64(0, 0), $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Seek }; } $f.err = err; $f.fd = fd; $f.offset = offset; $f.whence = whence; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Seek = function(offset, whence) { return this.$val.Seek(offset, whence); };
FD.ptr.prototype.ReadDirent = function(buf) {
var _tuple, buf, err, err$1, fd, n, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; buf = $f.buf; err = $f.err; err$1 = $f.err$1; fd = $f.fd; n = $f.n; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [0, err];
}
$deferred.push([$methodVal(fd, "decref"), []]);
while (true) {
_tuple = syscall.ReadDirent(fd.Sysfd, buf);
n = _tuple[0];
err$1 = _tuple[1];
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
n = 0;
if ($interfaceIsEqual(err$1, new syscall.Errno(11)) && fd.pd.pollable()) {
err$1 = fd.pd.waitRead(fd.isFile);
if ($interfaceIsEqual(err$1, $ifaceNil)) {
continue;
}
}
}
$s = -1; return [n, err$1];
}
$s = -1; return [0, $ifaceNil];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [0, $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.ReadDirent }; } $f._tuple = _tuple; $f.buf = buf; $f.err = err; $f.err$1 = err$1; $f.fd = fd; $f.n = n; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.ReadDirent = function(buf) { return this.$val.ReadDirent(buf); };
FD.ptr.prototype.Fchdir = function() {
var err, fd, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.Fchdir(fd.Sysfd);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fchdir }; } $f.err = err; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Fchdir = function() { return this.$val.Fchdir(); };
FD.ptr.prototype.Fstat = function(s) {
var err, fd, s, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; s = $f.s; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.Fstat(fd.Sysfd, s);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Fstat }; } $f.err = err; $f.fd = fd; $f.s = s; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Fstat = function(s) { return this.$val.Fstat(s); };
FD.ptr.prototype.WaitWrite = function() {
var fd;
fd = this;
return fd.pd.waitWrite(fd.isFile);
};
FD.prototype.WaitWrite = function() { return this.$val.WaitWrite(); };
FD.ptr.prototype.RawControl = function(f) {
var err, f, fd, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; f = $f.f; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$r = f(((fd.Sysfd >>> 0))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$s = -1; return $ifaceNil;
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.RawControl }; } $f.err = err; $f.f = f; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.RawControl = function(f) { return this.$val.RawControl(f); };
FD.ptr.prototype.RawRead = function(f) {
var _r, err, err$1, err$2, f, fd, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; f = $f.f; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.readLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "readUnlock"), []]);
err$1 = fd.pd.prepareRead(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return err$1;
}
/* while (true) { */ case 1:
_r = f(((fd.Sysfd >>> 0))); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (_r) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (_r) { */ case 3:
$s = -1; return $ifaceNil;
/* } */ case 4:
err$2 = fd.pd.waitRead(fd.isFile);
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
$s = -1; return err$2;
}
/* } */ $s = 1; continue; case 2:
$s = -1; return $ifaceNil;
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.RawRead }; } $f._r = _r; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.f = f; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.RawRead = function(f) { return this.$val.RawRead(f); };
FD.ptr.prototype.RawWrite = function(f) {
var _r, err, err$1, err$2, f, fd, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; f = $f.f; fd = $f.fd; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.writeLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
err$1 = fd.pd.prepareWrite(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return err$1;
}
/* while (true) { */ case 1:
_r = f(((fd.Sysfd >>> 0))); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (_r) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (_r) { */ case 3:
$s = -1; return $ifaceNil;
/* } */ case 4:
err$2 = fd.pd.waitWrite(fd.isFile);
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
$s = -1; return err$2;
}
/* } */ $s = 1; continue; case 2:
$s = -1; return $ifaceNil;
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.RawWrite }; } $f._r = _r; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.f = f; $f.fd = fd; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.RawWrite = function(f) { return this.$val.RawWrite(f); };
accept = function(s) {
var _1, _r, _r$1, _r$2, _tuple, _tuple$1, err, ns, s, sa, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; err = $f.err; ns = $f.ns; s = $f.s; sa = $f.sa; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = $pkg.Accept4Func(s, 526336); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
ns = _tuple[0];
sa = _tuple[1];
err = _tuple[2];
_1 = err;
if ($interfaceIsEqual(_1, $ifaceNil)) {
$s = -1; return [ns, sa, "", $ifaceNil];
} else if ($interfaceIsEqual(_1, new syscall.Errno((38)))) {
} else if ($interfaceIsEqual(_1, new syscall.Errno((22)))) {
} else if ($interfaceIsEqual(_1, new syscall.Errno((13)))) {
} else if ($interfaceIsEqual(_1, new syscall.Errno((14)))) {
} else {
$s = -1; return [-1, sa, "accept4", err];
}
_r$1 = $pkg.AcceptFunc(s); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple$1 = _r$1;
ns = _tuple$1[0];
sa = _tuple$1[1];
err = _tuple$1[2];
if ($interfaceIsEqual(err, $ifaceNil)) {
syscall.CloseOnExec(ns);
}
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [-1, $ifaceNil, "accept", err];
}
err = syscall.SetNonblock(ns, true);
/* */ if (!($interfaceIsEqual(err, $ifaceNil))) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (!($interfaceIsEqual(err, $ifaceNil))) { */ case 3:
_r$2 = $pkg.CloseFunc(ns); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_r$2;
$s = -1; return [-1, $ifaceNil, "setnonblock", err];
/* } */ case 4:
$s = -1; return [ns, sa, "", $ifaceNil];
/* */ } return; } if ($f === undefined) { $f = { $blk: accept }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.err = err; $f.ns = ns; $f.s = s; $f.sa = sa; $f.$s = $s; $f.$r = $r; return $f;
};
FD.ptr.prototype.SetsockoptInt = function(level, name, arg) {
var arg, err, fd, level, name, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; arg = $f.arg; err = $f.err; fd = $f.fd; level = $f.level; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.SetsockoptInt(fd.Sysfd, level, name, arg);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptInt }; } $f.arg = arg; $f.err = err; $f.fd = fd; $f.level = level; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.SetsockoptInt = function(level, name, arg) { return this.$val.SetsockoptInt(level, name, arg); };
FD.ptr.prototype.SetsockoptInet4Addr = function(level, name, arg) {
var arg, err, fd, level, name, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; arg = $f.arg; err = $f.err; fd = $f.fd; level = $f.level; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.SetsockoptInet4Addr(fd.Sysfd, level, name, $clone(arg, arrayType));
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptInet4Addr }; } $f.arg = arg; $f.err = err; $f.fd = fd; $f.level = level; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.SetsockoptInet4Addr = function(level, name, arg) { return this.$val.SetsockoptInet4Addr(level, name, arg); };
FD.ptr.prototype.SetsockoptLinger = function(level, name, l) {
var err, fd, l, level, name, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; l = $f.l; level = $f.level; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.SetsockoptLinger(fd.Sysfd, level, name, l);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptLinger }; } $f.err = err; $f.fd = fd; $f.l = l; $f.level = level; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.SetsockoptLinger = function(level, name, l) { return this.$val.SetsockoptLinger(level, name, l); };
FD.ptr.prototype.SetsockoptIPMreqn = function(level, name, mreq) {
var err, fd, level, mreq, name, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; level = $f.level; mreq = $f.mreq; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.SetsockoptIPMreqn(fd.Sysfd, level, name, mreq);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptIPMreqn }; } $f.err = err; $f.fd = fd; $f.level = level; $f.mreq = mreq; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.SetsockoptIPMreqn = function(level, name, mreq) { return this.$val.SetsockoptIPMreqn(level, name, mreq); };
FD.ptr.prototype.SetsockoptByte = function(level, name, arg) {
var arg, err, fd, level, name, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; arg = $f.arg; err = $f.err; fd = $f.fd; level = $f.level; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.SetsockoptByte(fd.Sysfd, level, name, arg);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptByte }; } $f.arg = arg; $f.err = err; $f.fd = fd; $f.level = level; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.SetsockoptByte = function(level, name, arg) { return this.$val.SetsockoptByte(level, name, arg); };
FD.ptr.prototype.SetsockoptIPMreq = function(level, name, mreq) {
var err, fd, level, mreq, name, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; level = $f.level; mreq = $f.mreq; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.SetsockoptIPMreq(fd.Sysfd, level, name, mreq);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptIPMreq }; } $f.err = err; $f.fd = fd; $f.level = level; $f.mreq = mreq; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.SetsockoptIPMreq = function(level, name, mreq) { return this.$val.SetsockoptIPMreq(level, name, mreq); };
FD.ptr.prototype.SetsockoptIPv6Mreq = function(level, name, mreq) {
var err, fd, level, mreq, name, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; err = $f.err; fd = $f.fd; level = $f.level; mreq = $f.mreq; name = $f.name; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
fd = this;
err = fd.incref();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
$deferred.push([$methodVal(fd, "decref"), []]);
$s = -1; return syscall.SetsockoptIPv6Mreq(fd.Sysfd, level, name, mreq);
/* */ } return; } } catch(err) { $err = err; $s = -1; return $ifaceNil; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.SetsockoptIPv6Mreq }; } $f.err = err; $f.fd = fd; $f.level = level; $f.mreq = mreq; $f.name = name; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.SetsockoptIPv6Mreq = function(level, name, mreq) { return this.$val.SetsockoptIPv6Mreq(level, name, mreq); };
FD.ptr.prototype.Writev = function(v) {
var _i, _ref, _tuple, chunk, e0, err, err$1, err$2, fd, iovecs, maxVec, n, v, wrote, x, x$1, x$2, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _ref = $f._ref; _tuple = $f._tuple; chunk = $f.chunk; e0 = $f.e0; err = $f.err; err$1 = $f.err$1; err$2 = $f.err$2; fd = $f.fd; iovecs = $f.iovecs; maxVec = $f.maxVec; n = $f.n; v = $f.v; wrote = $f.wrote; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
iovecs = [iovecs];
fd = this;
err = fd.writeLock();
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [new $Int64(0, 0), err];
}
$deferred.push([$methodVal(fd, "writeUnlock"), []]);
err$1 = fd.pd.prepareWrite(fd.isFile);
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
$s = -1; return [new $Int64(0, 0), err$1];
}
iovecs[0] = sliceType.nil;
if (!(fd.iovecs === ptrType$3.nil)) {
iovecs[0] = fd.iovecs.$get();
}
maxVec = 1024;
n = new $Int64(0, 0);
err$2 = $ifaceNil;
/* while (true) { */ case 1:
/* if (!(v.$get().$length > 0)) { break; } */ if(!(v.$get().$length > 0)) { $s = 2; continue; }
iovecs[0] = $subslice(iovecs[0], 0, 0);
_ref = v.$get();
_i = 0;
/* while (true) { */ case 3:
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 4; continue; }
chunk = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
if (chunk.$length === 0) {
_i++;
/* continue; */ $s = 3; continue;
}
iovecs[0] = $append(iovecs[0], new syscall.Iovec.ptr($indexPtr(chunk.$array, chunk.$offset + 0, ptrType$4), new $Uint64(0, 0)));
if (fd.IsStream && chunk.$length > 1073741824) {
(x = iovecs[0].$length - 1 >> 0, ((x < 0 || x >= iovecs[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : iovecs[0].$array[iovecs[0].$offset + x])).SetLen(1073741824);
/* break; */ $s = 4; continue;
}
(x$1 = iovecs[0].$length - 1 >> 0, ((x$1 < 0 || x$1 >= iovecs[0].$length) ? ($throwRuntimeError("index out of range"), undefined) : iovecs[0].$array[iovecs[0].$offset + x$1])).SetLen(chunk.$length);
if (iovecs[0].$length === maxVec) {
/* break; */ $s = 4; continue;
}
_i++;
/* } */ $s = 3; continue; case 4:
if (iovecs[0].$length === 0) {
/* break; */ $s = 2; continue;
}
fd.iovecs = (iovecs.$ptr || (iovecs.$ptr = new ptrType$3(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, iovecs)));
_tuple = syscall.Syscall(20, ((fd.Sysfd >>> 0)), (($sliceToArray(iovecs[0]))), ((iovecs[0].$length >>> 0)));
wrote = _tuple[0];
e0 = _tuple[2];
if (wrote === 4294967295) {
wrote = 0;
}
$r = $pkg.TestHookDidWritev(((wrote >> 0))); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
n = (x$2 = (new $Int64(0, wrote.constructor === Number ? wrote : 1)), new $Int64(n.$high + x$2.$high, n.$low + x$2.$low));
consume(v, (new $Int64(0, wrote.constructor === Number ? wrote : 1)));
if (e0 === 11) {
err$2 = fd.pd.waitWrite(fd.isFile);
if ($interfaceIsEqual(err$2, $ifaceNil)) {
/* continue; */ $s = 1; continue;
}
} else if (!((e0 === 0))) {
err$2 = new syscall.Errno((e0));
}
if (!($interfaceIsEqual(err$2, $ifaceNil))) {
/* break; */ $s = 2; continue;
}
if ((n.$high === 0 && n.$low === 0)) {
err$2 = io.ErrUnexpectedEOF;
/* break; */ $s = 2; continue;
}
/* } */ $s = 1; continue; case 2:
$s = -1; return [n, err$2];
/* */ } return; } } catch(err) { $err = err; $s = -1; return [new $Int64(0, 0), $ifaceNil]; } finally { $callDeferred($deferred, $err); if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: FD.ptr.prototype.Writev }; } $f._i = _i; $f._ref = _ref; $f._tuple = _tuple; $f.chunk = chunk; $f.e0 = e0; $f.err = err; $f.err$1 = err$1; $f.err$2 = err$2; $f.fd = fd; $f.iovecs = iovecs; $f.maxVec = maxVec; $f.n = n; $f.v = v; $f.wrote = wrote; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
FD.prototype.Writev = function(v) { return this.$val.Writev(v); };
ptrType$6.methods = [{prop: "init", name: "init", pkg: "internal/poll", typ: $funcType([ptrType$5], [$error], false)}, {prop: "close", name: "close", pkg: "internal/poll", typ: $funcType([], [], false)}, {prop: "evict", name: "evict", pkg: "internal/poll", typ: $funcType([], [], false)}, {prop: "prepare", name: "prepare", pkg: "internal/poll", typ: $funcType([$Int, $Bool], [$error], false)}, {prop: "prepareRead", name: "prepareRead", pkg: "internal/poll", typ: $funcType([$Bool], [$error], false)}, {prop: "prepareWrite", name: "prepareWrite", pkg: "internal/poll", typ: $funcType([$Bool], [$error], false)}, {prop: "wait", name: "wait", pkg: "internal/poll", typ: $funcType([$Int, $Bool], [$error], false)}, {prop: "waitRead", name: "waitRead", pkg: "internal/poll", typ: $funcType([$Bool], [$error], false)}, {prop: "waitWrite", name: "waitWrite", pkg: "internal/poll", typ: $funcType([$Bool], [$error], false)}, {prop: "waitCanceled", name: "waitCanceled", pkg: "internal/poll", typ: $funcType([$Int], [], false)}, {prop: "pollable", name: "pollable", pkg: "internal/poll", typ: $funcType([], [$Bool], false)}];
ptrType$7.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Timeout", name: "Timeout", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Temporary", name: "Temporary", pkg: "", typ: $funcType([], [$Bool], false)}];
ptrType$8.methods = [{prop: "incref", name: "incref", pkg: "internal/poll", typ: $funcType([], [$Bool], false)}, {prop: "increfAndClose", name: "increfAndClose", pkg: "internal/poll", typ: $funcType([], [$Bool], false)}, {prop: "decref", name: "decref", pkg: "internal/poll", typ: $funcType([], [$Bool], false)}, {prop: "rwlock", name: "rwlock", pkg: "internal/poll", typ: $funcType([$Bool], [$Bool], false)}, {prop: "rwunlock", name: "rwunlock", pkg: "internal/poll", typ: $funcType([$Bool], [$Bool], false)}];
ptrType$5.methods = [{prop: "SetDeadline", name: "SetDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetReadDeadline", name: "SetReadDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "SetWriteDeadline", name: "SetWriteDeadline", pkg: "", typ: $funcType([time.Time], [$error], false)}, {prop: "incref", name: "incref", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "decref", name: "decref", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "readLock", name: "readLock", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "readUnlock", name: "readUnlock", pkg: "internal/poll", typ: $funcType([], [], false)}, {prop: "writeLock", name: "writeLock", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "writeUnlock", name: "writeUnlock", pkg: "internal/poll", typ: $funcType([], [], false)}, {prop: "eofError", name: "eofError", pkg: "internal/poll", typ: $funcType([$Int, $error], [$error], false)}, {prop: "Fchmod", name: "Fchmod", pkg: "", typ: $funcType([$Uint32], [$error], false)}, {prop: "Fchown", name: "Fchown", pkg: "", typ: $funcType([$Int, $Int], [$error], false)}, {prop: "Ftruncate", name: "Ftruncate", pkg: "", typ: $funcType([$Int64], [$error], false)}, {prop: "Fsync", name: "Fsync", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Init", name: "Init", pkg: "", typ: $funcType([$String, $Bool], [$error], false)}, {prop: "destroy", name: "destroy", pkg: "internal/poll", typ: $funcType([], [$error], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Shutdown", name: "Shutdown", pkg: "", typ: $funcType([$Int], [$error], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "Pread", name: "Pread", pkg: "", typ: $funcType([sliceType$1, $Int64], [$Int, $error], false)}, {prop: "ReadFrom", name: "ReadFrom", pkg: "", typ: $funcType([sliceType$1], [$Int, syscall.Sockaddr, $error], false)}, {prop: "ReadMsg", name: "ReadMsg", pkg: "", typ: $funcType([sliceType$1, sliceType$1], [$Int, $Int, $Int, syscall.Sockaddr, $error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "Pwrite", name: "Pwrite", pkg: "", typ: $funcType([sliceType$1, $Int64], [$Int, $error], false)}, {prop: "WriteTo", name: "WriteTo", pkg: "", typ: $funcType([sliceType$1, syscall.Sockaddr], [$Int, $error], false)}, {prop: "WriteMsg", name: "WriteMsg", pkg: "", typ: $funcType([sliceType$1, sliceType$1, syscall.Sockaddr], [$Int, $Int, $error], false)}, {prop: "Accept", name: "Accept", pkg: "", typ: $funcType([], [$Int, syscall.Sockaddr, $String, $error], false)}, {prop: "Seek", name: "Seek", pkg: "", typ: $funcType([$Int64, $Int], [$Int64, $error], false)}, {prop: "ReadDirent", name: "ReadDirent", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}, {prop: "Fchdir", name: "Fchdir", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Fstat", name: "Fstat", pkg: "", typ: $funcType([ptrType$9], [$error], false)}, {prop: "WaitWrite", name: "WaitWrite", pkg: "", typ: $funcType([], [$error], false)}, {prop: "RawControl", name: "RawControl", pkg: "", typ: $funcType([funcType], [$error], false)}, {prop: "RawRead", name: "RawRead", pkg: "", typ: $funcType([funcType$1], [$error], false)}, {prop: "RawWrite", name: "RawWrite", pkg: "", typ: $funcType([funcType$1], [$error], false)}, {prop: "SetsockoptInt", name: "SetsockoptInt", pkg: "", typ: $funcType([$Int, $Int, $Int], [$error], false)}, {prop: "SetsockoptInet4Addr", name: "SetsockoptInet4Addr", pkg: "", typ: $funcType([$Int, $Int, arrayType], [$error], false)}, {prop: "SetsockoptLinger", name: "SetsockoptLinger", pkg: "", typ: $funcType([$Int, $Int, ptrType$10], [$error], false)}, {prop: "SetsockoptIPMreqn", name: "SetsockoptIPMreqn", pkg: "", typ: $funcType([$Int, $Int, ptrType$11], [$error], false)}, {prop: "SetsockoptByte", name: "SetsockoptByte", pkg: "", typ: $funcType([$Int, $Int, $Uint8], [$error], false)}, {prop: "SetsockoptIPMreq", name: "SetsockoptIPMreq", pkg: "", typ: $funcType([$Int, $Int, ptrType$12], [$error], false)}, {prop: "SetsockoptIPv6Mreq", name: "SetsockoptIPv6Mreq", pkg: "", typ: $funcType([$Int, $Int, ptrType$13], [$error], false)}, {prop: "Writev", name: "Writev", pkg: "", typ: $funcType([ptrType$14], [$Int64, $error], false)}];
pollDesc.init("internal/poll", [{prop: "closing", name: "closing", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
TimeoutError.init("", []);
fdMutex.init("internal/poll", [{prop: "state", name: "state", anonymous: false, exported: false, typ: $Uint64, tag: ""}, {prop: "rsema", name: "rsema", anonymous: false, exported: false, typ: $Uint32, tag: ""}, {prop: "wsema", name: "wsema", anonymous: false, exported: false, typ: $Uint32, tag: ""}]);
FD.init("internal/poll", [{prop: "fdmu", name: "fdmu", anonymous: false, exported: false, typ: fdMutex, tag: ""}, {prop: "Sysfd", name: "Sysfd", anonymous: false, exported: true, typ: $Int, tag: ""}, {prop: "pd", name: "pd", anonymous: false, exported: false, typ: pollDesc, tag: ""}, {prop: "iovecs", name: "iovecs", anonymous: false, exported: false, typ: ptrType$3, tag: ""}, {prop: "IsStream", name: "IsStream", anonymous: false, exported: true, typ: $Bool, tag: ""}, {prop: "ZeroReadIsEOF", name: "ZeroReadIsEOF", anonymous: false, exported: true, typ: $Bool, tag: ""}, {prop: "isFile", name: "isFile", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = io.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = atomic.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = syscall.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = time.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$pkg.ErrNetClosing = errors.New("use of closed network connection");
$pkg.ErrFileClosing = errors.New("use of closed file");
$pkg.ErrTimeout = new TimeoutError.ptr();
$pkg.TestHookDidWritev = (function(wrote) {
var wrote;
});
$pkg.Accept4Func = syscall.Accept4;
$pkg.CloseFunc = syscall.Close;
$pkg.AcceptFunc = syscall.Accept;
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["os"] = (function() {
var $pkg = {}, $init, errors, js, poll, io, runtime, sync, atomic, syscall, time, PathError, SyscallError, LinkError, file, dirInfo, File, FileInfo, FileMode, fileStat, sliceType, ptrType, sliceType$1, ptrType$1, sliceType$2, ptrType$2, ptrType$3, ptrType$4, sliceType$5, ptrType$12, ptrType$13, funcType$1, ptrType$15, arrayType$2, arrayType$5, ptrType$16, errFinished, lstat, runtime_args, init, NewSyscallError, IsNotExist, underlyingError, wrapSyscallError, isNotExist, sigpipe, syscallMode, NewFile, newFile, epipecheck, basename, init$1, fillFileStatFromSys, timespecToTime, Lstat;
errors = $packages["errors"];
js = $packages["github.com/gopherjs/gopherjs/js"];
poll = $packages["internal/poll"];
io = $packages["io"];
runtime = $packages["runtime"];
sync = $packages["sync"];
atomic = $packages["sync/atomic"];
syscall = $packages["syscall"];
time = $packages["time"];
PathError = $pkg.PathError = $newType(0, $kindStruct, "os.PathError", true, "os", true, function(Op_, Path_, Err_) {
this.$val = this;
if (arguments.length === 0) {
this.Op = "";
this.Path = "";
this.Err = $ifaceNil;
return;
}
this.Op = Op_;
this.Path = Path_;
this.Err = Err_;
});
SyscallError = $pkg.SyscallError = $newType(0, $kindStruct, "os.SyscallError", true, "os", true, function(Syscall_, Err_) {
this.$val = this;
if (arguments.length === 0) {
this.Syscall = "";
this.Err = $ifaceNil;
return;
}
this.Syscall = Syscall_;
this.Err = Err_;
});
LinkError = $pkg.LinkError = $newType(0, $kindStruct, "os.LinkError", true, "os", true, function(Op_, Old_, New_, Err_) {
this.$val = this;
if (arguments.length === 0) {
this.Op = "";
this.Old = "";
this.New = "";
this.Err = $ifaceNil;
return;
}
this.Op = Op_;
this.Old = Old_;
this.New = New_;
this.Err = Err_;
});
file = $pkg.file = $newType(0, $kindStruct, "os.file", true, "os", false, function(pfd_, name_, dirinfo_, nonblock_) {
this.$val = this;
if (arguments.length === 0) {
this.pfd = new poll.FD.ptr(new poll.fdMutex.ptr(new $Uint64(0, 0), 0, 0), 0, new poll.pollDesc.ptr(false), ptrType$12.nil, false, false, false);
this.name = "";
this.dirinfo = ptrType$1.nil;
this.nonblock = false;
return;
}
this.pfd = pfd_;
this.name = name_;
this.dirinfo = dirinfo_;
this.nonblock = nonblock_;
});
dirInfo = $pkg.dirInfo = $newType(0, $kindStruct, "os.dirInfo", true, "os", false, function(buf_, nbuf_, bufp_) {
this.$val = this;
if (arguments.length === 0) {
this.buf = sliceType$2.nil;
this.nbuf = 0;
this.bufp = 0;
return;
}
this.buf = buf_;
this.nbuf = nbuf_;
this.bufp = bufp_;
});
File = $pkg.File = $newType(0, $kindStruct, "os.File", true, "os", true, function(file_) {
this.$val = this;
if (arguments.length === 0) {
this.file = ptrType$13.nil;
return;
}
this.file = file_;
});
FileInfo = $pkg.FileInfo = $newType(8, $kindInterface, "os.FileInfo", true, "os", true, null);
FileMode = $pkg.FileMode = $newType(4, $kindUint32, "os.FileMode", true, "os", true, null);
fileStat = $pkg.fileStat = $newType(0, $kindStruct, "os.fileStat", true, "os", false, function(name_, size_, mode_, modTime_, sys_) {
this.$val = this;
if (arguments.length === 0) {
this.name = "";
this.size = new $Int64(0, 0);
this.mode = 0;
this.modTime = new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$15.nil);
this.sys = new syscall.Stat_t.ptr(new $Uint64(0, 0), new $Uint64(0, 0), new $Uint64(0, 0), 0, 0, 0, 0, new $Uint64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), arrayType$2.zero());
return;
}
this.name = name_;
this.size = size_;
this.mode = mode_;
this.modTime = modTime_;
this.sys = sys_;
});
sliceType = $sliceType($String);
ptrType = $ptrType(File);
sliceType$1 = $sliceType(FileInfo);
ptrType$1 = $ptrType(dirInfo);
sliceType$2 = $sliceType($Uint8);
ptrType$2 = $ptrType(PathError);
ptrType$3 = $ptrType(LinkError);
ptrType$4 = $ptrType(SyscallError);
sliceType$5 = $sliceType(syscall.Iovec);
ptrType$12 = $ptrType(sliceType$5);
ptrType$13 = $ptrType(file);
funcType$1 = $funcType([ptrType$13], [$error], false);
ptrType$15 = $ptrType(time.Location);
arrayType$2 = $arrayType($Int64, 3);
arrayType$5 = $arrayType($Uint8, 32);
ptrType$16 = $ptrType(fileStat);
runtime_args = function() {
return $pkg.Args;
};
init = function() {
var argv, i, process;
process = $global.process;
if (!(process === undefined)) {
argv = process.argv;
$pkg.Args = $makeSlice(sliceType, ($parseInt(argv.length) - 1 >> 0));
i = 0;
while (true) {
if (!(i < ($parseInt(argv.length) - 1 >> 0))) { break; }
((i < 0 || i >= $pkg.Args.$length) ? ($throwRuntimeError("index out of range"), undefined) : $pkg.Args.$array[$pkg.Args.$offset + i] = $internalize(argv[(i + 1 >> 0)], $String));
i = i + (1) >> 0;
}
}
if ($pkg.Args.$length === 0) {
$pkg.Args = new sliceType(["?"]);
}
};
File.ptr.prototype.Readdir = function(n) {
var _r, f, n, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = this;
if (f === ptrType.nil) {
$s = -1; return [sliceType$1.nil, $pkg.ErrInvalid];
}
_r = f.readdir(n); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Readdir }; } $f._r = _r; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Readdir = function(n) { return this.$val.Readdir(n); };
File.ptr.prototype.Readdirnames = function(n) {
var _r, _tmp, _tmp$1, _tuple, err, f, n, names, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; err = $f.err; f = $f.f; n = $f.n; names = $f.names; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
names = sliceType.nil;
err = $ifaceNil;
f = this;
if (f === ptrType.nil) {
_tmp = sliceType.nil;
_tmp$1 = $pkg.ErrInvalid;
names = _tmp;
err = _tmp$1;
$s = -1; return [names, err];
}
_r = f.readdirnames(n); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
names = _tuple[0];
err = _tuple[1];
$s = -1; return [names, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Readdirnames }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.err = err; $f.f = f; $f.n = n; $f.names = names; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Readdirnames = function(n) { return this.$val.Readdirnames(n); };
File.ptr.prototype.readdir = function(n) {
var _i, _r, _r$1, _ref, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, _tuple$1, dirname, err, f, fi, filename, fip, lerr, n, names, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; dirname = $f.dirname; err = $f.err; f = $f.f; fi = $f.fi; filename = $f.filename; fip = $f.fip; lerr = $f.lerr; n = $f.n; names = $f.names; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fi = sliceType$1.nil;
err = $ifaceNil;
f = this;
dirname = f.file.name;
if (dirname === "") {
dirname = ".";
}
_r = f.Readdirnames(n); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
names = _tuple[0];
err = _tuple[1];
fi = $makeSlice(sliceType$1, 0, names.$length);
_ref = names;
_i = 0;
/* while (true) { */ case 2:
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 3; continue; }
filename = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
_r$1 = lstat(dirname + "/" + filename); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple$1 = _r$1;
fip = _tuple$1[0];
lerr = _tuple$1[1];
if (IsNotExist(lerr)) {
_i++;
/* continue; */ $s = 2; continue;
}
if (!($interfaceIsEqual(lerr, $ifaceNil))) {
_tmp = fi;
_tmp$1 = lerr;
fi = _tmp;
err = _tmp$1;
$s = -1; return [fi, err];
}
fi = $append(fi, fip);
_i++;
/* } */ $s = 2; continue; case 3:
if ((fi.$length === 0) && $interfaceIsEqual(err, $ifaceNil) && n > 0) {
err = io.EOF;
}
_tmp$2 = fi;
_tmp$3 = err;
fi = _tmp$2;
err = _tmp$3;
$s = -1; return [fi, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.readdir }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.dirname = dirname; $f.err = err; $f.f = f; $f.fi = fi; $f.filename = filename; $f.fip = fip; $f.lerr = lerr; $f.n = n; $f.names = names; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.readdir = function(n) { return this.$val.readdir(n); };
File.ptr.prototype.readdirnames = function(n) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tuple, _tuple$1, d, err, errno, f, n, names, nb, nc, size, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tmp$6 = $f._tmp$6; _tmp$7 = $f._tmp$7; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; d = $f.d; err = $f.err; errno = $f.errno; f = $f.f; n = $f.n; names = $f.names; nb = $f.nb; nc = $f.nc; size = $f.size; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
names = sliceType.nil;
err = $ifaceNil;
f = this;
if (f.file.dirinfo === ptrType$1.nil) {
f.file.dirinfo = new dirInfo.ptr(sliceType$2.nil, 0, 0);
f.file.dirinfo.buf = $makeSlice(sliceType$2, 4096);
}
d = f.file.dirinfo;
size = n;
if (size <= 0) {
size = 100;
n = -1;
}
names = $makeSlice(sliceType, 0, size);
/* while (true) { */ case 1:
/* if (!(!((n === 0)))) { break; } */ if(!(!((n === 0)))) { $s = 2; continue; }
/* */ if (d.bufp >= d.nbuf) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (d.bufp >= d.nbuf) { */ case 3:
d.bufp = 0;
errno = $ifaceNil;
_r = f.file.pfd.ReadDirent(d.buf); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
d.nbuf = _tuple[0];
errno = _tuple[1];
runtime.KeepAlive(f);
if (!($interfaceIsEqual(errno, $ifaceNil))) {
_tmp = names;
_tmp$1 = wrapSyscallError("readdirent", errno);
names = _tmp;
err = _tmp$1;
$s = -1; return [names, err];
}
if (d.nbuf <= 0) {
/* break; */ $s = 2; continue;
}
/* } */ case 4:
_tmp$2 = 0;
_tmp$3 = 0;
nb = _tmp$2;
nc = _tmp$3;
_tuple$1 = syscall.ParseDirent($subslice(d.buf, d.bufp, d.nbuf), n, names);
nb = _tuple$1[0];
nc = _tuple$1[1];
names = _tuple$1[2];
d.bufp = d.bufp + (nb) >> 0;
n = n - (nc) >> 0;
/* } */ $s = 1; continue; case 2:
if (n >= 0 && (names.$length === 0)) {
_tmp$4 = names;
_tmp$5 = io.EOF;
names = _tmp$4;
err = _tmp$5;
$s = -1; return [names, err];
}
_tmp$6 = names;
_tmp$7 = $ifaceNil;
names = _tmp$6;
err = _tmp$7;
$s = -1; return [names, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.readdirnames }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tmp$6 = _tmp$6; $f._tmp$7 = _tmp$7; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.d = d; $f.err = err; $f.errno = errno; $f.f = f; $f.n = n; $f.names = names; $f.nb = nb; $f.nc = nc; $f.size = size; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.readdirnames = function(n) { return this.$val.readdirnames(n); };
PathError.ptr.prototype.Error = function() {
var _r, e, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
e = this;
_r = e.Err.Error(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return e.Op + " " + e.Path + ": " + _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: PathError.ptr.prototype.Error }; } $f._r = _r; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
};
PathError.prototype.Error = function() { return this.$val.Error(); };
SyscallError.ptr.prototype.Error = function() {
var _r, e, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
e = this;
_r = e.Err.Error(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return e.Syscall + ": " + _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: SyscallError.ptr.prototype.Error }; } $f._r = _r; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
};
SyscallError.prototype.Error = function() { return this.$val.Error(); };
NewSyscallError = function(syscall$1, err) {
var err, syscall$1;
if ($interfaceIsEqual(err, $ifaceNil)) {
return $ifaceNil;
}
return new SyscallError.ptr(syscall$1, err);
};
$pkg.NewSyscallError = NewSyscallError;
IsNotExist = function(err) {
var err;
return isNotExist(err);
};
$pkg.IsNotExist = IsNotExist;
underlyingError = function(err) {
var _ref, err, err$1, err$2, err$3;
_ref = err;
if ($assertType(_ref, ptrType$2, true)[1]) {
err$1 = _ref.$val;
return err$1.Err;
} else if ($assertType(_ref, ptrType$3, true)[1]) {
err$2 = _ref.$val;
return err$2.Err;
} else if ($assertType(_ref, ptrType$4, true)[1]) {
err$3 = _ref.$val;
return err$3.Err;
}
return err;
};
wrapSyscallError = function(name, err) {
var _tuple, err, name, ok;
_tuple = $assertType(err, syscall.Errno, true);
ok = _tuple[1];
if (ok) {
err = NewSyscallError(name, err);
}
return err;
};
isNotExist = function(err) {
var err;
err = underlyingError(err);
return $interfaceIsEqual(err, new syscall.Errno(2)) || $interfaceIsEqual(err, $pkg.ErrNotExist);
};
File.ptr.prototype.Name = function() {
var f;
f = this;
return f.file.name;
};
File.prototype.Name = function() { return this.$val.Name(); };
LinkError.ptr.prototype.Error = function() {
var _r, e, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
e = this;
_r = e.Err.Error(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return e.Op + " " + e.Old + " " + e.New + ": " + _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: LinkError.ptr.prototype.Error }; } $f._r = _r; $f.e = e; $f.$s = $s; $f.$r = $r; return $f;
};
LinkError.prototype.Error = function() { return this.$val.Error(); };
File.ptr.prototype.Read = function(b) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, e, err, err$1, f, n, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
err$1 = f.checkValid("read");
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
_tmp = 0;
_tmp$1 = err$1;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
}
_r = f.read(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
e = _tuple[1];
_tmp$2 = n;
_tmp$3 = f.wrapErr("read", e);
n = _tmp$2;
err = _tmp$3;
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Read }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Read = function(b) { return this.$val.Read(b); };
File.ptr.prototype.ReadAt = function(b, off) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, e, err, err$1, f, m, n, off, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; m = $f.m; n = $f.n; off = $f.off; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
err$1 = f.checkValid("read");
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
_tmp = 0;
_tmp$1 = err$1;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
}
if ((off.$high < 0 || (off.$high === 0 && off.$low < 0))) {
_tmp$2 = 0;
_tmp$3 = new PathError.ptr("readat", f.file.name, errors.New("negative offset"));
n = _tmp$2;
err = _tmp$3;
$s = -1; return [n, err];
}
/* while (true) { */ case 1:
/* if (!(b.$length > 0)) { break; } */ if(!(b.$length > 0)) { $s = 2; continue; }
_r = f.pread(b, off); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
m = _tuple[0];
e = _tuple[1];
if (!($interfaceIsEqual(e, $ifaceNil))) {
err = f.wrapErr("read", e);
/* break; */ $s = 2; continue;
}
n = n + (m) >> 0;
b = $subslice(b, m);
off = (x = (new $Int64(0, m)), new $Int64(off.$high + x.$high, off.$low + x.$low));
/* } */ $s = 1; continue; case 2:
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.ReadAt }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.m = m; $f.n = n; $f.off = off; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.ReadAt = function(b, off) { return this.$val.ReadAt(b, off); };
File.ptr.prototype.Write = function(b) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, e, err, err$1, f, n, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
err$1 = f.checkValid("write");
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
_tmp = 0;
_tmp$1 = err$1;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
}
_r = f.write(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
e = _tuple[1];
if (n < 0) {
n = 0;
}
if (!((n === b.$length))) {
err = io.ErrShortWrite;
}
epipecheck(f, e);
if (!($interfaceIsEqual(e, $ifaceNil))) {
err = f.wrapErr("write", e);
}
_tmp$2 = n;
_tmp$3 = err;
n = _tmp$2;
err = _tmp$3;
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Write }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Write = function(b) { return this.$val.Write(b); };
File.ptr.prototype.WriteAt = function(b, off) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, b, e, err, err$1, f, m, n, off, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tuple = $f._tuple; b = $f.b; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; m = $f.m; n = $f.n; off = $f.off; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
err$1 = f.checkValid("write");
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
_tmp = 0;
_tmp$1 = err$1;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
}
if ((off.$high < 0 || (off.$high === 0 && off.$low < 0))) {
_tmp$2 = 0;
_tmp$3 = new PathError.ptr("writeat", f.file.name, errors.New("negative offset"));
n = _tmp$2;
err = _tmp$3;
$s = -1; return [n, err];
}
/* while (true) { */ case 1:
/* if (!(b.$length > 0)) { break; } */ if(!(b.$length > 0)) { $s = 2; continue; }
_r = f.pwrite(b, off); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
m = _tuple[0];
e = _tuple[1];
if (!($interfaceIsEqual(e, $ifaceNil))) {
err = f.wrapErr("write", e);
/* break; */ $s = 2; continue;
}
n = n + (m) >> 0;
b = $subslice(b, m);
off = (x = (new $Int64(0, m)), new $Int64(off.$high + x.$high, off.$low + x.$low));
/* } */ $s = 1; continue; case 2:
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.WriteAt }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tuple = _tuple; $f.b = b; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.m = m; $f.n = n; $f.off = off; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.WriteAt = function(b, off) { return this.$val.WriteAt(b, off); };
File.ptr.prototype.Seek = function(offset, whence) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, e, err, err$1, f, offset, r, ret, whence, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; e = $f.e; err = $f.err; err$1 = $f.err$1; f = $f.f; offset = $f.offset; r = $f.r; ret = $f.ret; whence = $f.whence; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
ret = new $Int64(0, 0);
err = $ifaceNil;
f = this;
err$1 = f.checkValid("seek");
if (!($interfaceIsEqual(err$1, $ifaceNil))) {
_tmp = new $Int64(0, 0);
_tmp$1 = err$1;
ret = _tmp;
err = _tmp$1;
$s = -1; return [ret, err];
}
_r = f.seek(offset, whence); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
r = _tuple[0];
e = _tuple[1];
if ($interfaceIsEqual(e, $ifaceNil) && !(f.file.dirinfo === ptrType$1.nil) && !((r.$high === 0 && r.$low === 0))) {
e = new syscall.Errno(21);
}
if (!($interfaceIsEqual(e, $ifaceNil))) {
_tmp$2 = new $Int64(0, 0);
_tmp$3 = f.wrapErr("seek", e);
ret = _tmp$2;
err = _tmp$3;
$s = -1; return [ret, err];
}
_tmp$4 = r;
_tmp$5 = $ifaceNil;
ret = _tmp$4;
err = _tmp$5;
$s = -1; return [ret, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Seek }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f.e = e; $f.err = err; $f.err$1 = err$1; $f.f = f; $f.offset = offset; $f.r = r; $f.ret = ret; $f.whence = whence; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Seek = function(offset, whence) { return this.$val.Seek(offset, whence); };
File.ptr.prototype.WriteString = function(s) {
var _r, _tuple, err, f, n, s, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; f = $f.f; n = $f.n; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
_r = f.Write((new sliceType$2($stringToBytes(s)))); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
err = _tuple[1];
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.WriteString }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.f = f; $f.n = n; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.WriteString = function(s) { return this.$val.WriteString(s); };
File.ptr.prototype.wrapErr = function(op, err) {
var err, f, op;
f = this;
if ($interfaceIsEqual(err, $ifaceNil) || $interfaceIsEqual(err, io.EOF)) {
return err;
}
if ($interfaceIsEqual(err, poll.ErrFileClosing)) {
err = $pkg.ErrClosed;
}
return new PathError.ptr(op, f.file.name, err);
};
File.prototype.wrapErr = function(op, err) { return this.$val.wrapErr(op, err); };
File.ptr.prototype.Chmod = function(mode) {
var _r, f, mode, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; mode = $f.mode; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = this;
_r = f.chmod(mode); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Chmod }; } $f._r = _r; $f.f = f; $f.mode = mode; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Chmod = function(mode) { return this.$val.Chmod(mode); };
sigpipe = function() {
$throwRuntimeError("native function not implemented: os.sigpipe");
};
syscallMode = function(i) {
var i, o;
o = 0;
o = (o | (((new FileMode(i).Perm() >>> 0)))) >>> 0;
if (!((((i & 8388608) >>> 0) === 0))) {
o = (o | (2048)) >>> 0;
}
if (!((((i & 4194304) >>> 0) === 0))) {
o = (o | (1024)) >>> 0;
}
if (!((((i & 1048576) >>> 0) === 0))) {
o = (o | (512)) >>> 0;
}
return o;
};
File.ptr.prototype.chmod = function(mode) {
var _r, e, err, f, mode, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; mode = $f.mode; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = this;
err = f.checkValid("chmod");
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
_r = f.file.pfd.Fchmod(syscallMode(mode)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
e = _r;
if (!($interfaceIsEqual(e, $ifaceNil))) {
$s = -1; return f.wrapErr("chmod", e);
}
$s = -1; return $ifaceNil;
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.chmod }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.mode = mode; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.chmod = function(mode) { return this.$val.chmod(mode); };
File.ptr.prototype.Chown = function(uid, gid) {
var _r, e, err, f, gid, uid, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; gid = $f.gid; uid = $f.uid; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = this;
err = f.checkValid("chown");
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
_r = f.file.pfd.Fchown(uid, gid); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
e = _r;
if (!($interfaceIsEqual(e, $ifaceNil))) {
$s = -1; return f.wrapErr("chown", e);
}
$s = -1; return $ifaceNil;
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Chown }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.gid = gid; $f.uid = uid; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Chown = function(uid, gid) { return this.$val.Chown(uid, gid); };
File.ptr.prototype.Truncate = function(size) {
var _r, e, err, f, size, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; size = $f.size; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = this;
err = f.checkValid("truncate");
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
_r = f.file.pfd.Ftruncate(size); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
e = _r;
if (!($interfaceIsEqual(e, $ifaceNil))) {
$s = -1; return f.wrapErr("truncate", e);
}
$s = -1; return $ifaceNil;
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Truncate }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.size = size; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Truncate = function(size) { return this.$val.Truncate(size); };
File.ptr.prototype.Sync = function() {
var _r, e, err, f, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = this;
err = f.checkValid("sync");
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
_r = f.file.pfd.Fsync(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
e = _r;
if (!($interfaceIsEqual(e, $ifaceNil))) {
$s = -1; return f.wrapErr("sync", e);
}
$s = -1; return $ifaceNil;
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Sync }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Sync = function() { return this.$val.Sync(); };
File.ptr.prototype.Chdir = function() {
var _r, e, err, f, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = this;
err = f.checkValid("chdir");
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return err;
}
_r = f.file.pfd.Fchdir(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
e = _r;
if (!($interfaceIsEqual(e, $ifaceNil))) {
$s = -1; return f.wrapErr("chdir", e);
}
$s = -1; return $ifaceNil;
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Chdir }; } $f._r = _r; $f.e = e; $f.err = err; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Chdir = function() { return this.$val.Chdir(); };
File.ptr.prototype.checkValid = function(op) {
var f, op;
f = this;
if (f === ptrType.nil) {
return $pkg.ErrInvalid;
}
return $ifaceNil;
};
File.prototype.checkValid = function(op) { return this.$val.checkValid(op); };
File.ptr.prototype.Fd = function() {
var f;
f = this;
if (f === ptrType.nil) {
return 4294967295;
}
if (f.file.nonblock) {
syscall.SetNonblock(f.file.pfd.Sysfd, false);
}
return ((f.file.pfd.Sysfd >>> 0));
};
File.prototype.Fd = function() { return this.$val.Fd(); };
NewFile = function(fd, name) {
var fd, name;
return newFile(fd, name, false);
};
$pkg.NewFile = NewFile;
newFile = function(fd, name, pollable) {
var err, err$1, f, fd, fdi, name, pollable;
fdi = ((fd >> 0));
if (fdi < 0) {
return ptrType.nil;
}
f = new File.ptr(new file.ptr(new poll.FD.ptr(new poll.fdMutex.ptr(new $Uint64(0, 0), 0, 0), fdi, new poll.pollDesc.ptr(false), ptrType$12.nil, true, true, false), name, ptrType$1.nil, false));
if (false) {
pollable = false;
}
err = f.file.pfd.Init("file", pollable);
if (!($interfaceIsEqual(err, $ifaceNil))) {
} else if (pollable) {
err$1 = syscall.SetNonblock(fdi, true);
if ($interfaceIsEqual(err$1, $ifaceNil)) {
f.file.nonblock = true;
}
}
runtime.SetFinalizer(f.file, new funcType$1($methodExpr(ptrType$13, "close")));
return f;
};
epipecheck = function(file$1, e) {
var e, file$1;
if ($interfaceIsEqual(e, new syscall.Errno(32)) && ((file$1.file.pfd.Sysfd === 1) || (file$1.file.pfd.Sysfd === 2))) {
sigpipe();
}
};
File.ptr.prototype.Close = function() {
var _r, f, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = this;
if (f === ptrType.nil) {
$s = -1; return $pkg.ErrInvalid;
}
_r = f.file.close(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Close }; } $f._r = _r; $f.f = f; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Close = function() { return this.$val.Close(); };
file.ptr.prototype.close = function() {
var _r, e, err, file$1, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; e = $f.e; err = $f.err; file$1 = $f.file$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
file$1 = this;
if (file$1 === ptrType$13.nil) {
$s = -1; return new syscall.Errno(22);
}
err = $ifaceNil;
_r = file$1.pfd.Close(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
e = _r;
if (!($interfaceIsEqual(e, $ifaceNil))) {
if ($interfaceIsEqual(e, poll.ErrFileClosing)) {
e = $pkg.ErrClosed;
}
err = new PathError.ptr("close", file$1.name, e);
}
runtime.SetFinalizer(file$1, $ifaceNil);
$s = -1; return err;
/* */ } return; } if ($f === undefined) { $f = { $blk: file.ptr.prototype.close }; } $f._r = _r; $f.e = e; $f.err = err; $f.file$1 = file$1; $f.$s = $s; $f.$r = $r; return $f;
};
file.prototype.close = function() { return this.$val.close(); };
File.ptr.prototype.read = function(b) {
var _r, _tmp, _tmp$1, _tuple, b, err, f, n, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
_r = f.file.pfd.Read(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
err = _tuple[1];
runtime.KeepAlive(f);
_tmp = n;
_tmp$1 = err;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.read }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.read = function(b) { return this.$val.read(b); };
File.ptr.prototype.pread = function(b, off) {
var _r, _tmp, _tmp$1, _tuple, b, err, f, n, off, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; f = $f.f; n = $f.n; off = $f.off; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
_r = f.file.pfd.Pread(b, off); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
err = _tuple[1];
runtime.KeepAlive(f);
_tmp = n;
_tmp$1 = err;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.pread }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.f = f; $f.n = n; $f.off = off; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.pread = function(b, off) { return this.$val.pread(b, off); };
File.ptr.prototype.write = function(b) {
var _r, _tmp, _tmp$1, _tuple, b, err, f, n, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; f = $f.f; n = $f.n; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
_r = f.file.pfd.Write(b); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
err = _tuple[1];
runtime.KeepAlive(f);
_tmp = n;
_tmp$1 = err;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.write }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.f = f; $f.n = n; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.write = function(b) { return this.$val.write(b); };
File.ptr.prototype.pwrite = function(b, off) {
var _r, _tmp, _tmp$1, _tuple, b, err, f, n, off, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; b = $f.b; err = $f.err; f = $f.f; n = $f.n; off = $f.off; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
f = this;
_r = f.file.pfd.Pwrite(b, off); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
err = _tuple[1];
runtime.KeepAlive(f);
_tmp = n;
_tmp$1 = err;
n = _tmp;
err = _tmp$1;
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.pwrite }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.b = b; $f.err = err; $f.f = f; $f.n = n; $f.off = off; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.pwrite = function(b, off) { return this.$val.pwrite(b, off); };
File.ptr.prototype.seek = function(offset, whence) {
var _r, _tmp, _tmp$1, _tuple, err, f, offset, ret, whence, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; err = $f.err; f = $f.f; offset = $f.offset; ret = $f.ret; whence = $f.whence; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
ret = new $Int64(0, 0);
err = $ifaceNil;
f = this;
_r = f.file.pfd.Seek(offset, whence); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
ret = _tuple[0];
err = _tuple[1];
runtime.KeepAlive(f);
_tmp = ret;
_tmp$1 = err;
ret = _tmp;
err = _tmp$1;
$s = -1; return [ret, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.seek }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.err = err; $f.f = f; $f.offset = offset; $f.ret = ret; $f.whence = whence; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.seek = function(offset, whence) { return this.$val.seek(offset, whence); };
basename = function(name) {
var i, name;
i = name.length - 1 >> 0;
while (true) {
if (!(i > 0 && (name.charCodeAt(i) === 47))) { break; }
name = $substring(name, 0, i);
i = i - (1) >> 0;
}
i = i - (1) >> 0;
while (true) {
if (!(i >= 0)) { break; }
if (name.charCodeAt(i) === 47) {
name = $substring(name, (i + 1 >> 0));
break;
}
i = i - (1) >> 0;
}
return name;
};
init$1 = function() {
if (false) {
return;
}
$pkg.Args = runtime_args();
};
fillFileStatFromSys = function(fs, name) {
var _1, fs, name;
fs.name = basename(name);
fs.size = fs.sys.Size;
time.Time.copy(fs.modTime, timespecToTime($clone(fs.sys.Mtim, syscall.Timespec)));
fs.mode = ((((fs.sys.Mode & 511) >>> 0) >>> 0));
_1 = (fs.sys.Mode & 61440) >>> 0;
if (_1 === (24576)) {
fs.mode = (fs.mode | (67108864)) >>> 0;
} else if (_1 === (8192)) {
fs.mode = (fs.mode | (69206016)) >>> 0;
} else if (_1 === (16384)) {
fs.mode = (fs.mode | (2147483648)) >>> 0;
} else if (_1 === (4096)) {
fs.mode = (fs.mode | (33554432)) >>> 0;
} else if (_1 === (40960)) {
fs.mode = (fs.mode | (134217728)) >>> 0;
} else if (_1 === (32768)) {
} else if (_1 === (49152)) {
fs.mode = (fs.mode | (16777216)) >>> 0;
}
if (!((((fs.sys.Mode & 1024) >>> 0) === 0))) {
fs.mode = (fs.mode | (4194304)) >>> 0;
}
if (!((((fs.sys.Mode & 2048) >>> 0) === 0))) {
fs.mode = (fs.mode | (8388608)) >>> 0;
}
if (!((((fs.sys.Mode & 512) >>> 0) === 0))) {
fs.mode = (fs.mode | (1048576)) >>> 0;
}
};
timespecToTime = function(ts) {
var ts;
return time.Unix((ts.Sec), (ts.Nsec));
};
File.ptr.prototype.Stat = function() {
var _r, err, f, fs, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; f = $f.f; fs = $f.fs; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fs = [fs];
f = this;
if (f === ptrType.nil) {
$s = -1; return [$ifaceNil, $pkg.ErrInvalid];
}
fs[0] = new fileStat.ptr("", new $Int64(0, 0), 0, new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$15.nil), new syscall.Stat_t.ptr(new $Uint64(0, 0), new $Uint64(0, 0), new $Uint64(0, 0), 0, 0, 0, 0, new $Uint64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), arrayType$2.zero()));
_r = f.file.pfd.Fstat(fs[0].sys); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
err = _r;
if (!($interfaceIsEqual(err, $ifaceNil))) {
$s = -1; return [$ifaceNil, new PathError.ptr("stat", f.file.name, err)];
}
fillFileStatFromSys(fs[0], f.file.name);
$s = -1; return [fs[0], $ifaceNil];
/* */ } return; } if ($f === undefined) { $f = { $blk: File.ptr.prototype.Stat }; } $f._r = _r; $f.err = err; $f.f = f; $f.fs = fs; $f.$s = $s; $f.$r = $r; return $f;
};
File.prototype.Stat = function() { return this.$val.Stat(); };
Lstat = function(name) {
var err, fs, name;
fs = new fileStat.ptr("", new $Int64(0, 0), 0, new time.Time.ptr(new $Uint64(0, 0), new $Int64(0, 0), ptrType$15.nil), new syscall.Stat_t.ptr(new $Uint64(0, 0), new $Uint64(0, 0), new $Uint64(0, 0), 0, 0, 0, 0, new $Uint64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new $Int64(0, 0), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), new syscall.Timespec.ptr(new $Int64(0, 0), new $Int64(0, 0)), arrayType$2.zero()));
err = syscall.Lstat(name, fs.sys);
if (!($interfaceIsEqual(err, $ifaceNil))) {
return [$ifaceNil, new PathError.ptr("lstat", name, err)];
}
fillFileStatFromSys(fs, name);
return [fs, $ifaceNil];
};
$pkg.Lstat = Lstat;
FileMode.prototype.String = function() {
var _i, _i$1, _ref, _ref$1, _rune, _rune$1, buf, c, c$1, i, i$1, m, w, y, y$1;
m = this.$val;
buf = arrayType$5.zero();
w = 0;
_ref = "dalTLDpSugct";
_i = 0;
while (true) {
if (!(_i < _ref.length)) { break; }
_rune = $decodeRune(_ref, _i);
i = _i;
c = _rune[0];
if (!((((m & (((y = (((31 - i >> 0) >>> 0)), y < 32 ? (1 << y) : 0) >>> 0))) >>> 0) === 0))) {
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = ((c << 24 >>> 24)));
w = w + (1) >> 0;
}
_i += _rune[1];
}
if (w === 0) {
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 45);
w = w + (1) >> 0;
}
_ref$1 = "rwxrwxrwx";
_i$1 = 0;
while (true) {
if (!(_i$1 < _ref$1.length)) { break; }
_rune$1 = $decodeRune(_ref$1, _i$1);
i$1 = _i$1;
c$1 = _rune$1[0];
if (!((((m & (((y$1 = (((8 - i$1 >> 0) >>> 0)), y$1 < 32 ? (1 << y$1) : 0) >>> 0))) >>> 0) === 0))) {
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = ((c$1 << 24 >>> 24)));
} else {
((w < 0 || w >= buf.length) ? ($throwRuntimeError("index out of range"), undefined) : buf[w] = 45);
}
w = w + (1) >> 0;
_i$1 += _rune$1[1];
}
return ($bytesToString($subslice(new sliceType$2(buf), 0, w)));
};
$ptrType(FileMode).prototype.String = function() { return new FileMode(this.$get()).String(); };
FileMode.prototype.IsDir = function() {
var m;
m = this.$val;
return !((((m & 2147483648) >>> 0) === 0));
};
$ptrType(FileMode).prototype.IsDir = function() { return new FileMode(this.$get()).IsDir(); };
FileMode.prototype.IsRegular = function() {
var m;
m = this.$val;
return ((m & 2399141888) >>> 0) === 0;
};
$ptrType(FileMode).prototype.IsRegular = function() { return new FileMode(this.$get()).IsRegular(); };
FileMode.prototype.Perm = function() {
var m;
m = this.$val;
return (m & 511) >>> 0;
};
$ptrType(FileMode).prototype.Perm = function() { return new FileMode(this.$get()).Perm(); };
fileStat.ptr.prototype.Name = function() {
var fs;
fs = this;
return fs.name;
};
fileStat.prototype.Name = function() { return this.$val.Name(); };
fileStat.ptr.prototype.IsDir = function() {
var fs;
fs = this;
return new FileMode(fs.Mode()).IsDir();
};
fileStat.prototype.IsDir = function() { return this.$val.IsDir(); };
fileStat.ptr.prototype.Size = function() {
var fs;
fs = this;
return fs.size;
};
fileStat.prototype.Size = function() { return this.$val.Size(); };
fileStat.ptr.prototype.Mode = function() {
var fs;
fs = this;
return fs.mode;
};
fileStat.prototype.Mode = function() { return this.$val.Mode(); };
fileStat.ptr.prototype.ModTime = function() {
var fs;
fs = this;
return fs.modTime;
};
fileStat.prototype.ModTime = function() { return this.$val.ModTime(); };
fileStat.ptr.prototype.Sys = function() {
var fs;
fs = this;
return fs.sys;
};
fileStat.prototype.Sys = function() { return this.$val.Sys(); };
ptrType$2.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
ptrType$4.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
ptrType$3.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
ptrType$13.methods = [{prop: "close", name: "close", pkg: "os", typ: $funcType([], [$error], false)}];
ptrType.methods = [{prop: "Readdir", name: "Readdir", pkg: "", typ: $funcType([$Int], [sliceType$1, $error], false)}, {prop: "Readdirnames", name: "Readdirnames", pkg: "", typ: $funcType([$Int], [sliceType, $error], false)}, {prop: "readdir", name: "readdir", pkg: "os", typ: $funcType([$Int], [sliceType$1, $error], false)}, {prop: "readdirnames", name: "readdirnames", pkg: "os", typ: $funcType([$Int], [sliceType, $error], false)}, {prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "ReadAt", name: "ReadAt", pkg: "", typ: $funcType([sliceType$2, $Int64], [$Int, $error], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "WriteAt", name: "WriteAt", pkg: "", typ: $funcType([sliceType$2, $Int64], [$Int, $error], false)}, {prop: "Seek", name: "Seek", pkg: "", typ: $funcType([$Int64, $Int], [$Int64, $error], false)}, {prop: "WriteString", name: "WriteString", pkg: "", typ: $funcType([$String], [$Int, $error], false)}, {prop: "wrapErr", name: "wrapErr", pkg: "os", typ: $funcType([$String, $error], [$error], false)}, {prop: "Chmod", name: "Chmod", pkg: "", typ: $funcType([FileMode], [$error], false)}, {prop: "chmod", name: "chmod", pkg: "os", typ: $funcType([FileMode], [$error], false)}, {prop: "Chown", name: "Chown", pkg: "", typ: $funcType([$Int, $Int], [$error], false)}, {prop: "Truncate", name: "Truncate", pkg: "", typ: $funcType([$Int64], [$error], false)}, {prop: "Sync", name: "Sync", pkg: "", typ: $funcType([], [$error], false)}, {prop: "Chdir", name: "Chdir", pkg: "", typ: $funcType([], [$error], false)}, {prop: "checkValid", name: "checkValid", pkg: "os", typ: $funcType([$String], [$error], false)}, {prop: "Fd", name: "Fd", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [$error], false)}, {prop: "read", name: "read", pkg: "os", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "pread", name: "pread", pkg: "os", typ: $funcType([sliceType$2, $Int64], [$Int, $error], false)}, {prop: "write", name: "write", pkg: "os", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "pwrite", name: "pwrite", pkg: "os", typ: $funcType([sliceType$2, $Int64], [$Int, $error], false)}, {prop: "seek", name: "seek", pkg: "os", typ: $funcType([$Int64, $Int], [$Int64, $error], false)}, {prop: "Stat", name: "Stat", pkg: "", typ: $funcType([], [FileInfo, $error], false)}];
FileMode.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "IsDir", name: "IsDir", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "IsRegular", name: "IsRegular", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Perm", name: "Perm", pkg: "", typ: $funcType([], [FileMode], false)}];
ptrType$16.methods = [{prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "IsDir", name: "IsDir", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Mode", name: "Mode", pkg: "", typ: $funcType([], [FileMode], false)}, {prop: "ModTime", name: "ModTime", pkg: "", typ: $funcType([], [time.Time], false)}, {prop: "Sys", name: "Sys", pkg: "", typ: $funcType([], [$emptyInterface], false)}];
PathError.init("", [{prop: "Op", name: "Op", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Path", name: "Path", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Err", name: "Err", anonymous: false, exported: true, typ: $error, tag: ""}]);
SyscallError.init("", [{prop: "Syscall", name: "Syscall", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Err", name: "Err", anonymous: false, exported: true, typ: $error, tag: ""}]);
LinkError.init("", [{prop: "Op", name: "Op", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Old", name: "Old", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "New", name: "New", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Err", name: "Err", anonymous: false, exported: true, typ: $error, tag: ""}]);
file.init("os", [{prop: "pfd", name: "pfd", anonymous: false, exported: false, typ: poll.FD, tag: ""}, {prop: "name", name: "name", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "dirinfo", name: "dirinfo", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "nonblock", name: "nonblock", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
dirInfo.init("os", [{prop: "buf", name: "buf", anonymous: false, exported: false, typ: sliceType$2, tag: ""}, {prop: "nbuf", name: "nbuf", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "bufp", name: "bufp", anonymous: false, exported: false, typ: $Int, tag: ""}]);
File.init("os", [{prop: "file", name: "file", anonymous: true, exported: false, typ: ptrType$13, tag: ""}]);
FileInfo.init([{prop: "IsDir", name: "IsDir", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "ModTime", name: "ModTime", pkg: "", typ: $funcType([], [time.Time], false)}, {prop: "Mode", name: "Mode", pkg: "", typ: $funcType([], [FileMode], false)}, {prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Sys", name: "Sys", pkg: "", typ: $funcType([], [$emptyInterface], false)}]);
fileStat.init("os", [{prop: "name", name: "name", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "size", name: "size", anonymous: false, exported: false, typ: $Int64, tag: ""}, {prop: "mode", name: "mode", anonymous: false, exported: false, typ: FileMode, tag: ""}, {prop: "modTime", name: "modTime", anonymous: false, exported: false, typ: time.Time, tag: ""}, {prop: "sys", name: "sys", anonymous: false, exported: false, typ: syscall.Stat_t, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = js.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = poll.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = io.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = runtime.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = sync.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = atomic.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = syscall.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = time.$init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$pkg.Args = sliceType.nil;
$pkg.ErrInvalid = errors.New("invalid argument");
$pkg.ErrPermission = errors.New("permission denied");
$pkg.ErrExist = errors.New("file already exists");
$pkg.ErrNotExist = errors.New("file does not exist");
$pkg.ErrClosed = errors.New("file already closed");
errFinished = errors.New("os: process already finished");
$pkg.Stdin = NewFile(((syscall.Stdin >>> 0)), "/dev/stdin");
$pkg.Stdout = NewFile(((syscall.Stdout >>> 0)), "/dev/stdout");
$pkg.Stderr = NewFile(((syscall.Stderr >>> 0)), "/dev/stderr");
lstat = Lstat;
init();
init$1();
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["unicode/utf8"] = (function() {
var $pkg = {}, $init, acceptRange, first, acceptRanges, DecodeRuneInString, EncodeRune;
acceptRange = $pkg.acceptRange = $newType(0, $kindStruct, "utf8.acceptRange", true, "unicode/utf8", false, function(lo_, hi_) {
this.$val = this;
if (arguments.length === 0) {
this.lo = 0;
this.hi = 0;
return;
}
this.lo = lo_;
this.hi = hi_;
});
DecodeRuneInString = function(s) {
var _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$13, _tmp$14, _tmp$15, _tmp$16, _tmp$17, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, accept, mask, n, r, s, s0, s1, s2, s3, size, sz, x, x$1;
r = 0;
size = 0;
n = s.length;
if (n < 1) {
_tmp = 65533;
_tmp$1 = 0;
r = _tmp;
size = _tmp$1;
return [r, size];
}
s0 = s.charCodeAt(0);
x = ((s0 < 0 || s0 >= first.length) ? ($throwRuntimeError("index out of range"), undefined) : first[s0]);
if (x >= 240) {
mask = (((x >> 0)) << 31 >> 0) >> 31 >> 0;
_tmp$2 = ((((s.charCodeAt(0) >> 0)) & ~mask) >> 0) | (65533 & mask);
_tmp$3 = 1;
r = _tmp$2;
size = _tmp$3;
return [r, size];
}
sz = (x & 7) >>> 0;
accept = $clone((x$1 = x >>> 4 << 24 >>> 24, ((x$1 < 0 || x$1 >= acceptRanges.length) ? ($throwRuntimeError("index out of range"), undefined) : acceptRanges[x$1])), acceptRange);
if (n < ((sz >> 0))) {
_tmp$4 = 65533;
_tmp$5 = 1;
r = _tmp$4;
size = _tmp$5;
return [r, size];
}
s1 = s.charCodeAt(1);
if (s1 < accept.lo || accept.hi < s1) {
_tmp$6 = 65533;
_tmp$7 = 1;
r = _tmp$6;
size = _tmp$7;
return [r, size];
}
if (sz === 2) {
_tmp$8 = (((((s0 & 31) >>> 0) >> 0)) << 6 >> 0) | ((((s1 & 63) >>> 0) >> 0));
_tmp$9 = 2;
r = _tmp$8;
size = _tmp$9;
return [r, size];
}
s2 = s.charCodeAt(2);
if (s2 < 128 || 191 < s2) {
_tmp$10 = 65533;
_tmp$11 = 1;
r = _tmp$10;
size = _tmp$11;
return [r, size];
}
if (sz === 3) {
_tmp$12 = ((((((s0 & 15) >>> 0) >> 0)) << 12 >> 0) | (((((s1 & 63) >>> 0) >> 0)) << 6 >> 0)) | ((((s2 & 63) >>> 0) >> 0));
_tmp$13 = 3;
r = _tmp$12;
size = _tmp$13;
return [r, size];
}
s3 = s.charCodeAt(3);
if (s3 < 128 || 191 < s3) {
_tmp$14 = 65533;
_tmp$15 = 1;
r = _tmp$14;
size = _tmp$15;
return [r, size];
}
_tmp$16 = (((((((s0 & 7) >>> 0) >> 0)) << 18 >> 0) | (((((s1 & 63) >>> 0) >> 0)) << 12 >> 0)) | (((((s2 & 63) >>> 0) >> 0)) << 6 >> 0)) | ((((s3 & 63) >>> 0) >> 0));
_tmp$17 = 4;
r = _tmp$16;
size = _tmp$17;
return [r, size];
};
$pkg.DecodeRuneInString = DecodeRuneInString;
EncodeRune = function(p, r) {
var i, p, r;
i = ((r >>> 0));
if (i <= 127) {
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((r << 24 >>> 24)));
return 1;
} else if (i <= 2047) {
$unused((1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1]));
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((192 | (((r >> 6 >> 0) << 24 >>> 24))) >>> 0));
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = ((128 | ((((r << 24 >>> 24)) & 63) >>> 0)) >>> 0));
return 2;
} else if ((i > 1114111) || (55296 <= i && i <= 57343)) {
r = 65533;
$unused((2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2]));
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((224 | (((r >> 12 >> 0) << 24 >>> 24))) >>> 0));
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = ((128 | (((((r >> 6 >> 0) << 24 >>> 24)) & 63) >>> 0)) >>> 0));
(2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2] = ((128 | ((((r << 24 >>> 24)) & 63) >>> 0)) >>> 0));
return 3;
} else if (i <= 65535) {
$unused((2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2]));
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((224 | (((r >> 12 >> 0) << 24 >>> 24))) >>> 0));
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = ((128 | (((((r >> 6 >> 0) << 24 >>> 24)) & 63) >>> 0)) >>> 0));
(2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2] = ((128 | ((((r << 24 >>> 24)) & 63) >>> 0)) >>> 0));
return 3;
} else {
$unused((3 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 3]));
(0 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 0] = ((240 | (((r >> 18 >> 0) << 24 >>> 24))) >>> 0));
(1 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 1] = ((128 | (((((r >> 12 >> 0) << 24 >>> 24)) & 63) >>> 0)) >>> 0));
(2 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 2] = ((128 | (((((r >> 6 >> 0) << 24 >>> 24)) & 63) >>> 0)) >>> 0));
(3 >= p.$length ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + 3] = ((128 | ((((r << 24 >>> 24)) & 63) >>> 0)) >>> 0));
return 4;
}
};
$pkg.EncodeRune = EncodeRune;
acceptRange.init("unicode/utf8", [{prop: "lo", name: "lo", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "hi", name: "hi", anonymous: false, exported: false, typ: $Uint8, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
first = $toNativeArray($kindUint8, [240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 19, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 35, 3, 3, 52, 4, 4, 4, 68, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241]);
acceptRanges = $toNativeArray($kindStruct, [new acceptRange.ptr(128, 191), new acceptRange.ptr(160, 191), new acceptRange.ptr(128, 159), new acceptRange.ptr(144, 191), new acceptRange.ptr(128, 143)]);
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["strconv"] = (function() {
var $pkg = {}, $init, errors, math, utf8, sliceType$6, arrayType$3, arrayType$4, shifts, FormatInt, Itoa, small, formatBits, unhex, UnquoteChar, Unquote, contains;
errors = $packages["errors"];
math = $packages["math"];
utf8 = $packages["unicode/utf8"];
sliceType$6 = $sliceType($Uint8);
arrayType$3 = $arrayType($Uint8, 65);
arrayType$4 = $arrayType($Uint8, 4);
FormatInt = function(i, base) {
var _tuple, base, i, s;
if (true && (0 < i.$high || (0 === i.$high && 0 <= i.$low)) && (i.$high < 0 || (i.$high === 0 && i.$low < 100)) && (base === 10)) {
return small((((i.$low + ((i.$high >> 31) * 4294967296)) >> 0)));
}
_tuple = formatBits(sliceType$6.nil, (new $Uint64(i.$high, i.$low)), base, (i.$high < 0 || (i.$high === 0 && i.$low < 0)), false);
s = _tuple[1];
return s;
};
$pkg.FormatInt = FormatInt;
Itoa = function(i) {
var i;
return FormatInt((new $Int64(0, i)), 10);
};
$pkg.Itoa = Itoa;
small = function(i) {
var i, off;
off = 0;
if (i < 10) {
off = 1;
}
return $substring("00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899", (($imul(i, 2)) + off >> 0), (($imul(i, 2)) + 2 >> 0));
};
formatBits = function(dst, u, base, neg, append_) {
var _q, _q$1, _r, _r$1, a, append_, b, b$1, base, d, dst, i, is, is$1, is$2, j, m, neg, q, q$1, s, s$1, u, us, us$1, x, x$1, x$2, x$3, x$4, x$5;
d = sliceType$6.nil;
s = "";
if (base < 2 || base > 36) {
$panic(new $String("strconv: illegal AppendInt/FormatInt base"));
}
a = arrayType$3.zero();
i = 65;
if (neg) {
u = new $Uint64(-u.$high, -u.$low);
}
if (base === 10) {
if (true) {
while (true) {
if (!((u.$high > 0 || (u.$high === 0 && u.$low >= 1000000000)))) { break; }
q = $div64(u, new $Uint64(0, 1000000000), false);
us = (((x = $mul64(q, new $Uint64(0, 1000000000)), new $Uint64(u.$high - x.$high, u.$low - x.$low)).$low >>> 0));
j = 4;
while (true) {
if (!(j > 0)) { break; }
is = (_r = us % 100, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) * 2 >>> 0;
us = (_q = us / (100), (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >>> 0 : $throwRuntimeError("integer divide by zero"));
i = i - (2) >> 0;
(x$1 = i + 1 >> 0, ((x$1 < 0 || x$1 >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[x$1] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is + 1 >>> 0))));
(x$2 = i + 0 >> 0, ((x$2 < 0 || x$2 >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[x$2] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is + 0 >>> 0))));
j = j - (1) >> 0;
}
i = i - (1) >> 0;
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt(((us * 2 >>> 0) + 1 >>> 0)));
u = q;
}
}
us$1 = ((u.$low >>> 0));
while (true) {
if (!(us$1 >= 100)) { break; }
is$1 = (_r$1 = us$1 % 100, _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) * 2 >>> 0;
us$1 = (_q$1 = us$1 / (100), (_q$1 === _q$1 && _q$1 !== 1/0 && _q$1 !== -1/0) ? _q$1 >>> 0 : $throwRuntimeError("integer divide by zero"));
i = i - (2) >> 0;
(x$3 = i + 1 >> 0, ((x$3 < 0 || x$3 >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[x$3] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is$1 + 1 >>> 0))));
(x$4 = i + 0 >> 0, ((x$4 < 0 || x$4 >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[x$4] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is$1 + 0 >>> 0))));
}
is$2 = us$1 * 2 >>> 0;
i = i - (1) >> 0;
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt((is$2 + 1 >>> 0)));
if (us$1 >= 10) {
i = i - (1) >> 0;
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899".charCodeAt(is$2));
}
} else {
s$1 = ((base < 0 || base >= shifts.length) ? ($throwRuntimeError("index out of range"), undefined) : shifts[base]);
if (s$1 > 0) {
b = (new $Uint64(0, base));
m = ((base >>> 0)) - 1 >>> 0;
while (true) {
if (!((u.$high > b.$high || (u.$high === b.$high && u.$low >= b.$low)))) { break; }
i = i - (1) >> 0;
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "0123456789abcdefghijklmnopqrstuvwxyz".charCodeAt(((((u.$low >>> 0)) & m) >>> 0)));
u = $shiftRightUint64(u, (s$1));
}
i = i - (1) >> 0;
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "0123456789abcdefghijklmnopqrstuvwxyz".charCodeAt(((u.$low >>> 0))));
} else {
b$1 = (new $Uint64(0, base));
while (true) {
if (!((u.$high > b$1.$high || (u.$high === b$1.$high && u.$low >= b$1.$low)))) { break; }
i = i - (1) >> 0;
q$1 = $div64(u, b$1, false);
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "0123456789abcdefghijklmnopqrstuvwxyz".charCodeAt((((x$5 = $mul64(q$1, b$1), new $Uint64(u.$high - x$5.$high, u.$low - x$5.$low)).$low >>> 0))));
u = q$1;
}
i = i - (1) >> 0;
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = "0123456789abcdefghijklmnopqrstuvwxyz".charCodeAt(((u.$low >>> 0))));
}
}
if (neg) {
i = i - (1) >> 0;
((i < 0 || i >= a.length) ? ($throwRuntimeError("index out of range"), undefined) : a[i] = 45);
}
if (append_) {
d = $appendSlice(dst, $subslice(new sliceType$6(a), i));
return [d, s];
}
s = ($bytesToString($subslice(new sliceType$6(a), i)));
return [d, s];
};
unhex = function(b) {
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, b, c, ok, v;
v = 0;
ok = false;
c = ((b >> 0));
if (48 <= c && c <= 57) {
_tmp = c - 48 >> 0;
_tmp$1 = true;
v = _tmp;
ok = _tmp$1;
return [v, ok];
} else if (97 <= c && c <= 102) {
_tmp$2 = (c - 97 >> 0) + 10 >> 0;
_tmp$3 = true;
v = _tmp$2;
ok = _tmp$3;
return [v, ok];
} else if (65 <= c && c <= 70) {
_tmp$4 = (c - 65 >> 0) + 10 >> 0;
_tmp$5 = true;
v = _tmp$4;
ok = _tmp$5;
return [v, ok];
}
return [v, ok];
};
UnquoteChar = function(s, quote) {
var _1, _2, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tuple, _tuple$1, c, c$1, err, j, j$1, multibyte, n, ok, quote, r, s, size, tail, v, v$1, value, x, x$1;
value = 0;
multibyte = false;
tail = "";
err = $ifaceNil;
c = s.charCodeAt(0);
if ((c === quote) && ((quote === 39) || (quote === 34))) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
} else if (c >= 128) {
_tuple = utf8.DecodeRuneInString(s);
r = _tuple[0];
size = _tuple[1];
_tmp = r;
_tmp$1 = true;
_tmp$2 = $substring(s, size);
_tmp$3 = $ifaceNil;
value = _tmp;
multibyte = _tmp$1;
tail = _tmp$2;
err = _tmp$3;
return [value, multibyte, tail, err];
} else if (!((c === 92))) {
_tmp$4 = ((s.charCodeAt(0) >> 0));
_tmp$5 = false;
_tmp$6 = $substring(s, 1);
_tmp$7 = $ifaceNil;
value = _tmp$4;
multibyte = _tmp$5;
tail = _tmp$6;
err = _tmp$7;
return [value, multibyte, tail, err];
}
if (s.length <= 1) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
c$1 = s.charCodeAt(1);
s = $substring(s, 2);
switch (0) { default:
_1 = c$1;
if (_1 === (97)) {
value = 7;
} else if (_1 === (98)) {
value = 8;
} else if (_1 === (102)) {
value = 12;
} else if (_1 === (110)) {
value = 10;
} else if (_1 === (114)) {
value = 13;
} else if (_1 === (116)) {
value = 9;
} else if (_1 === (118)) {
value = 11;
} else if ((_1 === (120)) || (_1 === (117)) || (_1 === (85))) {
n = 0;
_2 = c$1;
if (_2 === (120)) {
n = 2;
} else if (_2 === (117)) {
n = 4;
} else if (_2 === (85)) {
n = 8;
}
v = 0;
if (s.length < n) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
j = 0;
while (true) {
if (!(j < n)) { break; }
_tuple$1 = unhex(s.charCodeAt(j));
x = _tuple$1[0];
ok = _tuple$1[1];
if (!ok) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
v = (v << 4 >> 0) | x;
j = j + (1) >> 0;
}
s = $substring(s, n);
if (c$1 === 120) {
value = v;
break;
}
if (v > 1114111) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
value = v;
multibyte = true;
} else if ((_1 === (48)) || (_1 === (49)) || (_1 === (50)) || (_1 === (51)) || (_1 === (52)) || (_1 === (53)) || (_1 === (54)) || (_1 === (55))) {
v$1 = ((c$1 >> 0)) - 48 >> 0;
if (s.length < 2) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
j$1 = 0;
while (true) {
if (!(j$1 < 2)) { break; }
x$1 = ((s.charCodeAt(j$1) >> 0)) - 48 >> 0;
if (x$1 < 0 || x$1 > 7) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
v$1 = ((v$1 << 3 >> 0)) | x$1;
j$1 = j$1 + (1) >> 0;
}
s = $substring(s, 2);
if (v$1 > 255) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
value = v$1;
} else if (_1 === (92)) {
value = 92;
} else if ((_1 === (39)) || (_1 === (34))) {
if (!((c$1 === quote))) {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
value = ((c$1 >> 0));
} else {
err = $pkg.ErrSyntax;
return [value, multibyte, tail, err];
}
}
tail = s;
return [value, multibyte, tail, err];
};
$pkg.UnquoteChar = UnquoteChar;
Unquote = function(s) {
var _1, _q, _tuple, _tuple$1, buf, buf$1, c, err, i, multibyte, n, n$1, quote, r, runeTmp, s, size, ss;
n = s.length;
if (n < 2) {
return ["", $pkg.ErrSyntax];
}
quote = s.charCodeAt(0);
if (!((quote === s.charCodeAt((n - 1 >> 0))))) {
return ["", $pkg.ErrSyntax];
}
s = $substring(s, 1, (n - 1 >> 0));
if (quote === 96) {
if (contains(s, 96)) {
return ["", $pkg.ErrSyntax];
}
if (contains(s, 13)) {
buf = $makeSlice(sliceType$6, 0, (s.length - 1 >> 0));
i = 0;
while (true) {
if (!(i < s.length)) { break; }
if (!((s.charCodeAt(i) === 13))) {
buf = $append(buf, s.charCodeAt(i));
}
i = i + (1) >> 0;
}
return [($bytesToString(buf)), $ifaceNil];
}
return [s, $ifaceNil];
}
if (!((quote === 34)) && !((quote === 39))) {
return ["", $pkg.ErrSyntax];
}
if (contains(s, 10)) {
return ["", $pkg.ErrSyntax];
}
if (!contains(s, 92) && !contains(s, quote)) {
_1 = quote;
if (_1 === (34)) {
return [s, $ifaceNil];
} else if (_1 === (39)) {
_tuple = utf8.DecodeRuneInString(s);
r = _tuple[0];
size = _tuple[1];
if ((size === s.length) && (!((r === 65533)) || !((size === 1)))) {
return [s, $ifaceNil];
}
}
}
runeTmp = arrayType$4.zero();
buf$1 = $makeSlice(sliceType$6, 0, (_q = ($imul(3, s.length)) / 2, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero")));
while (true) {
if (!(s.length > 0)) { break; }
_tuple$1 = UnquoteChar(s, quote);
c = _tuple$1[0];
multibyte = _tuple$1[1];
ss = _tuple$1[2];
err = _tuple$1[3];
if (!($interfaceIsEqual(err, $ifaceNil))) {
return ["", err];
}
s = ss;
if (c < 128 || !multibyte) {
buf$1 = $append(buf$1, ((c << 24 >>> 24)));
} else {
n$1 = utf8.EncodeRune(new sliceType$6(runeTmp), c);
buf$1 = $appendSlice(buf$1, $subslice(new sliceType$6(runeTmp), 0, n$1));
}
if ((quote === 39) && !((s.length === 0))) {
return ["", $pkg.ErrSyntax];
}
}
return [($bytesToString(buf$1)), $ifaceNil];
};
$pkg.Unquote = Unquote;
contains = function(s, c) {
var c, i, s;
i = 0;
while (true) {
if (!(i < s.length)) { break; }
if (s.charCodeAt(i) === c) {
return true;
}
i = i + (1) >> 0;
}
return false;
};
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = math.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = utf8.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$pkg.ErrRange = errors.New("value out of range");
$pkg.ErrSyntax = errors.New("invalid syntax");
shifts = $toNativeArray($kindUint, [0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0]);
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["unicode"] = (function() {
var $pkg = {}, $init;
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["reflect"] = (function() {
var $pkg = {}, $init, errors, js, math, runtime, strconv, sync, unicode, utf8, uncommonType, funcType, name, nameData, mapIter, Type, Kind, tflag, rtype, typeAlg, method, ChanDir, arrayType, chanType, imethod, interfaceType, mapType, ptrType, sliceType, structField, structType, Method, nameOff, typeOff, textOff, StructField, StructTag, fieldScan, Value, flag, ValueError, sliceType$1, ptrType$1, sliceType$2, sliceType$3, ptrType$2, funcType$1, sliceType$4, ptrType$3, ptrType$4, sliceType$5, sliceType$6, sliceType$7, ptrType$5, ptrType$6, structType$3, sliceType$8, sliceType$9, sliceType$10, sliceType$11, ptrType$7, ptrType$8, sliceType$13, sliceType$14, ptrType$9, sliceType$15, ptrType$15, sliceType$17, ptrType$16, funcType$3, funcType$4, funcType$5, ptrType$17, arrayType$12, ptrType$18, initialized, uncommonTypeMap, nameMap, nameOffList, typeOffList, callHelper, jsObjectPtr, selectHelper, kindNames, methodCache, uint8Type, init, jsType, reflectType, setKindType, newName, newNameOff, newTypeOff, internalStr, isWrapped, copyStruct, makeValue, MakeSlice, TypeOf, ValueOf, FuncOf, SliceOf, Zero, unsafe_New, makeInt, typedmemmove, keyFor, mapaccess, mapassign, mapdelete, mapiterinit, mapiterkey, mapiternext, maplen, cvtDirect, methodReceiver, valueInterface, ifaceE2I, methodName, makeMethodValue, wrapJsObject, unwrapJsObject, getJsTag, chanrecv, chansend, PtrTo, implements$1, directlyAssignable, haveIdenticalType, haveIdenticalUnderlyingType, toType, ifaceIndir, overflowFloat32, New, convertOp, makeFloat, makeComplex, makeString, makeBytes, makeRunes, cvtInt, cvtUint, cvtFloatInt, cvtFloatUint, cvtIntFloat, cvtUintFloat, cvtFloat, cvtComplex, cvtIntString, cvtUintString, cvtBytesString, cvtStringBytes, cvtRunesString, cvtStringRunes, cvtT2I, cvtI2I;
errors = $packages["errors"];
js = $packages["github.com/gopherjs/gopherjs/js"];
math = $packages["math"];
runtime = $packages["runtime"];
strconv = $packages["strconv"];
sync = $packages["sync"];
unicode = $packages["unicode"];
utf8 = $packages["unicode/utf8"];
uncommonType = $pkg.uncommonType = $newType(0, $kindStruct, "reflect.uncommonType", true, "reflect", false, function(pkgPath_, mcount_, _$2_, moff_, _$4_, _methods_) {
this.$val = this;
if (arguments.length === 0) {
this.pkgPath = 0;
this.mcount = 0;
this._$2 = 0;
this.moff = 0;
this._$4 = 0;
this._methods = sliceType$5.nil;
return;
}
this.pkgPath = pkgPath_;
this.mcount = mcount_;
this._$2 = _$2_;
this.moff = moff_;
this._$4 = _$4_;
this._methods = _methods_;
});
funcType = $pkg.funcType = $newType(0, $kindStruct, "reflect.funcType", true, "reflect", false, function(rtype_, inCount_, outCount_, _in_, _out_) {
this.$val = this;
if (arguments.length === 0) {
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
this.inCount = 0;
this.outCount = 0;
this._in = sliceType$2.nil;
this._out = sliceType$2.nil;
return;
}
this.rtype = rtype_;
this.inCount = inCount_;
this.outCount = outCount_;
this._in = _in_;
this._out = _out_;
});
name = $pkg.name = $newType(0, $kindStruct, "reflect.name", true, "reflect", false, function(bytes_) {
this.$val = this;
if (arguments.length === 0) {
this.bytes = ptrType$4.nil;
return;
}
this.bytes = bytes_;
});
nameData = $pkg.nameData = $newType(0, $kindStruct, "reflect.nameData", true, "reflect", false, function(name_, tag_, pkgPath_, exported_) {
this.$val = this;
if (arguments.length === 0) {
this.name = "";
this.tag = "";
this.pkgPath = "";
this.exported = false;
return;
}
this.name = name_;
this.tag = tag_;
this.pkgPath = pkgPath_;
this.exported = exported_;
});
mapIter = $pkg.mapIter = $newType(0, $kindStruct, "reflect.mapIter", true, "reflect", false, function(t_, m_, keys_, i_) {
this.$val = this;
if (arguments.length === 0) {
this.t = $ifaceNil;
this.m = null;
this.keys = null;
this.i = 0;
return;
}
this.t = t_;
this.m = m_;
this.keys = keys_;
this.i = i_;
});
Type = $pkg.Type = $newType(8, $kindInterface, "reflect.Type", true, "reflect", true, null);
Kind = $pkg.Kind = $newType(4, $kindUint, "reflect.Kind", true, "reflect", true, null);
tflag = $pkg.tflag = $newType(1, $kindUint8, "reflect.tflag", true, "reflect", false, null);
rtype = $pkg.rtype = $newType(0, $kindStruct, "reflect.rtype", true, "reflect", false, function(size_, ptrdata_, hash_, tflag_, align_, fieldAlign_, kind_, alg_, gcdata_, str_, ptrToThis_) {
this.$val = this;
if (arguments.length === 0) {
this.size = 0;
this.ptrdata = 0;
this.hash = 0;
this.tflag = 0;
this.align = 0;
this.fieldAlign = 0;
this.kind = 0;
this.alg = ptrType$3.nil;
this.gcdata = ptrType$4.nil;
this.str = 0;
this.ptrToThis = 0;
return;
}
this.size = size_;
this.ptrdata = ptrdata_;
this.hash = hash_;
this.tflag = tflag_;
this.align = align_;
this.fieldAlign = fieldAlign_;
this.kind = kind_;
this.alg = alg_;
this.gcdata = gcdata_;
this.str = str_;
this.ptrToThis = ptrToThis_;
});
typeAlg = $pkg.typeAlg = $newType(0, $kindStruct, "reflect.typeAlg", true, "reflect", false, function(hash_, equal_) {
this.$val = this;
if (arguments.length === 0) {
this.hash = $throwNilPointerError;
this.equal = $throwNilPointerError;
return;
}
this.hash = hash_;
this.equal = equal_;
});
method = $pkg.method = $newType(0, $kindStruct, "reflect.method", true, "reflect", false, function(name_, mtyp_, ifn_, tfn_) {
this.$val = this;
if (arguments.length === 0) {
this.name = 0;
this.mtyp = 0;
this.ifn = 0;
this.tfn = 0;
return;
}
this.name = name_;
this.mtyp = mtyp_;
this.ifn = ifn_;
this.tfn = tfn_;
});
ChanDir = $pkg.ChanDir = $newType(4, $kindInt, "reflect.ChanDir", true, "reflect", true, null);
arrayType = $pkg.arrayType = $newType(0, $kindStruct, "reflect.arrayType", true, "reflect", false, function(rtype_, elem_, slice_, len_) {
this.$val = this;
if (arguments.length === 0) {
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
this.elem = ptrType$1.nil;
this.slice = ptrType$1.nil;
this.len = 0;
return;
}
this.rtype = rtype_;
this.elem = elem_;
this.slice = slice_;
this.len = len_;
});
chanType = $pkg.chanType = $newType(0, $kindStruct, "reflect.chanType", true, "reflect", false, function(rtype_, elem_, dir_) {
this.$val = this;
if (arguments.length === 0) {
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
this.elem = ptrType$1.nil;
this.dir = 0;
return;
}
this.rtype = rtype_;
this.elem = elem_;
this.dir = dir_;
});
imethod = $pkg.imethod = $newType(0, $kindStruct, "reflect.imethod", true, "reflect", false, function(name_, typ_) {
this.$val = this;
if (arguments.length === 0) {
this.name = 0;
this.typ = 0;
return;
}
this.name = name_;
this.typ = typ_;
});
interfaceType = $pkg.interfaceType = $newType(0, $kindStruct, "reflect.interfaceType", true, "reflect", false, function(rtype_, pkgPath_, methods_) {
this.$val = this;
if (arguments.length === 0) {
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
this.pkgPath = new name.ptr(ptrType$4.nil);
this.methods = sliceType$6.nil;
return;
}
this.rtype = rtype_;
this.pkgPath = pkgPath_;
this.methods = methods_;
});
mapType = $pkg.mapType = $newType(0, $kindStruct, "reflect.mapType", true, "reflect", false, function(rtype_, key_, elem_, bucket_, hmap_, keysize_, indirectkey_, valuesize_, indirectvalue_, bucketsize_, reflexivekey_, needkeyupdate_) {
this.$val = this;
if (arguments.length === 0) {
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
this.key = ptrType$1.nil;
this.elem = ptrType$1.nil;
this.bucket = ptrType$1.nil;
this.hmap = ptrType$1.nil;
this.keysize = 0;
this.indirectkey = 0;
this.valuesize = 0;
this.indirectvalue = 0;
this.bucketsize = 0;
this.reflexivekey = false;
this.needkeyupdate = false;
return;
}
this.rtype = rtype_;
this.key = key_;
this.elem = elem_;
this.bucket = bucket_;
this.hmap = hmap_;
this.keysize = keysize_;
this.indirectkey = indirectkey_;
this.valuesize = valuesize_;
this.indirectvalue = indirectvalue_;
this.bucketsize = bucketsize_;
this.reflexivekey = reflexivekey_;
this.needkeyupdate = needkeyupdate_;
});
ptrType = $pkg.ptrType = $newType(0, $kindStruct, "reflect.ptrType", true, "reflect", false, function(rtype_, elem_) {
this.$val = this;
if (arguments.length === 0) {
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
this.elem = ptrType$1.nil;
return;
}
this.rtype = rtype_;
this.elem = elem_;
});
sliceType = $pkg.sliceType = $newType(0, $kindStruct, "reflect.sliceType", true, "reflect", false, function(rtype_, elem_) {
this.$val = this;
if (arguments.length === 0) {
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
this.elem = ptrType$1.nil;
return;
}
this.rtype = rtype_;
this.elem = elem_;
});
structField = $pkg.structField = $newType(0, $kindStruct, "reflect.structField", true, "reflect", false, function(name_, typ_, offsetAnon_) {
this.$val = this;
if (arguments.length === 0) {
this.name = new name.ptr(ptrType$4.nil);
this.typ = ptrType$1.nil;
this.offsetAnon = 0;
return;
}
this.name = name_;
this.typ = typ_;
this.offsetAnon = offsetAnon_;
});
structType = $pkg.structType = $newType(0, $kindStruct, "reflect.structType", true, "reflect", false, function(rtype_, pkgPath_, fields_) {
this.$val = this;
if (arguments.length === 0) {
this.rtype = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
this.pkgPath = new name.ptr(ptrType$4.nil);
this.fields = sliceType$7.nil;
return;
}
this.rtype = rtype_;
this.pkgPath = pkgPath_;
this.fields = fields_;
});
Method = $pkg.Method = $newType(0, $kindStruct, "reflect.Method", true, "reflect", true, function(Name_, PkgPath_, Type_, Func_, Index_) {
this.$val = this;
if (arguments.length === 0) {
this.Name = "";
this.PkgPath = "";
this.Type = $ifaceNil;
this.Func = new Value.ptr(ptrType$1.nil, 0, 0);
this.Index = 0;
return;
}
this.Name = Name_;
this.PkgPath = PkgPath_;
this.Type = Type_;
this.Func = Func_;
this.Index = Index_;
});
nameOff = $pkg.nameOff = $newType(4, $kindInt32, "reflect.nameOff", true, "reflect", false, null);
typeOff = $pkg.typeOff = $newType(4, $kindInt32, "reflect.typeOff", true, "reflect", false, null);
textOff = $pkg.textOff = $newType(4, $kindInt32, "reflect.textOff", true, "reflect", false, null);
StructField = $pkg.StructField = $newType(0, $kindStruct, "reflect.StructField", true, "reflect", true, function(Name_, PkgPath_, Type_, Tag_, Offset_, Index_, Anonymous_) {
this.$val = this;
if (arguments.length === 0) {
this.Name = "";
this.PkgPath = "";
this.Type = $ifaceNil;
this.Tag = "";
this.Offset = 0;
this.Index = sliceType$13.nil;
this.Anonymous = false;
return;
}
this.Name = Name_;
this.PkgPath = PkgPath_;
this.Type = Type_;
this.Tag = Tag_;
this.Offset = Offset_;
this.Index = Index_;
this.Anonymous = Anonymous_;
});
StructTag = $pkg.StructTag = $newType(8, $kindString, "reflect.StructTag", true, "reflect", true, null);
fieldScan = $pkg.fieldScan = $newType(0, $kindStruct, "reflect.fieldScan", true, "reflect", false, function(typ_, index_) {
this.$val = this;
if (arguments.length === 0) {
this.typ = ptrType$9.nil;
this.index = sliceType$13.nil;
return;
}
this.typ = typ_;
this.index = index_;
});
Value = $pkg.Value = $newType(0, $kindStruct, "reflect.Value", true, "reflect", true, function(typ_, ptr_, flag_) {
this.$val = this;
if (arguments.length === 0) {
this.typ = ptrType$1.nil;
this.ptr = 0;
this.flag = 0;
return;
}
this.typ = typ_;
this.ptr = ptr_;
this.flag = flag_;
});
flag = $pkg.flag = $newType(4, $kindUintptr, "reflect.flag", true, "reflect", false, null);
ValueError = $pkg.ValueError = $newType(0, $kindStruct, "reflect.ValueError", true, "reflect", true, function(Method_, Kind_) {
this.$val = this;
if (arguments.length === 0) {
this.Method = "";
this.Kind = 0;
return;
}
this.Method = Method_;
this.Kind = Kind_;
});
sliceType$1 = $sliceType(name);
ptrType$1 = $ptrType(rtype);
sliceType$2 = $sliceType(ptrType$1);
sliceType$3 = $sliceType($emptyInterface);
ptrType$2 = $ptrType(js.Object);
funcType$1 = $funcType([sliceType$3], [ptrType$2], true);
sliceType$4 = $sliceType($String);
ptrType$3 = $ptrType(typeAlg);
ptrType$4 = $ptrType($Uint8);
sliceType$5 = $sliceType(method);
sliceType$6 = $sliceType(imethod);
sliceType$7 = $sliceType(structField);
ptrType$5 = $ptrType(uncommonType);
ptrType$6 = $ptrType(nameData);
structType$3 = $structType("reflect", [{prop: "str", name: "str", anonymous: false, exported: false, typ: $String, tag: ""}]);
sliceType$8 = $sliceType(ptrType$2);
sliceType$9 = $sliceType(Value);
sliceType$10 = $sliceType(Type);
sliceType$11 = $sliceType(sliceType$8);
ptrType$7 = $ptrType(interfaceType);
ptrType$8 = $ptrType(imethod);
sliceType$13 = $sliceType($Int);
sliceType$14 = $sliceType(fieldScan);
ptrType$9 = $ptrType(structType);
sliceType$15 = $sliceType($Uint8);
ptrType$15 = $ptrType($UnsafePointer);
sliceType$17 = $sliceType($Int32);
ptrType$16 = $ptrType(funcType);
funcType$3 = $funcType([$String], [$Bool], false);
funcType$4 = $funcType([$UnsafePointer, $Uintptr], [$Uintptr], false);
funcType$5 = $funcType([$UnsafePointer, $UnsafePointer], [$Bool], false);
ptrType$17 = $ptrType(structField);
arrayType$12 = $arrayType($Uintptr, 2);
ptrType$18 = $ptrType(ValueError);
init = function() {
var used, x, x$1, x$10, x$11, x$12, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; used = $f.used; x = $f.x; x$1 = $f.x$1; x$10 = $f.x$10; x$11 = $f.x$11; x$12 = $f.x$12; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; x$6 = $f.x$6; x$7 = $f.x$7; x$8 = $f.x$8; x$9 = $f.x$9; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
used = (function(i) {
var i;
});
$r = used((x = new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), new x.constructor.elem(x))); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$1 = new uncommonType.ptr(0, 0, 0, 0, 0, sliceType$5.nil), new x$1.constructor.elem(x$1))); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$2 = new method.ptr(0, 0, 0, 0), new x$2.constructor.elem(x$2))); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$3 = new arrayType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil, ptrType$1.nil, 0), new x$3.constructor.elem(x$3))); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$4 = new chanType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil, 0), new x$4.constructor.elem(x$4))); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$5 = new funcType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), 0, 0, sliceType$2.nil, sliceType$2.nil), new x$5.constructor.elem(x$5))); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$6 = new interfaceType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), new name.ptr(ptrType$4.nil), sliceType$6.nil), new x$6.constructor.elem(x$6))); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$7 = new mapType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil, ptrType$1.nil, ptrType$1.nil, ptrType$1.nil, 0, 0, 0, 0, 0, false, false), new x$7.constructor.elem(x$7))); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$8 = new ptrType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil), new x$8.constructor.elem(x$8))); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$9 = new sliceType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), ptrType$1.nil), new x$9.constructor.elem(x$9))); /* */ $s = 10; case 10: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$10 = new structType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), new name.ptr(ptrType$4.nil), sliceType$7.nil), new x$10.constructor.elem(x$10))); /* */ $s = 11; case 11: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$11 = new imethod.ptr(0, 0), new x$11.constructor.elem(x$11))); /* */ $s = 12; case 12: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = used((x$12 = new structField.ptr(new name.ptr(ptrType$4.nil), ptrType$1.nil, 0), new x$12.constructor.elem(x$12))); /* */ $s = 13; case 13: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
initialized = true;
uint8Type = $assertType(TypeOf(new $Uint8(0)), ptrType$1);
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: init }; } $f.used = used; $f.x = x; $f.x$1 = x$1; $f.x$10 = x$10; $f.x$11 = x$11; $f.x$12 = x$12; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.x$6 = x$6; $f.x$7 = x$7; $f.x$8 = x$8; $f.x$9 = x$9; $f.$s = $s; $f.$r = $r; return $f;
};
jsType = function(typ) {
var typ;
return typ.jsType;
};
reflectType = function(typ) {
var _1, _i, _i$1, _i$2, _i$3, _i$4, _key, _ref, _ref$1, _ref$2, _ref$3, _ref$4, dir, f, fields, i, i$1, i$2, i$3, i$4, imethods, in$1, m, m$1, methodSet, methods, offsetAnon, out, outCount, params, reflectFields, reflectMethods, results, rt, typ, ut;
if (typ.reflectType === undefined) {
rt = new rtype.ptr(((($parseInt(typ.size) >> 0) >>> 0)), 0, 0, 0, 0, 0, ((($parseInt(typ.kind) >> 0) << 24 >>> 24)), ptrType$3.nil, ptrType$4.nil, newNameOff($clone(newName(internalStr(typ.string), "", "", !!(typ.exported)), name)), 0);
rt.jsType = typ;
typ.reflectType = rt;
methodSet = $methodSet(typ);
if (!(($parseInt(methodSet.length) === 0)) || !!(typ.named)) {
rt.tflag = (rt.tflag | (1)) >>> 0;
if (!!(typ.named)) {
rt.tflag = (rt.tflag | (4)) >>> 0;
}
reflectMethods = $makeSlice(sliceType$5, $parseInt(methodSet.length));
_ref = reflectMethods;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
m = methodSet[i];
method.copy(((i < 0 || i >= reflectMethods.$length) ? ($throwRuntimeError("index out of range"), undefined) : reflectMethods.$array[reflectMethods.$offset + i]), new method.ptr(newNameOff($clone(newName(internalStr(m.name), "", "", internalStr(m.pkg) === ""), name)), newTypeOff(reflectType(m.typ)), 0, 0));
_i++;
}
ut = new uncommonType.ptr(newNameOff($clone(newName(internalStr(typ.pkg), "", "", false), name)), (($parseInt(methodSet.length) << 16 >>> 16)), 0, 0, 0, reflectMethods);
_key = rt; (uncommonTypeMap || $throwRuntimeError("assignment to entry in nil map"))[ptrType$1.keyFor(_key)] = { k: _key, v: ut };
ut.jsType = typ;
}
_1 = rt.Kind();
if (_1 === (17)) {
setKindType(rt, new arrayType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.elem), ptrType$1.nil, ((($parseInt(typ.len) >> 0) >>> 0))));
} else if (_1 === (18)) {
dir = 3;
if (!!(typ.sendOnly)) {
dir = 2;
}
if (!!(typ.recvOnly)) {
dir = 1;
}
setKindType(rt, new chanType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.elem), ((dir >>> 0))));
} else if (_1 === (19)) {
params = typ.params;
in$1 = $makeSlice(sliceType$2, $parseInt(params.length));
_ref$1 = in$1;
_i$1 = 0;
while (true) {
if (!(_i$1 < _ref$1.$length)) { break; }
i$1 = _i$1;
((i$1 < 0 || i$1 >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + i$1] = reflectType(params[i$1]));
_i$1++;
}
results = typ.results;
out = $makeSlice(sliceType$2, $parseInt(results.length));
_ref$2 = out;
_i$2 = 0;
while (true) {
if (!(_i$2 < _ref$2.$length)) { break; }
i$2 = _i$2;
((i$2 < 0 || i$2 >= out.$length) ? ($throwRuntimeError("index out of range"), undefined) : out.$array[out.$offset + i$2] = reflectType(results[i$2]));
_i$2++;
}
outCount = (($parseInt(results.length) << 16 >>> 16));
if (!!(typ.variadic)) {
outCount = (outCount | (32768)) >>> 0;
}
setKindType(rt, new funcType.ptr($clone(rt, rtype), (($parseInt(params.length) << 16 >>> 16)), outCount, in$1, out));
} else if (_1 === (20)) {
methods = typ.methods;
imethods = $makeSlice(sliceType$6, $parseInt(methods.length));
_ref$3 = imethods;
_i$3 = 0;
while (true) {
if (!(_i$3 < _ref$3.$length)) { break; }
i$3 = _i$3;
m$1 = methods[i$3];
imethod.copy(((i$3 < 0 || i$3 >= imethods.$length) ? ($throwRuntimeError("index out of range"), undefined) : imethods.$array[imethods.$offset + i$3]), new imethod.ptr(newNameOff($clone(newName(internalStr(m$1.name), "", "", internalStr(m$1.pkg) === ""), name)), newTypeOff(reflectType(m$1.typ))));
_i$3++;
}
setKindType(rt, new interfaceType.ptr($clone(rt, rtype), $clone(newName(internalStr(typ.pkg), "", "", false), name), imethods));
} else if (_1 === (21)) {
setKindType(rt, new mapType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.key), reflectType(typ.elem), ptrType$1.nil, ptrType$1.nil, 0, 0, 0, 0, 0, false, false));
} else if (_1 === (22)) {
setKindType(rt, new ptrType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.elem)));
} else if (_1 === (23)) {
setKindType(rt, new sliceType.ptr(new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0), reflectType(typ.elem)));
} else if (_1 === (25)) {
fields = typ.fields;
reflectFields = $makeSlice(sliceType$7, $parseInt(fields.length));
_ref$4 = reflectFields;
_i$4 = 0;
while (true) {
if (!(_i$4 < _ref$4.$length)) { break; }
i$4 = _i$4;
f = fields[i$4];
offsetAnon = ((i$4 >>> 0)) << 1 >>> 0;
if (!!(f.anonymous)) {
offsetAnon = (offsetAnon | (1)) >>> 0;
}
structField.copy(((i$4 < 0 || i$4 >= reflectFields.$length) ? ($throwRuntimeError("index out of range"), undefined) : reflectFields.$array[reflectFields.$offset + i$4]), new structField.ptr($clone(newName(internalStr(f.name), internalStr(f.tag), "", !!(f.exported)), name), reflectType(f.typ), offsetAnon));
_i$4++;
}
setKindType(rt, new structType.ptr($clone(rt, rtype), $clone(newName(internalStr(typ.pkgPath), "", "", false), name), reflectFields));
}
}
return ((typ.reflectType));
};
setKindType = function(rt, kindType) {
var kindType, rt;
rt.kindType = kindType;
kindType.rtype = rt;
};
uncommonType.ptr.prototype.methods = function() {
var t;
t = this;
return t._methods;
};
uncommonType.prototype.methods = function() { return this.$val.methods(); };
rtype.ptr.prototype.uncommon = function() {
var _entry, t;
t = this;
return (_entry = uncommonTypeMap[ptrType$1.keyFor(t)], _entry !== undefined ? _entry.v : ptrType$5.nil);
};
rtype.prototype.uncommon = function() { return this.$val.uncommon(); };
funcType.ptr.prototype.in$ = function() {
var t;
t = this;
return t._in;
};
funcType.prototype.in$ = function() { return this.$val.in$(); };
funcType.ptr.prototype.out = function() {
var t;
t = this;
return t._out;
};
funcType.prototype.out = function() { return this.$val.out(); };
name.ptr.prototype.name = function() {
var _entry, n, s;
s = "";
n = this;
s = (_entry = nameMap[ptrType$4.keyFor(n.bytes)], _entry !== undefined ? _entry.v : ptrType$6.nil).name;
return s;
};
name.prototype.name = function() { return this.$val.name(); };
name.ptr.prototype.tag = function() {
var _entry, n, s;
s = "";
n = this;
s = (_entry = nameMap[ptrType$4.keyFor(n.bytes)], _entry !== undefined ? _entry.v : ptrType$6.nil).tag;
return s;
};
name.prototype.tag = function() { return this.$val.tag(); };
name.ptr.prototype.pkgPath = function() {
var _entry, n;
n = this;
return (_entry = nameMap[ptrType$4.keyFor(n.bytes)], _entry !== undefined ? _entry.v : ptrType$6.nil).pkgPath;
};
name.prototype.pkgPath = function() { return this.$val.pkgPath(); };
name.ptr.prototype.isExported = function() {
var _entry, n;
n = this;
return (_entry = nameMap[ptrType$4.keyFor(n.bytes)], _entry !== undefined ? _entry.v : ptrType$6.nil).exported;
};
name.prototype.isExported = function() { return this.$val.isExported(); };
newName = function(n, tag, pkgPath, exported) {
var _key, b, exported, n, pkgPath, tag;
b = $newDataPointer(0, ptrType$4);
_key = b; (nameMap || $throwRuntimeError("assignment to entry in nil map"))[ptrType$4.keyFor(_key)] = { k: _key, v: new nameData.ptr(n, tag, pkgPath, exported) };
return new name.ptr(b);
};
rtype.ptr.prototype.nameOff = function(off) {
var off, t, x;
t = this;
return (x = ((off >> 0)), ((x < 0 || x >= nameOffList.$length) ? ($throwRuntimeError("index out of range"), undefined) : nameOffList.$array[nameOffList.$offset + x]));
};
rtype.prototype.nameOff = function(off) { return this.$val.nameOff(off); };
newNameOff = function(n) {
var i, n;
i = nameOffList.$length;
nameOffList = $append(nameOffList, n);
return ((i >> 0));
};
rtype.ptr.prototype.typeOff = function(off) {
var off, t, x;
t = this;
return (x = ((off >> 0)), ((x < 0 || x >= typeOffList.$length) ? ($throwRuntimeError("index out of range"), undefined) : typeOffList.$array[typeOffList.$offset + x]));
};
rtype.prototype.typeOff = function(off) { return this.$val.typeOff(off); };
newTypeOff = function(t) {
var i, t;
i = typeOffList.$length;
typeOffList = $append(typeOffList, t);
return ((i >> 0));
};
internalStr = function(strObj) {
var c, strObj;
c = new structType$3.ptr("");
c.str = strObj;
return c.str;
};
isWrapped = function(typ) {
var typ;
return !!(jsType(typ).wrapped);
};
copyStruct = function(dst, src, typ) {
var dst, fields, i, prop, src, typ;
fields = jsType(typ).fields;
i = 0;
while (true) {
if (!(i < $parseInt(fields.length))) { break; }
prop = $internalize(fields[i].prop, $String);
dst[$externalize(prop, $String)] = src[$externalize(prop, $String)];
i = i + (1) >> 0;
}
};
makeValue = function(t, v, fl) {
var _r, _r$1, _r$2, _r$3, _r$4, _r$5, _v, _v$1, fl, rt, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _v = $f._v; _v$1 = $f._v$1; fl = $f.fl; rt = $f.rt; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = t.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
rt = _r;
_r$1 = t.Kind(); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
if (_r$1 === 17) { _v$1 = true; $s = 5; continue s; }
_r$2 = t.Kind(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_v$1 = _r$2 === 25; case 5:
if (_v$1) { _v = true; $s = 4; continue s; }
_r$3 = t.Kind(); /* */ $s = 8; case 8: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
_v = _r$3 === 22; case 4:
/* */ if (_v) { $s = 2; continue; }
/* */ $s = 3; continue;
/* if (_v) { */ case 2:
_r$4 = t.Kind(); /* */ $s = 9; case 9: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
$s = -1; return new Value.ptr(rt, (v), (fl | ((_r$4 >>> 0))) >>> 0);
/* } */ case 3:
_r$5 = t.Kind(); /* */ $s = 10; case 10: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
$s = -1; return new Value.ptr(rt, ($newDataPointer(v, jsType(rt.ptrTo()))), (((fl | ((_r$5 >>> 0))) >>> 0) | 128) >>> 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: makeValue }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._v = _v; $f._v$1 = _v$1; $f.fl = fl; $f.rt = rt; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
MakeSlice = function(typ, len, cap) {
var _r, _r$1, cap, len, typ, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; cap = $f.cap; len = $f.len; typ = $f.typ; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
typ = [typ];
_r = typ[0].Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (!((_r === 23))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((_r === 23))) { */ case 1:
$panic(new $String("reflect.MakeSlice of non-slice type"));
/* } */ case 2:
if (len < 0) {
$panic(new $String("reflect.MakeSlice: negative len"));
}
if (cap < 0) {
$panic(new $String("reflect.MakeSlice: negative cap"));
}
if (len > cap) {
$panic(new $String("reflect.MakeSlice: len > cap"));
}
_r$1 = makeValue(typ[0], $makeSlice(jsType(typ[0]), len, cap, (function(typ) { return function $b() {
var _r$1, _r$2, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r$1 = $f._r$1; _r$2 = $f._r$2; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r$1 = typ[0].Elem(); /* */ $s = 1; case 1: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = jsType(_r$1); /* */ $s = 2; case 2: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
$s = -1; return _r$2.zero();
/* */ } return; } if ($f === undefined) { $f = { $blk: $b }; } $f._r$1 = _r$1; $f._r$2 = _r$2; $f.$s = $s; $f.$r = $r; return $f;
}; })(typ)), 0); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* */ } return; } if ($f === undefined) { $f = { $blk: MakeSlice }; } $f._r = _r; $f._r$1 = _r$1; $f.cap = cap; $f.len = len; $f.typ = typ; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.MakeSlice = MakeSlice;
TypeOf = function(i) {
var i;
if (!initialized) {
return new rtype.ptr(0, 0, 0, 0, 0, 0, 0, ptrType$3.nil, ptrType$4.nil, 0, 0);
}
if ($interfaceIsEqual(i, $ifaceNil)) {
return $ifaceNil;
}
return reflectType(i.constructor);
};
$pkg.TypeOf = TypeOf;
ValueOf = function(i) {
var _r, i, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; i = $f.i; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
if ($interfaceIsEqual(i, $ifaceNil)) {
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
}
_r = makeValue(reflectType(i.constructor), i.$val, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: ValueOf }; } $f._r = _r; $f.i = i; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.ValueOf = ValueOf;
FuncOf = function(in$1, out, variadic) {
var _i, _i$1, _r, _ref, _ref$1, _v, _v$1, i, i$1, in$1, jsIn, jsOut, out, v, v$1, variadic, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _ref = $f._ref; _ref$1 = $f._ref$1; _v = $f._v; _v$1 = $f._v$1; i = $f.i; i$1 = $f.i$1; in$1 = $f.in$1; jsIn = $f.jsIn; jsOut = $f.jsOut; out = $f.out; v = $f.v; v$1 = $f.v$1; variadic = $f.variadic; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
if (!(variadic)) { _v = false; $s = 3; continue s; }
if (in$1.$length === 0) { _v$1 = true; $s = 4; continue s; }
_r = (x = in$1.$length - 1 >> 0, ((x < 0 || x >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + x])).Kind(); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_v$1 = !((_r === 23)); case 4:
_v = _v$1; case 3:
/* */ if (_v) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (_v) { */ case 1:
$panic(new $String("reflect.FuncOf: last arg of variadic func must be slice"));
/* } */ case 2:
jsIn = $makeSlice(sliceType$8, in$1.$length);
_ref = in$1;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
v = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
((i < 0 || i >= jsIn.$length) ? ($throwRuntimeError("index out of range"), undefined) : jsIn.$array[jsIn.$offset + i] = jsType(v));
_i++;
}
jsOut = $makeSlice(sliceType$8, out.$length);
_ref$1 = out;
_i$1 = 0;
while (true) {
if (!(_i$1 < _ref$1.$length)) { break; }
i$1 = _i$1;
v$1 = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
((i$1 < 0 || i$1 >= jsOut.$length) ? ($throwRuntimeError("index out of range"), undefined) : jsOut.$array[jsOut.$offset + i$1] = jsType(v$1));
_i$1++;
}
$s = -1; return reflectType($funcType($externalize(jsIn, sliceType$8), $externalize(jsOut, sliceType$8), $externalize(variadic, $Bool)));
/* */ } return; } if ($f === undefined) { $f = { $blk: FuncOf }; } $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._ref = _ref; $f._ref$1 = _ref$1; $f._v = _v; $f._v$1 = _v$1; $f.i = i; $f.i$1 = i$1; $f.in$1 = in$1; $f.jsIn = jsIn; $f.jsOut = jsOut; $f.out = out; $f.v = v; $f.v$1 = v$1; $f.variadic = variadic; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.FuncOf = FuncOf;
rtype.ptr.prototype.ptrTo = function() {
var t;
t = this;
return reflectType($ptrType(jsType(t)));
};
rtype.prototype.ptrTo = function() { return this.$val.ptrTo(); };
SliceOf = function(t) {
var t;
return reflectType($sliceType(jsType(t)));
};
$pkg.SliceOf = SliceOf;
Zero = function(typ) {
var _r, typ, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; typ = $f.typ; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeValue(typ, jsType(typ).zero(), 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Zero }; } $f._r = _r; $f.typ = typ; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.Zero = Zero;
unsafe_New = function(typ) {
var _1, typ;
_1 = typ.Kind();
if (_1 === (25)) {
return (new (jsType(typ).ptr)());
} else if (_1 === (17)) {
return (jsType(typ).zero());
} else {
return ($newDataPointer(jsType(typ).zero(), jsType(typ.ptrTo())));
}
};
makeInt = function(f, bits, t) {
var _1, _r, bits, f, ptr, t, typ, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; bits = $f.bits; f = $f.f; ptr = $f.ptr; t = $f.t; typ = $f.typ; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = t.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
typ = _r;
ptr = unsafe_New(typ);
_1 = typ.Kind();
if (_1 === (3)) {
(ptr).$set(((bits.$low << 24 >> 24)));
} else if (_1 === (4)) {
(ptr).$set(((bits.$low << 16 >> 16)));
} else if ((_1 === (2)) || (_1 === (5))) {
(ptr).$set(((bits.$low >> 0)));
} else if (_1 === (6)) {
(ptr).$set((new $Int64(bits.$high, bits.$low)));
} else if (_1 === (8)) {
(ptr).$set(((bits.$low << 24 >>> 24)));
} else if (_1 === (9)) {
(ptr).$set(((bits.$low << 16 >>> 16)));
} else if ((_1 === (7)) || (_1 === (10)) || (_1 === (12))) {
(ptr).$set(((bits.$low >>> 0)));
} else if (_1 === (11)) {
(ptr).$set((bits));
}
$s = -1; return new Value.ptr(typ, ptr, (((f | 128) >>> 0) | ((typ.Kind() >>> 0))) >>> 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: makeInt }; } $f._1 = _1; $f._r = _r; $f.bits = bits; $f.f = f; $f.ptr = ptr; $f.t = t; $f.typ = typ; $f.$s = $s; $f.$r = $r; return $f;
};
typedmemmove = function(t, dst, src) {
var dst, src, t;
dst.$set(src.$get());
};
keyFor = function(t, key) {
var k, key, kv, t;
kv = key;
if (!(kv.$get === undefined)) {
kv = kv.$get();
}
k = $internalize(jsType(t.Key()).keyFor(kv), $String);
return [kv, k];
};
mapaccess = function(t, m, key) {
var _tuple, entry, k, key, m, t;
_tuple = keyFor(t, key);
k = _tuple[1];
entry = m[$externalize(k, $String)];
if (entry === undefined) {
return 0;
}
return ($newDataPointer(entry.v, jsType(PtrTo(t.Elem()))));
};
mapassign = function(t, m, key, val) {
var _r, _tuple, entry, et, jsVal, k, key, kv, m, newVal, t, val, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; entry = $f.entry; et = $f.et; jsVal = $f.jsVal; k = $f.k; key = $f.key; kv = $f.kv; m = $f.m; newVal = $f.newVal; t = $f.t; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_tuple = keyFor(t, key);
kv = _tuple[0];
k = _tuple[1];
jsVal = val.$get();
et = t.Elem();
_r = et.Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (_r === 25) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (_r === 25) { */ case 1:
newVal = jsType(et).zero();
copyStruct(newVal, jsVal, et);
jsVal = newVal;
/* } */ case 2:
entry = new ($global.Object)();
entry.k = kv;
entry.v = jsVal;
m[$externalize(k, $String)] = entry;
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: mapassign }; } $f._r = _r; $f._tuple = _tuple; $f.entry = entry; $f.et = et; $f.jsVal = jsVal; $f.k = k; $f.key = key; $f.kv = kv; $f.m = m; $f.newVal = newVal; $f.t = t; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
};
mapdelete = function(t, m, key) {
var _tuple, k, key, m, t;
_tuple = keyFor(t, key);
k = _tuple[1];
delete m[$externalize(k, $String)];
};
mapiterinit = function(t, m) {
var m, t;
return ((new mapIter.ptr(t, m, $keys(m), 0)));
};
mapiterkey = function(it) {
var _r, _r$1, _r$2, it, iter, k, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; it = $f.it; iter = $f.iter; k = $f.k; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
iter = ((it));
k = iter.keys[iter.i];
_r = iter.t.Key(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = PtrTo(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = jsType(_r$1); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
$s = -1; return ($newDataPointer(iter.m[$externalize($internalize(k, $String), $String)].k, _r$2));
/* */ } return; } if ($f === undefined) { $f = { $blk: mapiterkey }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.it = it; $f.iter = iter; $f.k = k; $f.$s = $s; $f.$r = $r; return $f;
};
mapiternext = function(it) {
var it, iter;
iter = ((it));
iter.i = iter.i + (1) >> 0;
};
maplen = function(m) {
var m;
return $parseInt($keys(m).length);
};
cvtDirect = function(v, typ) {
var _1, _arg, _arg$1, _arg$2, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, k, slice, srcVal, typ, v, val, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; k = $f.k; slice = $f.slice; srcVal = $f.srcVal; typ = $f.typ; v = $f.v; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
srcVal = $clone(v, Value).object();
/* */ if (srcVal === jsType(v.typ).nil) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (srcVal === jsType(v.typ).nil) { */ case 1:
_r = makeValue(typ, jsType(typ).nil, v.flag); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } */ case 2:
val = null;
_r$1 = typ.Kind(); /* */ $s = 5; case 5: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
k = _r$1;
_1 = k;
/* */ if (_1 === (23)) { $s = 6; continue; }
/* */ if (_1 === (22)) { $s = 7; continue; }
/* */ if (_1 === (25)) { $s = 8; continue; }
/* */ if ((_1 === (17)) || (_1 === (1)) || (_1 === (18)) || (_1 === (19)) || (_1 === (20)) || (_1 === (21)) || (_1 === (24))) { $s = 9; continue; }
/* */ $s = 10; continue;
/* if (_1 === (23)) { */ case 6:
slice = new (jsType(typ))(srcVal.$array);
slice.$offset = srcVal.$offset;
slice.$length = srcVal.$length;
slice.$capacity = srcVal.$capacity;
val = $newDataPointer(slice, jsType(PtrTo(typ)));
$s = 11; continue;
/* } else if (_1 === (22)) { */ case 7:
_r$2 = typ.Elem(); /* */ $s = 14; case 14: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_r$3 = _r$2.Kind(); /* */ $s = 15; case 15: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
/* */ if (_r$3 === 25) { $s = 12; continue; }
/* */ $s = 13; continue;
/* if (_r$3 === 25) { */ case 12:
_r$4 = typ.Elem(); /* */ $s = 18; case 18: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
/* */ if ($interfaceIsEqual(_r$4, v.typ.Elem())) { $s = 16; continue; }
/* */ $s = 17; continue;
/* if ($interfaceIsEqual(_r$4, v.typ.Elem())) { */ case 16:
val = srcVal;
/* break; */ $s = 4; continue;
/* } */ case 17:
val = new (jsType(typ))();
_arg = val;
_arg$1 = srcVal;
_r$5 = typ.Elem(); /* */ $s = 19; case 19: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
_arg$2 = _r$5;
$r = copyStruct(_arg, _arg$1, _arg$2); /* */ $s = 20; case 20: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* break; */ $s = 4; continue;
/* } */ case 13:
val = new (jsType(typ))(srcVal.$get, srcVal.$set);
$s = 11; continue;
/* } else if (_1 === (25)) { */ case 8:
val = new (jsType(typ).ptr)();
copyStruct(val, srcVal, typ);
$s = 11; continue;
/* } else if ((_1 === (17)) || (_1 === (1)) || (_1 === (18)) || (_1 === (19)) || (_1 === (20)) || (_1 === (21)) || (_1 === (24))) { */ case 9:
val = v.ptr;
$s = 11; continue;
/* } else { */ case 10:
$panic(new ValueError.ptr("reflect.Convert", k));
/* } */ case 11:
case 4:
_r$6 = typ.common(); /* */ $s = 21; case 21: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
_r$7 = typ.Kind(); /* */ $s = 22; case 22: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
$s = -1; return new Value.ptr(_r$6, (val), (((v.flag & 224) >>> 0) | ((_r$7 >>> 0))) >>> 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtDirect }; } $f._1 = _1; $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f.k = k; $f.slice = slice; $f.srcVal = srcVal; $f.typ = typ; $f.v = v; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
};
methodReceiver = function(op, v, i) {
var _$38, fn, i, m, m$1, op, prop, rcvr, t, tt, ut, v, x, x$1;
_$38 = ptrType$1.nil;
t = ptrType$1.nil;
fn = 0;
prop = "";
if (v.typ.Kind() === 20) {
tt = (v.typ.kindType);
if (i < 0 || i >= tt.methods.$length) {
$panic(new $String("reflect: internal error: invalid method index"));
}
m = (x = tt.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
if (!$clone(tt.rtype.nameOff(m.name), name).isExported()) {
$panic(new $String("reflect: " + op + " of unexported method"));
}
t = tt.rtype.typeOff(m.typ);
prop = $clone(tt.rtype.nameOff(m.name), name).name();
} else {
ut = v.typ.uncommon();
if (ut === ptrType$5.nil || ((i >>> 0)) >= ((ut.mcount >>> 0))) {
$panic(new $String("reflect: internal error: invalid method index"));
}
m$1 = $clone((x$1 = ut.methods(), ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i])), method);
if (!$clone(v.typ.nameOff(m$1.name), name).isExported()) {
$panic(new $String("reflect: " + op + " of unexported method"));
}
t = v.typ.typeOff(m$1.mtyp);
prop = $internalize($methodSet(jsType(v.typ))[i].prop, $String);
}
rcvr = $clone(v, Value).object();
if (isWrapped(v.typ)) {
rcvr = new (jsType(v.typ))(rcvr);
}
fn = (rcvr[$externalize(prop, $String)]);
return [_$38, t, fn];
};
valueInterface = function(v, safe) {
var _r, safe, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; safe = $f.safe; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
if (v.flag === 0) {
$panic(new ValueError.ptr("reflect.Value.Interface", 0));
}
if (safe && !((((v.flag & 96) >>> 0) === 0))) {
$panic(new $String("reflect.Value.Interface: cannot return value obtained from unexported field or method"));
}
/* */ if (!((((v.flag & 512) >>> 0) === 0))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((((v.flag & 512) >>> 0) === 0))) { */ case 1:
_r = makeMethodValue("Interface", $clone(v, Value)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
v = _r;
/* } */ case 2:
if (isWrapped(v.typ)) {
$s = -1; return ((new (jsType(v.typ))($clone(v, Value).object())));
}
$s = -1; return (($clone(v, Value).object()));
/* */ } return; } if ($f === undefined) { $f = { $blk: valueInterface }; } $f._r = _r; $f.safe = safe; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
ifaceE2I = function(t, src, dst) {
var dst, src, t;
dst.$set(src);
};
methodName = function() {
return "?FIXME?";
};
makeMethodValue = function(op, v) {
var _r, _tuple, fn, fv, op, rcvr, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; fn = $f.fn; fv = $f.fv; op = $f.op; rcvr = $f.rcvr; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
fn = [fn];
rcvr = [rcvr];
if (((v.flag & 512) >>> 0) === 0) {
$panic(new $String("reflect: internal error: invalid use of makePartialFunc"));
}
_tuple = methodReceiver(op, $clone(v, Value), ((v.flag >> 0)) >> 10 >> 0);
fn[0] = _tuple[2];
rcvr[0] = $clone(v, Value).object();
if (isWrapped(v.typ)) {
rcvr[0] = new (jsType(v.typ))(rcvr[0]);
}
fv = js.MakeFunc((function(fn, rcvr) { return function(this$1, arguments$1) {
var arguments$1, this$1;
return new $jsObjectPtr(fn[0].apply(rcvr[0], $externalize(arguments$1, sliceType$8)));
}; })(fn, rcvr));
_r = $clone(v, Value).Type().common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return new Value.ptr(_r, (fv), (((v.flag & 96) >>> 0) | 19) >>> 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: makeMethodValue }; } $f._r = _r; $f._tuple = _tuple; $f.fn = fn; $f.fv = fv; $f.op = op; $f.rcvr = rcvr; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.ptr.prototype.pointers = function() {
var _1, t;
t = this;
_1 = t.Kind();
if ((_1 === (22)) || (_1 === (21)) || (_1 === (18)) || (_1 === (19)) || (_1 === (25)) || (_1 === (17))) {
return true;
} else {
return false;
}
};
rtype.prototype.pointers = function() { return this.$val.pointers(); };
rtype.ptr.prototype.Comparable = function() {
var _1, _r, _r$1, i, t, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; i = $f.i; t = $f.t; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_1 = t.Kind();
/* */ if ((_1 === (19)) || (_1 === (23)) || (_1 === (21))) { $s = 2; continue; }
/* */ if (_1 === (17)) { $s = 3; continue; }
/* */ if (_1 === (25)) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if ((_1 === (19)) || (_1 === (23)) || (_1 === (21))) { */ case 2:
$s = -1; return false;
/* } else if (_1 === (17)) { */ case 3:
_r = t.Elem().Comparable(); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } else if (_1 === (25)) { */ case 4:
i = 0;
/* while (true) { */ case 7:
/* if (!(i < t.NumField())) { break; } */ if(!(i < t.NumField())) { $s = 8; continue; }
_r$1 = t.Field(i).Type.Comparable(); /* */ $s = 11; case 11: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
/* */ if (!_r$1) { $s = 9; continue; }
/* */ $s = 10; continue;
/* if (!_r$1) { */ case 9:
$s = -1; return false;
/* } */ case 10:
i = i + (1) >> 0;
/* } */ $s = 7; continue; case 8:
/* } */ case 5:
case 1:
$s = -1; return true;
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.Comparable }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f.i = i; $f.t = t; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.Comparable = function() { return this.$val.Comparable(); };
rtype.ptr.prototype.Method = function(i) {
var _i, _i$1, _r, _r$1, _ref, _ref$1, arg, fl, fn, ft, i, in$1, m, methods, mt, mtyp, out, p, pname, prop, ret, t, tt, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _ref$1 = $f._ref$1; arg = $f.arg; fl = $f.fl; fn = $f.fn; ft = $f.ft; i = $f.i; in$1 = $f.in$1; m = $f.m; methods = $f.methods; mt = $f.mt; mtyp = $f.mtyp; out = $f.out; p = $f.p; pname = $f.pname; prop = $f.prop; ret = $f.ret; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
prop = [prop];
m = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
t = this;
if (t.Kind() === 20) {
tt = (t.kindType);
Method.copy(m, tt.Method(i));
$s = -1; return m;
}
_r = t.exportedMethods(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
methods = _r;
if (i < 0 || i >= methods.$length) {
$panic(new $String("reflect: Method index out of range"));
}
p = $clone(((i < 0 || i >= methods.$length) ? ($throwRuntimeError("index out of range"), undefined) : methods.$array[methods.$offset + i]), method);
pname = $clone(t.nameOff(p.name), name);
m.Name = $clone(pname, name).name();
fl = 19;
mtyp = t.typeOff(p.mtyp);
ft = (mtyp.kindType);
in$1 = $makeSlice(sliceType$10, 0, (1 + ft.in$().$length >> 0));
in$1 = $append(in$1, t);
_ref = ft.in$();
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
arg = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
in$1 = $append(in$1, arg);
_i++;
}
out = $makeSlice(sliceType$10, 0, ft.out().$length);
_ref$1 = ft.out();
_i$1 = 0;
while (true) {
if (!(_i$1 < _ref$1.$length)) { break; }
ret = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
out = $append(out, ret);
_i$1++;
}
_r$1 = FuncOf(in$1, out, ft.rtype.IsVariadic()); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
mt = _r$1;
m.Type = mt;
prop[0] = $internalize($methodSet(t.jsType)[i].prop, $String);
fn = js.MakeFunc((function(prop) { return function(this$1, arguments$1) {
var arguments$1, rcvr, this$1;
rcvr = (0 >= arguments$1.$length ? ($throwRuntimeError("index out of range"), undefined) : arguments$1.$array[arguments$1.$offset + 0]);
return new $jsObjectPtr(rcvr[$externalize(prop[0], $String)].apply(rcvr, $externalize($subslice(arguments$1, 1), sliceType$8)));
}; })(prop));
m.Func = new Value.ptr($assertType(mt, ptrType$1), (fn), fl);
m.Index = i;
Method.copy(m, m);
$s = -1; return m;
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.Method }; } $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._ref$1 = _ref$1; $f.arg = arg; $f.fl = fl; $f.fn = fn; $f.ft = ft; $f.i = i; $f.in$1 = in$1; $f.m = m; $f.methods = methods; $f.mt = mt; $f.mtyp = mtyp; $f.out = out; $f.p = p; $f.pname = pname; $f.prop = prop; $f.ret = ret; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.Method = function(i) { return this.$val.Method(i); };
Value.ptr.prototype.object = function() {
var _1, newVal, v, val;
v = this;
if ((v.typ.Kind() === 17) || (v.typ.Kind() === 25)) {
return v.ptr;
}
if (!((((v.flag & 128) >>> 0) === 0))) {
val = v.ptr.$get();
if (!(val === $ifaceNil) && !(val.constructor === jsType(v.typ))) {
switch (0) { default:
_1 = v.typ.Kind();
if ((_1 === (11)) || (_1 === (6))) {
val = new (jsType(v.typ))(val.$high, val.$low);
} else if ((_1 === (15)) || (_1 === (16))) {
val = new (jsType(v.typ))(val.$real, val.$imag);
} else if (_1 === (23)) {
if (val === val.constructor.nil) {
val = jsType(v.typ).nil;
break;
}
newVal = new (jsType(v.typ))(val.$array);
newVal.$offset = val.$offset;
newVal.$length = val.$length;
newVal.$capacity = val.$capacity;
val = newVal;
}
}
}
return val;
}
return v.ptr;
};
Value.prototype.object = function() { return this.$val.object(); };
Value.ptr.prototype.call = function(op, in$1) {
var _1, _arg, _arg$1, _arg$2, _arg$3, _i, _i$1, _i$2, _r, _r$1, _r$10, _r$11, _r$12, _r$13, _r$14, _r$15, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _r$9, _ref, _ref$1, _ref$2, _tmp, _tmp$1, _tuple, arg, argsArray, elem, fn, i, i$1, i$2, i$3, in$1, isSlice, m, n, nin, nout, op, origIn, rcvr, results, ret, slice, t, targ, v, x, x$1, x$2, xt, xt$1, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _arg$3 = $f._arg$3; _i = $f._i; _i$1 = $f._i$1; _i$2 = $f._i$2; _r = $f._r; _r$1 = $f._r$1; _r$10 = $f._r$10; _r$11 = $f._r$11; _r$12 = $f._r$12; _r$13 = $f._r$13; _r$14 = $f._r$14; _r$15 = $f._r$15; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _r$9 = $f._r$9; _ref = $f._ref; _ref$1 = $f._ref$1; _ref$2 = $f._ref$2; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; arg = $f.arg; argsArray = $f.argsArray; elem = $f.elem; fn = $f.fn; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; i$3 = $f.i$3; in$1 = $f.in$1; isSlice = $f.isSlice; m = $f.m; n = $f.n; nin = $f.nin; nout = $f.nout; op = $f.op; origIn = $f.origIn; rcvr = $f.rcvr; results = $f.results; ret = $f.ret; slice = $f.slice; t = $f.t; targ = $f.targ; v = $f.v; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; xt = $f.xt; xt$1 = $f.xt$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
t = ptrType$1.nil;
fn = 0;
rcvr = null;
if (!((((v.flag & 512) >>> 0) === 0))) {
_tuple = methodReceiver(op, $clone(v, Value), ((v.flag >> 0)) >> 10 >> 0);
t = _tuple[1];
fn = _tuple[2];
rcvr = $clone(v, Value).object();
if (isWrapped(v.typ)) {
rcvr = new (jsType(v.typ))(rcvr);
}
} else {
t = v.typ;
fn = ($clone(v, Value).object());
rcvr = undefined;
}
if (fn === 0) {
$panic(new $String("reflect.Value.Call: call of nil function"));
}
isSlice = op === "CallSlice";
n = t.NumIn();
if (isSlice) {
if (!t.IsVariadic()) {
$panic(new $String("reflect: CallSlice of non-variadic function"));
}
if (in$1.$length < n) {
$panic(new $String("reflect: CallSlice with too few input arguments"));
}
if (in$1.$length > n) {
$panic(new $String("reflect: CallSlice with too many input arguments"));
}
} else {
if (t.IsVariadic()) {
n = n - (1) >> 0;
}
if (in$1.$length < n) {
$panic(new $String("reflect: Call with too few input arguments"));
}
if (!t.IsVariadic() && in$1.$length > n) {
$panic(new $String("reflect: Call with too many input arguments"));
}
}
_ref = in$1;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
x = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
if ($clone(x, Value).Kind() === 0) {
$panic(new $String("reflect: " + op + " using zero Value argument"));
}
_i++;
}
i = 0;
/* while (true) { */ case 1:
/* if (!(i < n)) { break; } */ if(!(i < n)) { $s = 2; continue; }
_tmp = $clone(((i < 0 || i >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + i]), Value).Type();
_tmp$1 = t.In(i);
xt = _tmp;
targ = _tmp$1;
_r = xt.AssignableTo(targ); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (!_r) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (!_r) { */ case 3:
_r$1 = xt.String(); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = targ.String(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
$panic(new $String("reflect: " + op + " using " + _r$1 + " as type " + _r$2));
/* } */ case 4:
i = i + (1) >> 0;
/* } */ $s = 1; continue; case 2:
/* */ if (!isSlice && t.IsVariadic()) { $s = 8; continue; }
/* */ $s = 9; continue;
/* if (!isSlice && t.IsVariadic()) { */ case 8:
m = in$1.$length - n >> 0;
_r$3 = MakeSlice(t.In(n), m, m); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
slice = _r$3;
_r$4 = t.In(n).Elem(); /* */ $s = 11; case 11: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
elem = _r$4;
i$1 = 0;
/* while (true) { */ case 12:
/* if (!(i$1 < m)) { break; } */ if(!(i$1 < m)) { $s = 13; continue; }
x$2 = (x$1 = n + i$1 >> 0, ((x$1 < 0 || x$1 >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + x$1]));
xt$1 = $clone(x$2, Value).Type();
_r$5 = xt$1.AssignableTo(elem); /* */ $s = 16; case 16: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
/* */ if (!_r$5) { $s = 14; continue; }
/* */ $s = 15; continue;
/* if (!_r$5) { */ case 14:
_r$6 = xt$1.String(); /* */ $s = 17; case 17: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
_r$7 = elem.String(); /* */ $s = 18; case 18: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
$panic(new $String("reflect: cannot use " + _r$6 + " as type " + _r$7 + " in " + op));
/* } */ case 15:
_r$8 = $clone(slice, Value).Index(i$1); /* */ $s = 19; case 19: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
$r = $clone(_r$8, Value).Set($clone(x$2, Value)); /* */ $s = 20; case 20: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
i$1 = i$1 + (1) >> 0;
/* } */ $s = 12; continue; case 13:
origIn = in$1;
in$1 = $makeSlice(sliceType$9, (n + 1 >> 0));
$copySlice($subslice(in$1, 0, n), origIn);
((n < 0 || n >= in$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : in$1.$array[in$1.$offset + n] = slice);
/* } */ case 9:
nin = in$1.$length;
if (!((nin === t.NumIn()))) {
$panic(new $String("reflect.Value.Call: wrong argument count"));
}
nout = t.NumOut();
argsArray = new ($global.Array)(t.NumIn());
_ref$1 = in$1;
_i$1 = 0;
/* while (true) { */ case 21:
/* if (!(_i$1 < _ref$1.$length)) { break; } */ if(!(_i$1 < _ref$1.$length)) { $s = 22; continue; }
i$2 = _i$1;
arg = ((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]);
_arg = t.In(i$2);
_r$9 = t.In(i$2).common(); /* */ $s = 23; case 23: if($c) { $c = false; _r$9 = _r$9.$blk(); } if (_r$9 && _r$9.$blk !== undefined) { break s; }
_arg$1 = _r$9;
_arg$2 = 0;
_r$10 = $clone(arg, Value).assignTo("reflect.Value.Call", _arg$1, _arg$2); /* */ $s = 24; case 24: if($c) { $c = false; _r$10 = _r$10.$blk(); } if (_r$10 && _r$10.$blk !== undefined) { break s; }
_r$11 = $clone(_r$10, Value).object(); /* */ $s = 25; case 25: if($c) { $c = false; _r$11 = _r$11.$blk(); } if (_r$11 && _r$11.$blk !== undefined) { break s; }
_arg$3 = _r$11;
_r$12 = unwrapJsObject(_arg, _arg$3); /* */ $s = 26; case 26: if($c) { $c = false; _r$12 = _r$12.$blk(); } if (_r$12 && _r$12.$blk !== undefined) { break s; }
argsArray[i$2] = _r$12;
_i$1++;
/* } */ $s = 21; continue; case 22:
_r$13 = callHelper(new sliceType$3([new $jsObjectPtr(fn), new $jsObjectPtr(rcvr), new $jsObjectPtr(argsArray)])); /* */ $s = 27; case 27: if($c) { $c = false; _r$13 = _r$13.$blk(); } if (_r$13 && _r$13.$blk !== undefined) { break s; }
results = _r$13;
_1 = nout;
/* */ if (_1 === (0)) { $s = 29; continue; }
/* */ if (_1 === (1)) { $s = 30; continue; }
/* */ $s = 31; continue;
/* if (_1 === (0)) { */ case 29:
$s = -1; return sliceType$9.nil;
/* } else if (_1 === (1)) { */ case 30:
_r$14 = makeValue(t.Out(0), wrapJsObject(t.Out(0), results), 0); /* */ $s = 33; case 33: if($c) { $c = false; _r$14 = _r$14.$blk(); } if (_r$14 && _r$14.$blk !== undefined) { break s; }
$s = -1; return new sliceType$9([$clone(_r$14, Value)]);
/* } else { */ case 31:
ret = $makeSlice(sliceType$9, nout);
_ref$2 = ret;
_i$2 = 0;
/* while (true) { */ case 34:
/* if (!(_i$2 < _ref$2.$length)) { break; } */ if(!(_i$2 < _ref$2.$length)) { $s = 35; continue; }
i$3 = _i$2;
_r$15 = makeValue(t.Out(i$3), wrapJsObject(t.Out(i$3), results[i$3]), 0); /* */ $s = 36; case 36: if($c) { $c = false; _r$15 = _r$15.$blk(); } if (_r$15 && _r$15.$blk !== undefined) { break s; }
((i$3 < 0 || i$3 >= ret.$length) ? ($throwRuntimeError("index out of range"), undefined) : ret.$array[ret.$offset + i$3] = _r$15);
_i$2++;
/* } */ $s = 34; continue; case 35:
$s = -1; return ret;
/* } */ case 32:
case 28:
$s = -1; return sliceType$9.nil;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.call }; } $f._1 = _1; $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._arg$3 = _arg$3; $f._i = _i; $f._i$1 = _i$1; $f._i$2 = _i$2; $f._r = _r; $f._r$1 = _r$1; $f._r$10 = _r$10; $f._r$11 = _r$11; $f._r$12 = _r$12; $f._r$13 = _r$13; $f._r$14 = _r$14; $f._r$15 = _r$15; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._r$9 = _r$9; $f._ref = _ref; $f._ref$1 = _ref$1; $f._ref$2 = _ref$2; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.arg = arg; $f.argsArray = argsArray; $f.elem = elem; $f.fn = fn; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.i$3 = i$3; $f.in$1 = in$1; $f.isSlice = isSlice; $f.m = m; $f.n = n; $f.nin = nin; $f.nout = nout; $f.op = op; $f.origIn = origIn; $f.rcvr = rcvr; $f.results = results; $f.ret = ret; $f.slice = slice; $f.t = t; $f.targ = targ; $f.v = v; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.xt = xt; $f.xt$1 = xt$1; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.call = function(op, in$1) { return this.$val.call(op, in$1); };
Value.ptr.prototype.Cap = function() {
var _1, k, v;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (17)) {
return v.typ.Len();
} else if ((_1 === (18)) || (_1 === (23))) {
return $parseInt($clone(v, Value).object().$capacity) >> 0;
}
$panic(new ValueError.ptr("reflect.Value.Cap", k));
};
Value.prototype.Cap = function() { return this.$val.Cap(); };
wrapJsObject = function(typ, val) {
var typ, val;
if ($interfaceIsEqual(typ, jsObjectPtr)) {
return new (jsType(jsObjectPtr))(val);
}
return val;
};
unwrapJsObject = function(typ, val) {
var typ, val;
if ($interfaceIsEqual(typ, jsObjectPtr)) {
return val.object;
}
return val;
};
Value.ptr.prototype.Elem = function() {
var _1, _r, fl, k, tt, typ, v, val, val$1, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; fl = $f.fl; k = $f.k; tt = $f.tt; typ = $f.typ; v = $f.v; val = $f.val; val$1 = $f.val$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
k = new flag(v.flag).kind();
_1 = k;
/* */ if (_1 === (20)) { $s = 2; continue; }
/* */ if (_1 === (22)) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (_1 === (20)) { */ case 2:
val = $clone(v, Value).object();
if (val === $ifaceNil) {
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
}
typ = reflectType(val.constructor);
_r = makeValue(typ, val.$val, (v.flag & 96) >>> 0); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } else if (_1 === (22)) { */ case 3:
if ($clone(v, Value).IsNil()) {
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
}
val$1 = $clone(v, Value).object();
tt = (v.typ.kindType);
fl = (((((v.flag & 96) >>> 0) | 128) >>> 0) | 256) >>> 0;
fl = (fl | (((tt.elem.Kind() >>> 0)))) >>> 0;
$s = -1; return new Value.ptr(tt.elem, (wrapJsObject(tt.elem, val$1)), fl);
/* } else { */ case 4:
$panic(new ValueError.ptr("reflect.Value.Elem", k));
/* } */ case 5:
case 1:
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Elem }; } $f._1 = _1; $f._r = _r; $f.fl = fl; $f.k = k; $f.tt = tt; $f.typ = typ; $f.v = v; $f.val = val; $f.val$1 = val$1; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Elem = function() { return this.$val.Elem(); };
Value.ptr.prototype.Field = function(i) {
var _r, _r$1, _r$2, field, fl, i, jsTag, o, prop, s, tag, tt, typ, v, x, x$1, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; field = $f.field; fl = $f.fl; i = $f.i; jsTag = $f.jsTag; o = $f.o; prop = $f.prop; s = $f.s; tag = $f.tag; tt = $f.tt; typ = $f.typ; v = $f.v; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
jsTag = [jsTag];
prop = [prop];
s = [s];
typ = [typ];
v = this;
if (!((new flag(v.flag).kind() === 25))) {
$panic(new ValueError.ptr("reflect.Value.Field", new flag(v.flag).kind()));
}
tt = (v.typ.kindType);
if (((i >>> 0)) >= ((tt.fields.$length >>> 0))) {
$panic(new $String("reflect: Field index out of range"));
}
prop[0] = $internalize(jsType(v.typ).fields[i].prop, $String);
field = (x = tt.fields, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
typ[0] = field.typ;
fl = (((v.flag & 416) >>> 0) | ((typ[0].Kind() >>> 0))) >>> 0;
if (!$clone(field.name, name).isExported()) {
if (field.anon()) {
fl = (fl | (64)) >>> 0;
} else {
fl = (fl | (32)) >>> 0;
}
}
tag = $clone((x$1 = tt.fields, ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i])).name, name).tag();
/* */ if (!(tag === "") && !((i === 0))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!(tag === "") && !((i === 0))) { */ case 1:
jsTag[0] = getJsTag(tag);
/* */ if (!(jsTag[0] === "")) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (!(jsTag[0] === "")) { */ case 3:
/* while (true) { */ case 5:
o = [o];
_r = $clone(v, Value).Field(0); /* */ $s = 7; case 7: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
v = _r;
/* */ if (v.typ === jsObjectPtr) { $s = 8; continue; }
/* */ $s = 9; continue;
/* if (v.typ === jsObjectPtr) { */ case 8:
o[0] = $clone(v, Value).object().object;
$s = -1; return new Value.ptr(typ[0], (new (jsType(PtrTo(typ[0])))((function(jsTag, o, prop, s, typ) { return function() {
return $internalize(o[0][$externalize(jsTag[0], $String)], jsType(typ[0]));
}; })(jsTag, o, prop, s, typ), (function(jsTag, o, prop, s, typ) { return function(x$2) {
var x$2;
o[0][$externalize(jsTag[0], $String)] = $externalize(x$2, jsType(typ[0]));
}; })(jsTag, o, prop, s, typ))), fl);
/* } */ case 9:
/* */ if (v.typ.Kind() === 22) { $s = 10; continue; }
/* */ $s = 11; continue;
/* if (v.typ.Kind() === 22) { */ case 10:
_r$1 = $clone(v, Value).Elem(); /* */ $s = 12; case 12: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
v = _r$1;
/* } */ case 11:
/* } */ $s = 5; continue; case 6:
/* } */ case 4:
/* } */ case 2:
s[0] = v.ptr;
/* */ if (!((((fl & 128) >>> 0) === 0)) && !((typ[0].Kind() === 17)) && !((typ[0].Kind() === 25))) { $s = 13; continue; }
/* */ $s = 14; continue;
/* if (!((((fl & 128) >>> 0) === 0)) && !((typ[0].Kind() === 17)) && !((typ[0].Kind() === 25))) { */ case 13:
$s = -1; return new Value.ptr(typ[0], (new (jsType(PtrTo(typ[0])))((function(jsTag, prop, s, typ) { return function() {
return wrapJsObject(typ[0], s[0][$externalize(prop[0], $String)]);
}; })(jsTag, prop, s, typ), (function(jsTag, prop, s, typ) { return function(x$2) {
var x$2;
s[0][$externalize(prop[0], $String)] = unwrapJsObject(typ[0], x$2);
}; })(jsTag, prop, s, typ))), fl);
/* } */ case 14:
_r$2 = makeValue(typ[0], wrapJsObject(typ[0], s[0][$externalize(prop[0], $String)]), fl); /* */ $s = 15; case 15: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
$s = -1; return _r$2;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Field }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.field = field; $f.fl = fl; $f.i = i; $f.jsTag = jsTag; $f.o = o; $f.prop = prop; $f.s = s; $f.tag = tag; $f.tt = tt; $f.typ = typ; $f.v = v; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Field = function(i) { return this.$val.Field(i); };
getJsTag = function(tag) {
var _tuple, i, name$1, qvalue, tag, value;
while (true) {
if (!(!(tag === ""))) { break; }
i = 0;
while (true) {
if (!(i < tag.length && (tag.charCodeAt(i) === 32))) { break; }
i = i + (1) >> 0;
}
tag = $substring(tag, i);
if (tag === "") {
break;
}
i = 0;
while (true) {
if (!(i < tag.length && !((tag.charCodeAt(i) === 32)) && !((tag.charCodeAt(i) === 58)) && !((tag.charCodeAt(i) === 34)))) { break; }
i = i + (1) >> 0;
}
if ((i + 1 >> 0) >= tag.length || !((tag.charCodeAt(i) === 58)) || !((tag.charCodeAt((i + 1 >> 0)) === 34))) {
break;
}
name$1 = ($substring(tag, 0, i));
tag = $substring(tag, (i + 1 >> 0));
i = 1;
while (true) {
if (!(i < tag.length && !((tag.charCodeAt(i) === 34)))) { break; }
if (tag.charCodeAt(i) === 92) {
i = i + (1) >> 0;
}
i = i + (1) >> 0;
}
if (i >= tag.length) {
break;
}
qvalue = ($substring(tag, 0, (i + 1 >> 0)));
tag = $substring(tag, (i + 1 >> 0));
if (name$1 === "js") {
_tuple = strconv.Unquote(qvalue);
value = _tuple[0];
return value;
}
}
return "";
};
Value.ptr.prototype.Index = function(i) {
var _1, _r, _r$1, a, a$1, c, fl, fl$1, fl$2, i, k, s, str, tt, tt$1, typ, typ$1, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; a = $f.a; a$1 = $f.a$1; c = $f.c; fl = $f.fl; fl$1 = $f.fl$1; fl$2 = $f.fl$2; i = $f.i; k = $f.k; s = $f.s; str = $f.str; tt = $f.tt; tt$1 = $f.tt$1; typ = $f.typ; typ$1 = $f.typ$1; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
a = [a];
a$1 = [a$1];
c = [c];
i = [i];
typ = [typ];
typ$1 = [typ$1];
v = this;
k = new flag(v.flag).kind();
_1 = k;
/* */ if (_1 === (17)) { $s = 2; continue; }
/* */ if (_1 === (23)) { $s = 3; continue; }
/* */ if (_1 === (24)) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (_1 === (17)) { */ case 2:
tt = (v.typ.kindType);
if (i[0] < 0 || i[0] > ((tt.len >> 0))) {
$panic(new $String("reflect: array index out of range"));
}
typ[0] = tt.elem;
fl = (v.flag & 480) >>> 0;
fl = (fl | (((typ[0].Kind() >>> 0)))) >>> 0;
a[0] = v.ptr;
/* */ if (!((((fl & 128) >>> 0) === 0)) && !((typ[0].Kind() === 17)) && !((typ[0].Kind() === 25))) { $s = 7; continue; }
/* */ $s = 8; continue;
/* if (!((((fl & 128) >>> 0) === 0)) && !((typ[0].Kind() === 17)) && !((typ[0].Kind() === 25))) { */ case 7:
$s = -1; return new Value.ptr(typ[0], (new (jsType(PtrTo(typ[0])))((function(a, a$1, c, i, typ, typ$1) { return function() {
return wrapJsObject(typ[0], a[0][i[0]]);
}; })(a, a$1, c, i, typ, typ$1), (function(a, a$1, c, i, typ, typ$1) { return function(x) {
var x;
a[0][i[0]] = unwrapJsObject(typ[0], x);
}; })(a, a$1, c, i, typ, typ$1))), fl);
/* } */ case 8:
_r = makeValue(typ[0], wrapJsObject(typ[0], a[0][i[0]]), fl); /* */ $s = 9; case 9: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } else if (_1 === (23)) { */ case 3:
s = $clone(v, Value).object();
if (i[0] < 0 || i[0] >= ($parseInt(s.$length) >> 0)) {
$panic(new $String("reflect: slice index out of range"));
}
tt$1 = (v.typ.kindType);
typ$1[0] = tt$1.elem;
fl$1 = (384 | ((v.flag & 96) >>> 0)) >>> 0;
fl$1 = (fl$1 | (((typ$1[0].Kind() >>> 0)))) >>> 0;
i[0] = i[0] + (($parseInt(s.$offset) >> 0)) >> 0;
a$1[0] = s.$array;
/* */ if (!((((fl$1 & 128) >>> 0) === 0)) && !((typ$1[0].Kind() === 17)) && !((typ$1[0].Kind() === 25))) { $s = 10; continue; }
/* */ $s = 11; continue;
/* if (!((((fl$1 & 128) >>> 0) === 0)) && !((typ$1[0].Kind() === 17)) && !((typ$1[0].Kind() === 25))) { */ case 10:
$s = -1; return new Value.ptr(typ$1[0], (new (jsType(PtrTo(typ$1[0])))((function(a, a$1, c, i, typ, typ$1) { return function() {
return wrapJsObject(typ$1[0], a$1[0][i[0]]);
}; })(a, a$1, c, i, typ, typ$1), (function(a, a$1, c, i, typ, typ$1) { return function(x) {
var x;
a$1[0][i[0]] = unwrapJsObject(typ$1[0], x);
}; })(a, a$1, c, i, typ, typ$1))), fl$1);
/* } */ case 11:
_r$1 = makeValue(typ$1[0], wrapJsObject(typ$1[0], a$1[0][i[0]]), fl$1); /* */ $s = 12; case 12: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* } else if (_1 === (24)) { */ case 4:
str = (v.ptr).$get();
if (i[0] < 0 || i[0] >= str.length) {
$panic(new $String("reflect: string index out of range"));
}
fl$2 = (((v.flag & 96) >>> 0) | 8) >>> 0;
c[0] = str.charCodeAt(i[0]);
$s = -1; return new Value.ptr(uint8Type, ((c.$ptr || (c.$ptr = new ptrType$4(function() { return this.$target[0]; }, function($v) { this.$target[0] = $v; }, c)))), (fl$2 | 128) >>> 0);
/* } else { */ case 5:
$panic(new ValueError.ptr("reflect.Value.Index", k));
/* } */ case 6:
case 1:
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Index }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f.a = a; $f.a$1 = a$1; $f.c = c; $f.fl = fl; $f.fl$1 = fl$1; $f.fl$2 = fl$2; $f.i = i; $f.k = k; $f.s = s; $f.str = str; $f.tt = tt; $f.tt$1 = tt$1; $f.typ = typ; $f.typ$1 = typ$1; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Index = function(i) { return this.$val.Index(i); };
Value.ptr.prototype.InterfaceData = function() {
var v;
v = this;
$panic(errors.New("InterfaceData is not supported by GopherJS"));
};
Value.prototype.InterfaceData = function() { return this.$val.InterfaceData(); };
Value.ptr.prototype.IsNil = function() {
var _1, k, v;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if ((_1 === (22)) || (_1 === (23))) {
return $clone(v, Value).object() === jsType(v.typ).nil;
} else if (_1 === (18)) {
return $clone(v, Value).object() === $chanNil;
} else if (_1 === (19)) {
return $clone(v, Value).object() === $throwNilPointerError;
} else if (_1 === (21)) {
return $clone(v, Value).object() === false;
} else if (_1 === (20)) {
return $clone(v, Value).object() === $ifaceNil;
} else {
$panic(new ValueError.ptr("reflect.Value.IsNil", k));
}
};
Value.prototype.IsNil = function() { return this.$val.IsNil(); };
Value.ptr.prototype.Len = function() {
var _1, k, v;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if ((_1 === (17)) || (_1 === (24))) {
return $parseInt($clone(v, Value).object().length);
} else if (_1 === (23)) {
return $parseInt($clone(v, Value).object().$length) >> 0;
} else if (_1 === (18)) {
return $parseInt($clone(v, Value).object().$buffer.length) >> 0;
} else if (_1 === (21)) {
return $parseInt($keys($clone(v, Value).object()).length);
} else {
$panic(new ValueError.ptr("reflect.Value.Len", k));
}
};
Value.prototype.Len = function() { return this.$val.Len(); };
Value.ptr.prototype.Pointer = function() {
var _1, k, v;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if ((_1 === (18)) || (_1 === (21)) || (_1 === (22)) || (_1 === (26))) {
if ($clone(v, Value).IsNil()) {
return 0;
}
return $clone(v, Value).object();
} else if (_1 === (19)) {
if ($clone(v, Value).IsNil()) {
return 0;
}
return 1;
} else if (_1 === (23)) {
if ($clone(v, Value).IsNil()) {
return 0;
}
return $clone(v, Value).object().$array;
} else {
$panic(new ValueError.ptr("reflect.Value.Pointer", k));
}
};
Value.prototype.Pointer = function() { return this.$val.Pointer(); };
Value.ptr.prototype.Set = function(x) {
var _1, _r, _r$1, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBeAssignable();
new flag(x.flag).mustBeExported();
_r = $clone(x, Value).assignTo("reflect.Set", v.typ, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
x = _r;
/* */ if (!((((v.flag & 128) >>> 0) === 0))) { $s = 2; continue; }
/* */ $s = 3; continue;
/* if (!((((v.flag & 128) >>> 0) === 0))) { */ case 2:
_1 = v.typ.Kind();
/* */ if (_1 === (17)) { $s = 5; continue; }
/* */ if (_1 === (20)) { $s = 6; continue; }
/* */ if (_1 === (25)) { $s = 7; continue; }
/* */ $s = 8; continue;
/* if (_1 === (17)) { */ case 5:
jsType(v.typ).copy(v.ptr, x.ptr);
$s = 9; continue;
/* } else if (_1 === (20)) { */ case 6:
_r$1 = valueInterface($clone(x, Value), false); /* */ $s = 10; case 10: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
v.ptr.$set(_r$1);
$s = 9; continue;
/* } else if (_1 === (25)) { */ case 7:
copyStruct(v.ptr, x.ptr, v.typ);
$s = 9; continue;
/* } else { */ case 8:
v.ptr.$set($clone(x, Value).object());
/* } */ case 9:
case 4:
$s = -1; return;
/* } */ case 3:
v.ptr = x.ptr;
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Set }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Set = function(x) { return this.$val.Set(x); };
Value.ptr.prototype.SetBytes = function(x) {
var _r, _r$1, _v, slice, typedSlice, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _v = $f._v; slice = $f.slice; typedSlice = $f.typedSlice; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBeAssignable();
new flag(v.flag).mustBe(23);
_r = v.typ.Elem().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (!((_r === 8))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((_r === 8))) { */ case 1:
$panic(new $String("reflect.Value.SetBytes of non-byte slice"));
/* } */ case 2:
slice = x;
if (!(v.typ.Name() === "")) { _v = true; $s = 6; continue s; }
_r$1 = v.typ.Elem().Name(); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_v = !(_r$1 === ""); case 6:
/* */ if (_v) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (_v) { */ case 4:
typedSlice = new (jsType(v.typ))(slice.$array);
typedSlice.$offset = slice.$offset;
typedSlice.$length = slice.$length;
typedSlice.$capacity = slice.$capacity;
slice = typedSlice;
/* } */ case 5:
v.ptr.$set(slice);
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.SetBytes }; } $f._r = _r; $f._r$1 = _r$1; $f._v = _v; $f.slice = slice; $f.typedSlice = typedSlice; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.SetBytes = function(x) { return this.$val.SetBytes(x); };
Value.ptr.prototype.SetCap = function(n) {
var n, newSlice, s, v;
v = this;
new flag(v.flag).mustBeAssignable();
new flag(v.flag).mustBe(23);
s = v.ptr.$get();
if (n < ($parseInt(s.$length) >> 0) || n > ($parseInt(s.$capacity) >> 0)) {
$panic(new $String("reflect: slice capacity out of range in SetCap"));
}
newSlice = new (jsType(v.typ))(s.$array);
newSlice.$offset = s.$offset;
newSlice.$length = s.$length;
newSlice.$capacity = n;
v.ptr.$set(newSlice);
};
Value.prototype.SetCap = function(n) { return this.$val.SetCap(n); };
Value.ptr.prototype.SetLen = function(n) {
var n, newSlice, s, v;
v = this;
new flag(v.flag).mustBeAssignable();
new flag(v.flag).mustBe(23);
s = v.ptr.$get();
if (n < 0 || n > ($parseInt(s.$capacity) >> 0)) {
$panic(new $String("reflect: slice length out of range in SetLen"));
}
newSlice = new (jsType(v.typ))(s.$array);
newSlice.$offset = s.$offset;
newSlice.$length = n;
newSlice.$capacity = s.$capacity;
v.ptr.$set(newSlice);
};
Value.prototype.SetLen = function(n) { return this.$val.SetLen(n); };
Value.ptr.prototype.Slice = function(i, j) {
var _1, _r, _r$1, cap, i, j, kind, s, str, tt, typ, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; _r$1 = $f._r$1; cap = $f.cap; i = $f.i; j = $f.j; kind = $f.kind; s = $f.s; str = $f.str; tt = $f.tt; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
cap = 0;
typ = $ifaceNil;
s = null;
kind = new flag(v.flag).kind();
_1 = kind;
/* */ if (_1 === (17)) { $s = 2; continue; }
/* */ if (_1 === (23)) { $s = 3; continue; }
/* */ if (_1 === (24)) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (_1 === (17)) { */ case 2:
if (((v.flag & 256) >>> 0) === 0) {
$panic(new $String("reflect.Value.Slice: slice of unaddressable array"));
}
tt = (v.typ.kindType);
cap = ((tt.len >> 0));
typ = SliceOf(tt.elem);
s = new (jsType(typ))($clone(v, Value).object());
$s = 6; continue;
/* } else if (_1 === (23)) { */ case 3:
typ = v.typ;
s = $clone(v, Value).object();
cap = $parseInt(s.$capacity) >> 0;
$s = 6; continue;
/* } else if (_1 === (24)) { */ case 4:
str = (v.ptr).$get();
if (i < 0 || j < i || j > str.length) {
$panic(new $String("reflect.Value.Slice: string slice index out of bounds"));
}
_r = ValueOf(new $String($substring(str, i, j))); /* */ $s = 7; case 7: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } else { */ case 5:
$panic(new ValueError.ptr("reflect.Value.Slice", kind));
/* } */ case 6:
case 1:
if (i < 0 || j < i || j > cap) {
$panic(new $String("reflect.Value.Slice: slice index out of bounds"));
}
_r$1 = makeValue(typ, $subslice(s, i, j), (v.flag & 96) >>> 0); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Slice }; } $f._1 = _1; $f._r = _r; $f._r$1 = _r$1; $f.cap = cap; $f.i = i; $f.j = j; $f.kind = kind; $f.s = s; $f.str = str; $f.tt = tt; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Slice = function(i, j) { return this.$val.Slice(i, j); };
Value.ptr.prototype.Slice3 = function(i, j, k) {
var _1, _r, cap, i, j, k, kind, s, tt, typ, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; cap = $f.cap; i = $f.i; j = $f.j; k = $f.k; kind = $f.kind; s = $f.s; tt = $f.tt; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
cap = 0;
typ = $ifaceNil;
s = null;
kind = new flag(v.flag).kind();
_1 = kind;
if (_1 === (17)) {
if (((v.flag & 256) >>> 0) === 0) {
$panic(new $String("reflect.Value.Slice: slice of unaddressable array"));
}
tt = (v.typ.kindType);
cap = ((tt.len >> 0));
typ = SliceOf(tt.elem);
s = new (jsType(typ))($clone(v, Value).object());
} else if (_1 === (23)) {
typ = v.typ;
s = $clone(v, Value).object();
cap = $parseInt(s.$capacity) >> 0;
} else {
$panic(new ValueError.ptr("reflect.Value.Slice3", kind));
}
if (i < 0 || j < i || k < j || k > cap) {
$panic(new $String("reflect.Value.Slice3: slice index out of bounds"));
}
_r = makeValue(typ, $subslice(s, i, j, k), (v.flag & 96) >>> 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Slice3 }; } $f._1 = _1; $f._r = _r; $f.cap = cap; $f.i = i; $f.j = j; $f.k = k; $f.kind = kind; $f.s = s; $f.tt = tt; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Slice3 = function(i, j, k) { return this.$val.Slice3(i, j, k); };
Value.ptr.prototype.Close = function() {
var v;
v = this;
new flag(v.flag).mustBe(18);
new flag(v.flag).mustBeExported();
$close($clone(v, Value).object());
};
Value.prototype.Close = function() { return this.$val.Close(); };
chanrecv = function(ch, nb, val) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, ch, comms, nb, received, recvRes, selectRes, selected, val, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; ch = $f.ch; comms = $f.comms; nb = $f.nb; received = $f.received; recvRes = $f.recvRes; selectRes = $f.selectRes; selected = $f.selected; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
selected = false;
received = false;
comms = new sliceType$11([new sliceType$8([ch])]);
if (nb) {
comms = $append(comms, new sliceType$8([]));
}
_r = selectHelper(new sliceType$3([comms])); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
selectRes = _r;
if (nb && (($parseInt(selectRes[0]) >> 0) === 1)) {
_tmp = false;
_tmp$1 = false;
selected = _tmp;
received = _tmp$1;
$s = -1; return [selected, received];
}
recvRes = selectRes[1];
val.$set(recvRes[0]);
_tmp$2 = true;
_tmp$3 = !!(recvRes[1]);
selected = _tmp$2;
received = _tmp$3;
$s = -1; return [selected, received];
/* */ } return; } if ($f === undefined) { $f = { $blk: chanrecv }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f.ch = ch; $f.comms = comms; $f.nb = nb; $f.received = received; $f.recvRes = recvRes; $f.selectRes = selectRes; $f.selected = selected; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
};
chansend = function(ch, val, nb) {
var _r, ch, comms, nb, selectRes, val, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; ch = $f.ch; comms = $f.comms; nb = $f.nb; selectRes = $f.selectRes; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
comms = new sliceType$11([new sliceType$8([ch, val.$get()])]);
if (nb) {
comms = $append(comms, new sliceType$8([]));
}
_r = selectHelper(new sliceType$3([comms])); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
selectRes = _r;
if (nb && (($parseInt(selectRes[0]) >> 0) === 1)) {
$s = -1; return false;
}
$s = -1; return true;
/* */ } return; } if ($f === undefined) { $f = { $blk: chansend }; } $f._r = _r; $f.ch = ch; $f.comms = comms; $f.nb = nb; $f.selectRes = selectRes; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
};
structField.ptr.prototype.offset = function() {
var f;
f = this;
return f.offsetAnon >>> 1 >>> 0;
};
structField.prototype.offset = function() { return this.$val.offset(); };
structField.ptr.prototype.anon = function() {
var f;
f = this;
return !((((f.offsetAnon & 1) >>> 0) === 0));
};
structField.prototype.anon = function() { return this.$val.anon(); };
Kind.prototype.String = function() {
var k;
k = this.$val;
if (((k >> 0)) < kindNames.$length) {
return ((k < 0 || k >= kindNames.$length) ? ($throwRuntimeError("index out of range"), undefined) : kindNames.$array[kindNames.$offset + k]);
}
return "kind" + strconv.Itoa(((k >> 0)));
};
$ptrType(Kind).prototype.String = function() { return new Kind(this.$get()).String(); };
rtype.ptr.prototype.String = function() {
var s, t;
t = this;
s = $clone(t.nameOff(t.str), name).name();
if (!((((t.tflag & 2) >>> 0) === 0))) {
return $substring(s, 1);
}
return s;
};
rtype.prototype.String = function() { return this.$val.String(); };
rtype.ptr.prototype.Size = function() {
var t;
t = this;
return t.size;
};
rtype.prototype.Size = function() { return this.$val.Size(); };
rtype.ptr.prototype.Bits = function() {
var k, t;
t = this;
if (t === ptrType$1.nil) {
$panic(new $String("reflect: Bits of nil Type"));
}
k = t.Kind();
if (k < 2 || k > 16) {
$panic(new $String("reflect: Bits of non-arithmetic Type " + t.String()));
}
return $imul(((t.size >> 0)), 8);
};
rtype.prototype.Bits = function() { return this.$val.Bits(); };
rtype.ptr.prototype.Align = function() {
var t;
t = this;
return ((t.align >> 0));
};
rtype.prototype.Align = function() { return this.$val.Align(); };
rtype.ptr.prototype.FieldAlign = function() {
var t;
t = this;
return ((t.fieldAlign >> 0));
};
rtype.prototype.FieldAlign = function() { return this.$val.FieldAlign(); };
rtype.ptr.prototype.Kind = function() {
var t;
t = this;
return ((((t.kind & 31) >>> 0) >>> 0));
};
rtype.prototype.Kind = function() { return this.$val.Kind(); };
rtype.ptr.prototype.common = function() {
var t;
t = this;
return t;
};
rtype.prototype.common = function() { return this.$val.common(); };
rtype.ptr.prototype.exportedMethods = function() {
var _i, _i$1, _r, _r$1, _ref, _ref$1, _tuple, _tuple$1, allExported, allm, found, m, m$1, methods, methodsi, name$1, name$2, t, ut, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _i$1 = $f._i$1; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _ref$1 = $f._ref$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; allExported = $f.allExported; allm = $f.allm; found = $f.found; m = $f.m; m$1 = $f.m$1; methods = $f.methods; methodsi = $f.methodsi; name$1 = $f.name$1; name$2 = $f.name$2; t = $f.t; ut = $f.ut; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
_r = methodCache.Load(t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
methodsi = _tuple[0];
found = _tuple[1];
if (found) {
$s = -1; return $assertType(methodsi, sliceType$5);
}
ut = t.uncommon();
if (ut === ptrType$5.nil) {
$s = -1; return sliceType$5.nil;
}
allm = ut.methods();
allExported = true;
_ref = allm;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
m = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), method);
name$1 = $clone(t.nameOff(m.name), name);
if (!$clone(name$1, name).isExported()) {
allExported = false;
break;
}
_i++;
}
methods = sliceType$5.nil;
if (allExported) {
methods = allm;
} else {
methods = $makeSlice(sliceType$5, 0, allm.$length);
_ref$1 = allm;
_i$1 = 0;
while (true) {
if (!(_i$1 < _ref$1.$length)) { break; }
m$1 = $clone(((_i$1 < 0 || _i$1 >= _ref$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref$1.$array[_ref$1.$offset + _i$1]), method);
name$2 = $clone(t.nameOff(m$1.name), name);
if ($clone(name$2, name).isExported()) {
methods = $append(methods, m$1);
}
_i$1++;
}
methods = $subslice(methods, 0, methods.$length, methods.$length);
}
_r$1 = methodCache.LoadOrStore(t, methods); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple$1 = _r$1;
methodsi = _tuple$1[0];
$s = -1; return $assertType(methodsi, sliceType$5);
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.exportedMethods }; } $f._i = _i; $f._i$1 = _i$1; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._ref$1 = _ref$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f.allExported = allExported; $f.allm = allm; $f.found = found; $f.m = m; $f.m$1 = m$1; $f.methods = methods; $f.methodsi = methodsi; $f.name$1 = name$1; $f.name$2 = name$2; $f.t = t; $f.ut = ut; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.exportedMethods = function() { return this.$val.exportedMethods(); };
rtype.ptr.prototype.NumMethod = function() {
var _r, t, tt, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
if (t.Kind() === 20) {
tt = (t.kindType);
$s = -1; return tt.NumMethod();
}
if (((t.tflag & 1) >>> 0) === 0) {
$s = -1; return 0;
}
_r = t.exportedMethods(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r.$length;
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.NumMethod }; } $f._r = _r; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.NumMethod = function() { return this.$val.NumMethod(); };
rtype.ptr.prototype.MethodByName = function(name$1) {
var _r, _tmp, _tmp$1, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tuple, i, m, name$1, ok, p, pname, t, tt, ut, utmethods, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; _tmp$4 = $f._tmp$4; _tmp$5 = $f._tmp$5; _tuple = $f._tuple; i = $f.i; m = $f.m; name$1 = $f.name$1; ok = $f.ok; p = $f.p; pname = $f.pname; t = $f.t; tt = $f.tt; ut = $f.ut; utmethods = $f.utmethods; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
m = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
ok = false;
t = this;
if (t.Kind() === 20) {
tt = (t.kindType);
_tuple = tt.MethodByName(name$1);
Method.copy(m, _tuple[0]);
ok = _tuple[1];
$s = -1; return [m, ok];
}
ut = t.uncommon();
if (ut === ptrType$5.nil) {
_tmp = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
_tmp$1 = false;
Method.copy(m, _tmp);
ok = _tmp$1;
$s = -1; return [m, ok];
}
utmethods = ut.methods();
i = 0;
/* while (true) { */ case 1:
/* if (!(i < ((ut.mcount >> 0)))) { break; } */ if(!(i < ((ut.mcount >> 0)))) { $s = 2; continue; }
p = $clone(((i < 0 || i >= utmethods.$length) ? ($throwRuntimeError("index out of range"), undefined) : utmethods.$array[utmethods.$offset + i]), method);
pname = $clone(t.nameOff(p.name), name);
/* */ if ($clone(pname, name).isExported() && $clone(pname, name).name() === name$1) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if ($clone(pname, name).isExported() && $clone(pname, name).name() === name$1) { */ case 3:
_r = t.Method(i); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tmp$2 = $clone(_r, Method);
_tmp$3 = true;
Method.copy(m, _tmp$2);
ok = _tmp$3;
$s = -1; return [m, ok];
/* } */ case 4:
i = i + (1) >> 0;
/* } */ $s = 1; continue; case 2:
_tmp$4 = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
_tmp$5 = false;
Method.copy(m, _tmp$4);
ok = _tmp$5;
$s = -1; return [m, ok];
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.MethodByName }; } $f._r = _r; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f._tmp$4 = _tmp$4; $f._tmp$5 = _tmp$5; $f._tuple = _tuple; $f.i = i; $f.m = m; $f.name$1 = name$1; $f.ok = ok; $f.p = p; $f.pname = pname; $f.t = t; $f.tt = tt; $f.ut = ut; $f.utmethods = utmethods; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.MethodByName = function(name$1) { return this.$val.MethodByName(name$1); };
rtype.ptr.prototype.PkgPath = function() {
var t, ut;
t = this;
if (((t.tflag & 4) >>> 0) === 0) {
return "";
}
ut = t.uncommon();
if (ut === ptrType$5.nil) {
return "";
}
return $clone(t.nameOff(ut.pkgPath), name).name();
};
rtype.prototype.PkgPath = function() { return this.$val.PkgPath(); };
rtype.ptr.prototype.Name = function() {
var i, s, t;
t = this;
if (((t.tflag & 4) >>> 0) === 0) {
return "";
}
s = t.String();
i = s.length - 1 >> 0;
while (true) {
if (!(i >= 0)) { break; }
if (s.charCodeAt(i) === 46) {
break;
}
i = i - (1) >> 0;
}
return $substring(s, (i + 1 >> 0));
};
rtype.prototype.Name = function() { return this.$val.Name(); };
rtype.ptr.prototype.ChanDir = function() {
var t, tt;
t = this;
if (!((t.Kind() === 18))) {
$panic(new $String("reflect: ChanDir of non-chan type"));
}
tt = (t.kindType);
return ((tt.dir >> 0));
};
rtype.prototype.ChanDir = function() { return this.$val.ChanDir(); };
rtype.ptr.prototype.IsVariadic = function() {
var t, tt;
t = this;
if (!((t.Kind() === 19))) {
$panic(new $String("reflect: IsVariadic of non-func type"));
}
tt = (t.kindType);
return !((((tt.outCount & 32768) >>> 0) === 0));
};
rtype.prototype.IsVariadic = function() { return this.$val.IsVariadic(); };
rtype.ptr.prototype.Elem = function() {
var _1, t, tt, tt$1, tt$2, tt$3, tt$4;
t = this;
_1 = t.Kind();
if (_1 === (17)) {
tt = (t.kindType);
return toType(tt.elem);
} else if (_1 === (18)) {
tt$1 = (t.kindType);
return toType(tt$1.elem);
} else if (_1 === (21)) {
tt$2 = (t.kindType);
return toType(tt$2.elem);
} else if (_1 === (22)) {
tt$3 = (t.kindType);
return toType(tt$3.elem);
} else if (_1 === (23)) {
tt$4 = (t.kindType);
return toType(tt$4.elem);
}
$panic(new $String("reflect: Elem of invalid type"));
};
rtype.prototype.Elem = function() { return this.$val.Elem(); };
rtype.ptr.prototype.Field = function(i) {
var i, t, tt;
t = this;
if (!((t.Kind() === 25))) {
$panic(new $String("reflect: Field of non-struct type"));
}
tt = (t.kindType);
return tt.Field(i);
};
rtype.prototype.Field = function(i) { return this.$val.Field(i); };
rtype.ptr.prototype.FieldByIndex = function(index) {
var _r, index, t, tt, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; index = $f.index; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
if (!((t.Kind() === 25))) {
$panic(new $String("reflect: FieldByIndex of non-struct type"));
}
tt = (t.kindType);
_r = tt.FieldByIndex(index); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.FieldByIndex }; } $f._r = _r; $f.index = index; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.FieldByIndex = function(index) { return this.$val.FieldByIndex(index); };
rtype.ptr.prototype.FieldByName = function(name$1) {
var _r, name$1, t, tt, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; name$1 = $f.name$1; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
if (!((t.Kind() === 25))) {
$panic(new $String("reflect: FieldByName of non-struct type"));
}
tt = (t.kindType);
_r = tt.FieldByName(name$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.FieldByName }; } $f._r = _r; $f.name$1 = name$1; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.FieldByName = function(name$1) { return this.$val.FieldByName(name$1); };
rtype.ptr.prototype.FieldByNameFunc = function(match) {
var _r, match, t, tt, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; match = $f.match; t = $f.t; tt = $f.tt; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
if (!((t.Kind() === 25))) {
$panic(new $String("reflect: FieldByNameFunc of non-struct type"));
}
tt = (t.kindType);
_r = tt.FieldByNameFunc(match); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.FieldByNameFunc }; } $f._r = _r; $f.match = match; $f.t = t; $f.tt = tt; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.FieldByNameFunc = function(match) { return this.$val.FieldByNameFunc(match); };
rtype.ptr.prototype.In = function(i) {
var i, t, tt, x;
t = this;
if (!((t.Kind() === 19))) {
$panic(new $String("reflect: In of non-func type"));
}
tt = (t.kindType);
return toType((x = tt.in$(), ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])));
};
rtype.prototype.In = function(i) { return this.$val.In(i); };
rtype.ptr.prototype.Key = function() {
var t, tt;
t = this;
if (!((t.Kind() === 21))) {
$panic(new $String("reflect: Key of non-map type"));
}
tt = (t.kindType);
return toType(tt.key);
};
rtype.prototype.Key = function() { return this.$val.Key(); };
rtype.ptr.prototype.Len = function() {
var t, tt;
t = this;
if (!((t.Kind() === 17))) {
$panic(new $String("reflect: Len of non-array type"));
}
tt = (t.kindType);
return ((tt.len >> 0));
};
rtype.prototype.Len = function() { return this.$val.Len(); };
rtype.ptr.prototype.NumField = function() {
var t, tt;
t = this;
if (!((t.Kind() === 25))) {
$panic(new $String("reflect: NumField of non-struct type"));
}
tt = (t.kindType);
return tt.fields.$length;
};
rtype.prototype.NumField = function() { return this.$val.NumField(); };
rtype.ptr.prototype.NumIn = function() {
var t, tt;
t = this;
if (!((t.Kind() === 19))) {
$panic(new $String("reflect: NumIn of non-func type"));
}
tt = (t.kindType);
return ((tt.inCount >> 0));
};
rtype.prototype.NumIn = function() { return this.$val.NumIn(); };
rtype.ptr.prototype.NumOut = function() {
var t, tt;
t = this;
if (!((t.Kind() === 19))) {
$panic(new $String("reflect: NumOut of non-func type"));
}
tt = (t.kindType);
return tt.out().$length;
};
rtype.prototype.NumOut = function() { return this.$val.NumOut(); };
rtype.ptr.prototype.Out = function(i) {
var i, t, tt, x;
t = this;
if (!((t.Kind() === 19))) {
$panic(new $String("reflect: Out of non-func type"));
}
tt = (t.kindType);
return toType((x = tt.out(), ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i])));
};
rtype.prototype.Out = function(i) { return this.$val.Out(i); };
ChanDir.prototype.String = function() {
var _1, d;
d = this.$val;
_1 = d;
if (_1 === (2)) {
return "chan<-";
} else if (_1 === (1)) {
return "<-chan";
} else if (_1 === (3)) {
return "chan";
}
return "ChanDir" + strconv.Itoa(((d >> 0)));
};
$ptrType(ChanDir).prototype.String = function() { return new ChanDir(this.$get()).String(); };
interfaceType.ptr.prototype.Method = function(i) {
var i, m, p, pname, t, x;
m = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
t = this;
if (i < 0 || i >= t.methods.$length) {
return m;
}
p = (x = t.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
pname = $clone(t.rtype.nameOff(p.name), name);
m.Name = $clone(pname, name).name();
if (!$clone(pname, name).isExported()) {
m.PkgPath = $clone(pname, name).pkgPath();
if (m.PkgPath === "") {
m.PkgPath = $clone(t.pkgPath, name).name();
}
}
m.Type = toType(t.rtype.typeOff(p.typ));
m.Index = i;
return m;
};
interfaceType.prototype.Method = function(i) { return this.$val.Method(i); };
interfaceType.ptr.prototype.NumMethod = function() {
var t;
t = this;
return t.methods.$length;
};
interfaceType.prototype.NumMethod = function() { return this.$val.NumMethod(); };
interfaceType.ptr.prototype.MethodByName = function(name$1) {
var _i, _ref, _tmp, _tmp$1, i, m, name$1, ok, p, t, x;
m = new Method.ptr("", "", $ifaceNil, new Value.ptr(ptrType$1.nil, 0, 0), 0);
ok = false;
t = this;
if (t === ptrType$7.nil) {
return [m, ok];
}
p = ptrType$8.nil;
_ref = t.methods;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
p = (x = t.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
if ($clone(t.rtype.nameOff(p.name), name).name() === name$1) {
_tmp = $clone(t.Method(i), Method);
_tmp$1 = true;
Method.copy(m, _tmp);
ok = _tmp$1;
return [m, ok];
}
_i++;
}
return [m, ok];
};
interfaceType.prototype.MethodByName = function(name$1) { return this.$val.MethodByName(name$1); };
StructTag.prototype.Get = function(key) {
var _tuple, key, tag, v;
tag = this.$val;
_tuple = new StructTag(tag).Lookup(key);
v = _tuple[0];
return v;
};
$ptrType(StructTag).prototype.Get = function(key) { return new StructTag(this.$get()).Get(key); };
StructTag.prototype.Lookup = function(key) {
var _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, err, i, key, name$1, ok, qvalue, tag, value, value$1;
value = "";
ok = false;
tag = this.$val;
while (true) {
if (!(!(tag === ""))) { break; }
i = 0;
while (true) {
if (!(i < tag.length && (tag.charCodeAt(i) === 32))) { break; }
i = i + (1) >> 0;
}
tag = $substring(tag, i);
if (tag === "") {
break;
}
i = 0;
while (true) {
if (!(i < tag.length && tag.charCodeAt(i) > 32 && !((tag.charCodeAt(i) === 58)) && !((tag.charCodeAt(i) === 34)) && !((tag.charCodeAt(i) === 127)))) { break; }
i = i + (1) >> 0;
}
if ((i === 0) || (i + 1 >> 0) >= tag.length || !((tag.charCodeAt(i) === 58)) || !((tag.charCodeAt((i + 1 >> 0)) === 34))) {
break;
}
name$1 = ($substring(tag, 0, i));
tag = $substring(tag, (i + 1 >> 0));
i = 1;
while (true) {
if (!(i < tag.length && !((tag.charCodeAt(i) === 34)))) { break; }
if (tag.charCodeAt(i) === 92) {
i = i + (1) >> 0;
}
i = i + (1) >> 0;
}
if (i >= tag.length) {
break;
}
qvalue = ($substring(tag, 0, (i + 1 >> 0)));
tag = $substring(tag, (i + 1 >> 0));
if (key === name$1) {
_tuple = strconv.Unquote(qvalue);
value$1 = _tuple[0];
err = _tuple[1];
if (!($interfaceIsEqual(err, $ifaceNil))) {
break;
}
_tmp = value$1;
_tmp$1 = true;
value = _tmp;
ok = _tmp$1;
return [value, ok];
}
}
_tmp$2 = "";
_tmp$3 = false;
value = _tmp$2;
ok = _tmp$3;
return [value, ok];
};
$ptrType(StructTag).prototype.Lookup = function(key) { return new StructTag(this.$get()).Lookup(key); };
structType.ptr.prototype.Field = function(i) {
var f, i, p, t, tag, x;
f = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
t = this;
if (i < 0 || i >= t.fields.$length) {
$panic(new $String("reflect: Field index out of bounds"));
}
p = (x = t.fields, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
f.Type = toType(p.typ);
f.Name = $clone(p.name, name).name();
f.Anonymous = p.anon();
if (!$clone(p.name, name).isExported()) {
f.PkgPath = $clone(p.name, name).pkgPath();
if (f.PkgPath === "") {
f.PkgPath = $clone(t.pkgPath, name).name();
}
}
tag = $clone(p.name, name).tag();
if (!(tag === "")) {
f.Tag = (tag);
}
f.Offset = p.offset();
f.Index = new sliceType$13([i]);
return f;
};
structType.prototype.Field = function(i) { return this.$val.Field(i); };
structType.ptr.prototype.FieldByIndex = function(index) {
var _i, _r, _r$1, _r$2, _r$3, _r$4, _ref, _v, f, ft, i, index, t, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _ref = $f._ref; _v = $f._v; f = $f.f; ft = $f.ft; i = $f.i; index = $f.index; t = $f.t; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
f = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
t = this;
f.Type = toType(t.rtype);
_ref = index;
_i = 0;
/* while (true) { */ case 1:
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 2; continue; }
i = _i;
x = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
/* */ if (i > 0) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (i > 0) { */ case 3:
ft = f.Type;
_r = ft.Kind(); /* */ $s = 8; case 8: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
if (!(_r === 22)) { _v = false; $s = 7; continue s; }
_r$1 = ft.Elem(); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = _r$1.Kind(); /* */ $s = 10; case 10: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_v = _r$2 === 25; case 7:
/* */ if (_v) { $s = 5; continue; }
/* */ $s = 6; continue;
/* if (_v) { */ case 5:
_r$3 = ft.Elem(); /* */ $s = 11; case 11: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
ft = _r$3;
/* } */ case 6:
f.Type = ft;
/* } */ case 4:
_r$4 = f.Type.Field(x); /* */ $s = 12; case 12: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
StructField.copy(f, _r$4);
_i++;
/* } */ $s = 1; continue; case 2:
$s = -1; return f;
/* */ } return; } if ($f === undefined) { $f = { $blk: structType.ptr.prototype.FieldByIndex }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._ref = _ref; $f._v = _v; $f.f = f; $f.ft = ft; $f.i = i; $f.index = index; $f.t = t; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
structType.prototype.FieldByIndex = function(index) { return this.$val.FieldByIndex(index); };
structType.ptr.prototype.FieldByNameFunc = function(match) {
var _entry, _entry$1, _entry$2, _entry$3, _i, _i$1, _key, _key$1, _key$2, _key$3, _r, _r$1, _ref, _ref$1, _tmp, _tmp$1, _tmp$2, _tmp$3, count, current, f, fname, i, index, match, next, nextCount, ntyp, ok, result, scan, styp, t, t$1, visited, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _entry = $f._entry; _entry$1 = $f._entry$1; _entry$2 = $f._entry$2; _entry$3 = $f._entry$3; _i = $f._i; _i$1 = $f._i$1; _key = $f._key; _key$1 = $f._key$1; _key$2 = $f._key$2; _key$3 = $f._key$3; _r = $f._r; _r$1 = $f._r$1; _ref = $f._ref; _ref$1 = $f._ref$1; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tmp$2 = $f._tmp$2; _tmp$3 = $f._tmp$3; count = $f.count; current = $f.current; f = $f.f; fname = $f.fname; i = $f.i; index = $f.index; match = $f.match; next = $f.next; nextCount = $f.nextCount; ntyp = $f.ntyp; ok = $f.ok; result = $f.result; scan = $f.scan; styp = $f.styp; t = $f.t; t$1 = $f.t$1; visited = $f.visited; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
result = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
ok = false;
t = this;
current = new sliceType$14([]);
next = new sliceType$14([new fieldScan.ptr(t, sliceType$13.nil)]);
nextCount = false;
visited = $makeMap(ptrType$9.keyFor, []);
/* while (true) { */ case 1:
/* if (!(next.$length > 0)) { break; } */ if(!(next.$length > 0)) { $s = 2; continue; }
_tmp = next;
_tmp$1 = $subslice(current, 0, 0);
current = _tmp;
next = _tmp$1;
count = nextCount;
nextCount = false;
_ref = current;
_i = 0;
/* while (true) { */ case 3:
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 4; continue; }
scan = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), fieldScan);
t$1 = scan.typ;
/* */ if ((_entry = visited[ptrType$9.keyFor(t$1)], _entry !== undefined ? _entry.v : false)) { $s = 5; continue; }
/* */ $s = 6; continue;
/* if ((_entry = visited[ptrType$9.keyFor(t$1)], _entry !== undefined ? _entry.v : false)) { */ case 5:
_i++;
/* continue; */ $s = 3; continue;
/* } */ case 6:
_key = t$1; (visited || $throwRuntimeError("assignment to entry in nil map"))[ptrType$9.keyFor(_key)] = { k: _key, v: true };
_ref$1 = t$1.fields;
_i$1 = 0;
/* while (true) { */ case 7:
/* if (!(_i$1 < _ref$1.$length)) { break; } */ if(!(_i$1 < _ref$1.$length)) { $s = 8; continue; }
i = _i$1;
f = (x = t$1.fields, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
fname = $clone(f.name, name).name();
ntyp = ptrType$1.nil;
/* */ if (f.anon()) { $s = 9; continue; }
/* */ $s = 10; continue;
/* if (f.anon()) { */ case 9:
ntyp = f.typ;
/* */ if (ntyp.Kind() === 22) { $s = 11; continue; }
/* */ $s = 12; continue;
/* if (ntyp.Kind() === 22) { */ case 11:
_r = ntyp.Elem().common(); /* */ $s = 13; case 13: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
ntyp = _r;
/* } */ case 12:
/* } */ case 10:
_r$1 = match(fname); /* */ $s = 16; case 16: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
/* */ if (_r$1) { $s = 14; continue; }
/* */ $s = 15; continue;
/* if (_r$1) { */ case 14:
if ((_entry$1 = count[ptrType$9.keyFor(t$1)], _entry$1 !== undefined ? _entry$1.v : 0) > 1 || ok) {
_tmp$2 = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
_tmp$3 = false;
StructField.copy(result, _tmp$2);
ok = _tmp$3;
$s = -1; return [result, ok];
}
StructField.copy(result, t$1.Field(i));
result.Index = sliceType$13.nil;
result.Index = $appendSlice(result.Index, scan.index);
result.Index = $append(result.Index, i);
ok = true;
_i$1++;
/* continue; */ $s = 7; continue;
/* } */ case 15:
if (ok || ntyp === ptrType$1.nil || !((ntyp.Kind() === 25))) {
_i$1++;
/* continue; */ $s = 7; continue;
}
styp = (ntyp.kindType);
if ((_entry$2 = nextCount[ptrType$9.keyFor(styp)], _entry$2 !== undefined ? _entry$2.v : 0) > 0) {
_key$1 = styp; (nextCount || $throwRuntimeError("assignment to entry in nil map"))[ptrType$9.keyFor(_key$1)] = { k: _key$1, v: 2 };
_i$1++;
/* continue; */ $s = 7; continue;
}
if (nextCount === false) {
nextCount = $makeMap(ptrType$9.keyFor, []);
}
_key$2 = styp; (nextCount || $throwRuntimeError("assignment to entry in nil map"))[ptrType$9.keyFor(_key$2)] = { k: _key$2, v: 1 };
if ((_entry$3 = count[ptrType$9.keyFor(t$1)], _entry$3 !== undefined ? _entry$3.v : 0) > 1) {
_key$3 = styp; (nextCount || $throwRuntimeError("assignment to entry in nil map"))[ptrType$9.keyFor(_key$3)] = { k: _key$3, v: 2 };
}
index = sliceType$13.nil;
index = $appendSlice(index, scan.index);
index = $append(index, i);
next = $append(next, new fieldScan.ptr(styp, index));
_i$1++;
/* } */ $s = 7; continue; case 8:
_i++;
/* } */ $s = 3; continue; case 4:
if (ok) {
/* break; */ $s = 2; continue;
}
/* } */ $s = 1; continue; case 2:
$s = -1; return [result, ok];
/* */ } return; } if ($f === undefined) { $f = { $blk: structType.ptr.prototype.FieldByNameFunc }; } $f._entry = _entry; $f._entry$1 = _entry$1; $f._entry$2 = _entry$2; $f._entry$3 = _entry$3; $f._i = _i; $f._i$1 = _i$1; $f._key = _key; $f._key$1 = _key$1; $f._key$2 = _key$2; $f._key$3 = _key$3; $f._r = _r; $f._r$1 = _r$1; $f._ref = _ref; $f._ref$1 = _ref$1; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tmp$2 = _tmp$2; $f._tmp$3 = _tmp$3; $f.count = count; $f.current = current; $f.f = f; $f.fname = fname; $f.i = i; $f.index = index; $f.match = match; $f.next = next; $f.nextCount = nextCount; $f.ntyp = ntyp; $f.ok = ok; $f.result = result; $f.scan = scan; $f.styp = styp; $f.t = t; $f.t$1 = t$1; $f.visited = visited; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
structType.prototype.FieldByNameFunc = function(match) { return this.$val.FieldByNameFunc(match); };
structType.ptr.prototype.FieldByName = function(name$1) {
var _i, _r, _ref, _tmp, _tmp$1, _tuple, f, hasAnon, i, name$1, present, t, tf, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _ref = $f._ref; _tmp = $f._tmp; _tmp$1 = $f._tmp$1; _tuple = $f._tuple; f = $f.f; hasAnon = $f.hasAnon; i = $f.i; name$1 = $f.name$1; present = $f.present; t = $f.t; tf = $f.tf; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
name$1 = [name$1];
f = new StructField.ptr("", "", $ifaceNil, "", 0, sliceType$13.nil, false);
present = false;
t = this;
hasAnon = false;
if (!(name$1[0] === "")) {
_ref = t.fields;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
tf = (x = t.fields, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
if ($clone(tf.name, name).name() === name$1[0]) {
_tmp = $clone(t.Field(i), StructField);
_tmp$1 = true;
StructField.copy(f, _tmp);
present = _tmp$1;
$s = -1; return [f, present];
}
if (tf.anon()) {
hasAnon = true;
}
_i++;
}
}
if (!hasAnon) {
$s = -1; return [f, present];
}
_r = t.FieldByNameFunc((function(name$1) { return function(s) {
var s;
return s === name$1[0];
}; })(name$1)); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
StructField.copy(f, _tuple[0]);
present = _tuple[1];
$s = -1; return [f, present];
/* */ } return; } if ($f === undefined) { $f = { $blk: structType.ptr.prototype.FieldByName }; } $f._i = _i; $f._r = _r; $f._ref = _ref; $f._tmp = _tmp; $f._tmp$1 = _tmp$1; $f._tuple = _tuple; $f.f = f; $f.hasAnon = hasAnon; $f.i = i; $f.name$1 = name$1; $f.present = present; $f.t = t; $f.tf = tf; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
structType.prototype.FieldByName = function(name$1) { return this.$val.FieldByName(name$1); };
PtrTo = function(t) {
var t;
return $assertType(t, ptrType$1).ptrTo();
};
$pkg.PtrTo = PtrTo;
rtype.ptr.prototype.Implements = function(u) {
var _r, t, u, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; u = $f.u; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
if ($interfaceIsEqual(u, $ifaceNil)) {
$panic(new $String("reflect: nil type passed to Type.Implements"));
}
_r = u.Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (!((_r === 20))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((_r === 20))) { */ case 1:
$panic(new $String("reflect: non-interface type passed to Type.Implements"));
/* } */ case 2:
$s = -1; return implements$1($assertType(u, ptrType$1), t);
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.Implements }; } $f._r = _r; $f.t = t; $f.u = u; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.Implements = function(u) { return this.$val.Implements(u); };
rtype.ptr.prototype.AssignableTo = function(u) {
var _r, t, u, uu, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; u = $f.u; uu = $f.uu; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
if ($interfaceIsEqual(u, $ifaceNil)) {
$panic(new $String("reflect: nil type passed to Type.AssignableTo"));
}
uu = $assertType(u, ptrType$1);
_r = directlyAssignable(uu, t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r || implements$1(uu, t);
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.AssignableTo }; } $f._r = _r; $f.t = t; $f.u = u; $f.uu = uu; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.AssignableTo = function(u) { return this.$val.AssignableTo(u); };
rtype.ptr.prototype.ConvertibleTo = function(u) {
var _r, t, u, uu, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; u = $f.u; uu = $f.uu; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
t = this;
if ($interfaceIsEqual(u, $ifaceNil)) {
$panic(new $String("reflect: nil type passed to Type.ConvertibleTo"));
}
uu = $assertType(u, ptrType$1);
_r = convertOp(uu, t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return !(_r === $throwNilPointerError);
/* */ } return; } if ($f === undefined) { $f = { $blk: rtype.ptr.prototype.ConvertibleTo }; } $f._r = _r; $f.t = t; $f.u = u; $f.uu = uu; $f.$s = $s; $f.$r = $r; return $f;
};
rtype.prototype.ConvertibleTo = function(u) { return this.$val.ConvertibleTo(u); };
implements$1 = function(T, V) {
var T, V, i, i$1, j, j$1, t, tm, tm$1, tmName, tmName$1, tmPkgPath, tmPkgPath$1, v, v$1, vm, vm$1, vmName, vmName$1, vmPkgPath, vmPkgPath$1, vmethods, x, x$1, x$2;
if (!((T.Kind() === 20))) {
return false;
}
t = (T.kindType);
if (t.methods.$length === 0) {
return true;
}
if (V.Kind() === 20) {
v = (V.kindType);
i = 0;
j = 0;
while (true) {
if (!(j < v.methods.$length)) { break; }
tm = (x = t.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
tmName = $clone(t.rtype.nameOff(tm.name), name);
vm = (x$1 = v.methods, ((j < 0 || j >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + j]));
vmName = $clone(V.nameOff(vm.name), name);
if ($clone(vmName, name).name() === $clone(tmName, name).name() && V.typeOff(vm.typ) === t.rtype.typeOff(tm.typ)) {
if (!$clone(tmName, name).isExported()) {
tmPkgPath = $clone(tmName, name).pkgPath();
if (tmPkgPath === "") {
tmPkgPath = $clone(t.pkgPath, name).name();
}
vmPkgPath = $clone(vmName, name).pkgPath();
if (vmPkgPath === "") {
vmPkgPath = $clone(v.pkgPath, name).name();
}
if (!(tmPkgPath === vmPkgPath)) {
j = j + (1) >> 0;
continue;
}
}
i = i + (1) >> 0;
if (i >= t.methods.$length) {
return true;
}
}
j = j + (1) >> 0;
}
return false;
}
v$1 = V.uncommon();
if (v$1 === ptrType$5.nil) {
return false;
}
i$1 = 0;
vmethods = v$1.methods();
j$1 = 0;
while (true) {
if (!(j$1 < ((v$1.mcount >> 0)))) { break; }
tm$1 = (x$2 = t.methods, ((i$1 < 0 || i$1 >= x$2.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$2.$array[x$2.$offset + i$1]));
tmName$1 = $clone(t.rtype.nameOff(tm$1.name), name);
vm$1 = $clone(((j$1 < 0 || j$1 >= vmethods.$length) ? ($throwRuntimeError("index out of range"), undefined) : vmethods.$array[vmethods.$offset + j$1]), method);
vmName$1 = $clone(V.nameOff(vm$1.name), name);
if ($clone(vmName$1, name).name() === $clone(tmName$1, name).name() && V.typeOff(vm$1.mtyp) === t.rtype.typeOff(tm$1.typ)) {
if (!$clone(tmName$1, name).isExported()) {
tmPkgPath$1 = $clone(tmName$1, name).pkgPath();
if (tmPkgPath$1 === "") {
tmPkgPath$1 = $clone(t.pkgPath, name).name();
}
vmPkgPath$1 = $clone(vmName$1, name).pkgPath();
if (vmPkgPath$1 === "") {
vmPkgPath$1 = $clone(V.nameOff(v$1.pkgPath), name).name();
}
if (!(tmPkgPath$1 === vmPkgPath$1)) {
j$1 = j$1 + (1) >> 0;
continue;
}
}
i$1 = i$1 + (1) >> 0;
if (i$1 >= t.methods.$length) {
return true;
}
}
j$1 = j$1 + (1) >> 0;
}
return false;
};
directlyAssignable = function(T, V) {
var T, V, _r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; T = $f.T; V = $f.V; _r = $f._r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
if (T === V) {
$s = -1; return true;
}
if (!(T.Name() === "") && !(V.Name() === "") || !((T.Kind() === V.Kind()))) {
$s = -1; return false;
}
_r = haveIdenticalUnderlyingType(T, V, true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: directlyAssignable }; } $f.T = T; $f.V = V; $f._r = _r; $f.$s = $s; $f.$r = $r; return $f;
};
haveIdenticalType = function(T, V, cmpTags) {
var T, V, _arg, _arg$1, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _v, cmpTags, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; T = $f.T; V = $f.V; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _v = $f._v; cmpTags = $f.cmpTags; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
if (cmpTags) {
$s = -1; return $interfaceIsEqual(T, V);
}
_r = T.Name(); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = V.Name(); /* */ $s = 5; case 5: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
if (!(_r === _r$1)) { _v = true; $s = 3; continue s; }
_r$2 = T.Kind(); /* */ $s = 6; case 6: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_r$3 = V.Kind(); /* */ $s = 7; case 7: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
_v = !((_r$2 === _r$3)); case 3:
/* */ if (_v) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (_v) { */ case 1:
$s = -1; return false;
/* } */ case 2:
_r$4 = T.common(); /* */ $s = 8; case 8: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
_arg = _r$4;
_r$5 = V.common(); /* */ $s = 9; case 9: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
_arg$1 = _r$5;
_r$6 = haveIdenticalUnderlyingType(_arg, _arg$1, false); /* */ $s = 10; case 10: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
$s = -1; return _r$6;
/* */ } return; } if ($f === undefined) { $f = { $blk: haveIdenticalType }; } $f.T = T; $f.V = V; $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._v = _v; $f.cmpTags = cmpTags; $f.$s = $s; $f.$r = $r; return $f;
};
haveIdenticalUnderlyingType = function(T, V, cmpTags) {
var T, V, _1, _i, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _r$8, _ref, _v, _v$1, _v$2, _v$3, cmpTags, i, i$1, i$2, kind, t, t$1, t$2, tf, tp, v, v$1, v$2, vf, vp, x, x$1, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; T = $f.T; V = $f.V; _1 = $f._1; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _r$8 = $f._r$8; _ref = $f._ref; _v = $f._v; _v$1 = $f._v$1; _v$2 = $f._v$2; _v$3 = $f._v$3; cmpTags = $f.cmpTags; i = $f.i; i$1 = $f.i$1; i$2 = $f.i$2; kind = $f.kind; t = $f.t; t$1 = $f.t$1; t$2 = $f.t$2; tf = $f.tf; tp = $f.tp; v = $f.v; v$1 = $f.v$1; v$2 = $f.v$2; vf = $f.vf; vp = $f.vp; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
if (T === V) {
$s = -1; return true;
}
kind = T.Kind();
if (!((kind === V.Kind()))) {
$s = -1; return false;
}
if (1 <= kind && kind <= 16 || (kind === 24) || (kind === 26)) {
$s = -1; return true;
}
_1 = kind;
/* */ if (_1 === (17)) { $s = 2; continue; }
/* */ if (_1 === (18)) { $s = 3; continue; }
/* */ if (_1 === (19)) { $s = 4; continue; }
/* */ if (_1 === (20)) { $s = 5; continue; }
/* */ if (_1 === (21)) { $s = 6; continue; }
/* */ if ((_1 === (22)) || (_1 === (23))) { $s = 7; continue; }
/* */ if (_1 === (25)) { $s = 8; continue; }
/* */ $s = 9; continue;
/* if (_1 === (17)) { */ case 2:
if (!(T.Len() === V.Len())) { _v = false; $s = 10; continue s; }
_r = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 11; case 11: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_v = _r; case 10:
$s = -1; return _v;
/* } else if (_1 === (18)) { */ case 3:
if (!(V.ChanDir() === 3)) { _v$1 = false; $s = 14; continue s; }
_r$1 = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 15; case 15: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_v$1 = _r$1; case 14:
/* */ if (_v$1) { $s = 12; continue; }
/* */ $s = 13; continue;
/* if (_v$1) { */ case 12:
$s = -1; return true;
/* } */ case 13:
if (!(V.ChanDir() === T.ChanDir())) { _v$2 = false; $s = 16; continue s; }
_r$2 = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 17; case 17: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_v$2 = _r$2; case 16:
$s = -1; return _v$2;
/* } else if (_1 === (19)) { */ case 4:
t = (T.kindType);
v = (V.kindType);
if (!((t.outCount === v.outCount)) || !((t.inCount === v.inCount))) {
$s = -1; return false;
}
i = 0;
/* while (true) { */ case 18:
/* if (!(i < t.rtype.NumIn())) { break; } */ if(!(i < t.rtype.NumIn())) { $s = 19; continue; }
_r$3 = haveIdenticalType(t.rtype.In(i), v.rtype.In(i), cmpTags); /* */ $s = 22; case 22: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
/* */ if (!_r$3) { $s = 20; continue; }
/* */ $s = 21; continue;
/* if (!_r$3) { */ case 20:
$s = -1; return false;
/* } */ case 21:
i = i + (1) >> 0;
/* } */ $s = 18; continue; case 19:
i$1 = 0;
/* while (true) { */ case 23:
/* if (!(i$1 < t.rtype.NumOut())) { break; } */ if(!(i$1 < t.rtype.NumOut())) { $s = 24; continue; }
_r$4 = haveIdenticalType(t.rtype.Out(i$1), v.rtype.Out(i$1), cmpTags); /* */ $s = 27; case 27: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
/* */ if (!_r$4) { $s = 25; continue; }
/* */ $s = 26; continue;
/* if (!_r$4) { */ case 25:
$s = -1; return false;
/* } */ case 26:
i$1 = i$1 + (1) >> 0;
/* } */ $s = 23; continue; case 24:
$s = -1; return true;
/* } else if (_1 === (20)) { */ case 5:
t$1 = (T.kindType);
v$1 = (V.kindType);
if ((t$1.methods.$length === 0) && (v$1.methods.$length === 0)) {
$s = -1; return true;
}
$s = -1; return false;
/* } else if (_1 === (21)) { */ case 6:
_r$5 = haveIdenticalType(T.Key(), V.Key(), cmpTags); /* */ $s = 29; case 29: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
if (!(_r$5)) { _v$3 = false; $s = 28; continue s; }
_r$6 = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 30; case 30: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
_v$3 = _r$6; case 28:
$s = -1; return _v$3;
/* } else if ((_1 === (22)) || (_1 === (23))) { */ case 7:
_r$7 = haveIdenticalType(T.Elem(), V.Elem(), cmpTags); /* */ $s = 31; case 31: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
$s = -1; return _r$7;
/* } else if (_1 === (25)) { */ case 8:
t$2 = (T.kindType);
v$2 = (V.kindType);
if (!((t$2.fields.$length === v$2.fields.$length))) {
$s = -1; return false;
}
_ref = t$2.fields;
_i = 0;
/* while (true) { */ case 32:
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 33; continue; }
i$2 = _i;
tf = (x = t$2.fields, ((i$2 < 0 || i$2 >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i$2]));
vf = (x$1 = v$2.fields, ((i$2 < 0 || i$2 >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i$2]));
if (!($clone(tf.name, name).name() === $clone(vf.name, name).name())) {
$s = -1; return false;
}
_r$8 = haveIdenticalType(tf.typ, vf.typ, cmpTags); /* */ $s = 36; case 36: if($c) { $c = false; _r$8 = _r$8.$blk(); } if (_r$8 && _r$8.$blk !== undefined) { break s; }
/* */ if (!_r$8) { $s = 34; continue; }
/* */ $s = 35; continue;
/* if (!_r$8) { */ case 34:
$s = -1; return false;
/* } */ case 35:
if (cmpTags && !($clone(tf.name, name).tag() === $clone(vf.name, name).tag())) {
$s = -1; return false;
}
if (!((tf.offsetAnon === vf.offsetAnon))) {
$s = -1; return false;
}
if (!$clone(tf.name, name).isExported()) {
tp = $clone(tf.name, name).pkgPath();
if (tp === "") {
tp = $clone(t$2.pkgPath, name).name();
}
vp = $clone(vf.name, name).pkgPath();
if (vp === "") {
vp = $clone(v$2.pkgPath, name).name();
}
if (!(tp === vp)) {
$s = -1; return false;
}
}
_i++;
/* } */ $s = 32; continue; case 33:
$s = -1; return true;
/* } */ case 9:
case 1:
$s = -1; return false;
/* */ } return; } if ($f === undefined) { $f = { $blk: haveIdenticalUnderlyingType }; } $f.T = T; $f.V = V; $f._1 = _1; $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._r$8 = _r$8; $f._ref = _ref; $f._v = _v; $f._v$1 = _v$1; $f._v$2 = _v$2; $f._v$3 = _v$3; $f.cmpTags = cmpTags; $f.i = i; $f.i$1 = i$1; $f.i$2 = i$2; $f.kind = kind; $f.t = t; $f.t$1 = t$1; $f.t$2 = t$2; $f.tf = tf; $f.tp = tp; $f.v = v; $f.v$1 = v$1; $f.v$2 = v$2; $f.vf = vf; $f.vp = vp; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
};
toType = function(t) {
var t;
if (t === ptrType$1.nil) {
return $ifaceNil;
}
return t;
};
ifaceIndir = function(t) {
var t;
return ((t.kind & 32) >>> 0) === 0;
};
flag.prototype.kind = function() {
var f;
f = this.$val;
return ((((f & 31) >>> 0) >>> 0));
};
$ptrType(flag).prototype.kind = function() { return new flag(this.$get()).kind(); };
Value.ptr.prototype.pointer = function() {
var v;
v = this;
if (!((v.typ.size === 4)) || !v.typ.pointers()) {
$panic(new $String("can't call pointer on a non-pointer Value"));
}
if (!((((v.flag & 128) >>> 0) === 0))) {
return (v.ptr).$get();
}
return v.ptr;
};
Value.prototype.pointer = function() { return this.$val.pointer(); };
ValueError.ptr.prototype.Error = function() {
var e;
e = this;
if (e.Kind === 0) {
return "reflect: call of " + e.Method + " on zero Value";
}
return "reflect: call of " + e.Method + " on " + new Kind(e.Kind).String() + " Value";
};
ValueError.prototype.Error = function() { return this.$val.Error(); };
flag.prototype.mustBe = function(expected) {
var expected, f;
f = this.$val;
if (!((new flag(f).kind() === expected))) {
$panic(new ValueError.ptr(methodName(), new flag(f).kind()));
}
};
$ptrType(flag).prototype.mustBe = function(expected) { return new flag(this.$get()).mustBe(expected); };
flag.prototype.mustBeExported = function() {
var f;
f = this.$val;
if (f === 0) {
$panic(new ValueError.ptr(methodName(), 0));
}
if (!((((f & 96) >>> 0) === 0))) {
$panic(new $String("reflect: " + methodName() + " using value obtained using unexported field"));
}
};
$ptrType(flag).prototype.mustBeExported = function() { return new flag(this.$get()).mustBeExported(); };
flag.prototype.mustBeAssignable = function() {
var f;
f = this.$val;
if (f === 0) {
$panic(new ValueError.ptr(methodName(), 0));
}
if (!((((f & 96) >>> 0) === 0))) {
$panic(new $String("reflect: " + methodName() + " using value obtained using unexported field"));
}
if (((f & 256) >>> 0) === 0) {
$panic(new $String("reflect: " + methodName() + " using unaddressable value"));
}
};
$ptrType(flag).prototype.mustBeAssignable = function() { return new flag(this.$get()).mustBeAssignable(); };
Value.ptr.prototype.Addr = function() {
var v;
v = this;
if (((v.flag & 256) >>> 0) === 0) {
$panic(new $String("reflect.Value.Addr of unaddressable value"));
}
return new Value.ptr(v.typ.ptrTo(), v.ptr, ((((v.flag & 96) >>> 0)) | 22) >>> 0);
};
Value.prototype.Addr = function() { return this.$val.Addr(); };
Value.ptr.prototype.Bool = function() {
var v;
v = this;
new flag(v.flag).mustBe(1);
return (v.ptr).$get();
};
Value.prototype.Bool = function() { return this.$val.Bool(); };
Value.ptr.prototype.Bytes = function() {
var _r, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(23);
_r = v.typ.Elem().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (!((_r === 8))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((_r === 8))) { */ case 1:
$panic(new $String("reflect.Value.Bytes of non-byte slice"));
/* } */ case 2:
$s = -1; return (v.ptr).$get();
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Bytes }; } $f._r = _r; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Bytes = function() { return this.$val.Bytes(); };
Value.ptr.prototype.runes = function() {
var _r, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(23);
_r = v.typ.Elem().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (!((_r === 5))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((_r === 5))) { */ case 1:
$panic(new $String("reflect.Value.Bytes of non-rune slice"));
/* } */ case 2:
$s = -1; return (v.ptr).$get();
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.runes }; } $f._r = _r; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.runes = function() { return this.$val.runes(); };
Value.ptr.prototype.CanAddr = function() {
var v;
v = this;
return !((((v.flag & 256) >>> 0) === 0));
};
Value.prototype.CanAddr = function() { return this.$val.CanAddr(); };
Value.ptr.prototype.CanSet = function() {
var v;
v = this;
return ((v.flag & 352) >>> 0) === 256;
};
Value.prototype.CanSet = function() { return this.$val.CanSet(); };
Value.ptr.prototype.Call = function(in$1) {
var _r, in$1, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; in$1 = $f.in$1; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(19);
new flag(v.flag).mustBeExported();
_r = $clone(v, Value).call("Call", in$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Call }; } $f._r = _r; $f.in$1 = in$1; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Call = function(in$1) { return this.$val.Call(in$1); };
Value.ptr.prototype.CallSlice = function(in$1) {
var _r, in$1, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; in$1 = $f.in$1; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(19);
new flag(v.flag).mustBeExported();
_r = $clone(v, Value).call("CallSlice", in$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.CallSlice }; } $f._r = _r; $f.in$1 = in$1; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.CallSlice = function(in$1) { return this.$val.CallSlice(in$1); };
Value.ptr.prototype.Complex = function() {
var _1, k, v, x;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (15)) {
return ((x = (v.ptr).$get(), new $Complex128(x.$real, x.$imag)));
} else if (_1 === (16)) {
return (v.ptr).$get();
}
$panic(new ValueError.ptr("reflect.Value.Complex", new flag(v.flag).kind()));
};
Value.prototype.Complex = function() { return this.$val.Complex(); };
Value.ptr.prototype.FieldByIndex = function(index) {
var _i, _r, _r$1, _r$2, _r$3, _ref, _v, i, index, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _i = $f._i; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _ref = $f._ref; _v = $f._v; i = $f.i; index = $f.index; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
/* */ if (index.$length === 1) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (index.$length === 1) { */ case 1:
_r = $clone(v, Value).Field((0 >= index.$length ? ($throwRuntimeError("index out of range"), undefined) : index.$array[index.$offset + 0])); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } */ case 2:
new flag(v.flag).mustBe(25);
_ref = index;
_i = 0;
/* while (true) { */ case 4:
/* if (!(_i < _ref.$length)) { break; } */ if(!(_i < _ref.$length)) { $s = 5; continue; }
i = _i;
x = ((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]);
/* */ if (i > 0) { $s = 6; continue; }
/* */ $s = 7; continue;
/* if (i > 0) { */ case 6:
if (!($clone(v, Value).Kind() === 22)) { _v = false; $s = 10; continue s; }
_r$1 = v.typ.Elem().Kind(); /* */ $s = 11; case 11: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_v = _r$1 === 25; case 10:
/* */ if (_v) { $s = 8; continue; }
/* */ $s = 9; continue;
/* if (_v) { */ case 8:
if ($clone(v, Value).IsNil()) {
$panic(new $String("reflect: indirection through nil pointer to embedded struct"));
}
_r$2 = $clone(v, Value).Elem(); /* */ $s = 12; case 12: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
v = _r$2;
/* } */ case 9:
/* } */ case 7:
_r$3 = $clone(v, Value).Field(x); /* */ $s = 13; case 13: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
v = _r$3;
_i++;
/* } */ $s = 4; continue; case 5:
$s = -1; return v;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.FieldByIndex }; } $f._i = _i; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._ref = _ref; $f._v = _v; $f.i = i; $f.index = index; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.FieldByIndex = function(index) { return this.$val.FieldByIndex(index); };
Value.ptr.prototype.FieldByName = function(name$1) {
var _r, _r$1, _tuple, f, name$1, ok, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; f = $f.f; name$1 = $f.name$1; ok = $f.ok; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(25);
_r = v.typ.FieldByName(name$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
f = $clone(_tuple[0], StructField);
ok = _tuple[1];
/* */ if (ok) { $s = 2; continue; }
/* */ $s = 3; continue;
/* if (ok) { */ case 2:
_r$1 = $clone(v, Value).FieldByIndex(f.Index); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* } */ case 3:
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.FieldByName }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.f = f; $f.name$1 = name$1; $f.ok = ok; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.FieldByName = function(name$1) { return this.$val.FieldByName(name$1); };
Value.ptr.prototype.FieldByNameFunc = function(match) {
var _r, _r$1, _tuple, f, match, ok, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; f = $f.f; match = $f.match; ok = $f.ok; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
_r = v.typ.FieldByNameFunc(match); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
f = $clone(_tuple[0], StructField);
ok = _tuple[1];
/* */ if (ok) { $s = 2; continue; }
/* */ $s = 3; continue;
/* if (ok) { */ case 2:
_r$1 = $clone(v, Value).FieldByIndex(f.Index); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* } */ case 3:
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.FieldByNameFunc }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.f = f; $f.match = match; $f.ok = ok; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.FieldByNameFunc = function(match) { return this.$val.FieldByNameFunc(match); };
Value.ptr.prototype.Float = function() {
var _1, k, v;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (13)) {
return ((v.ptr).$get());
} else if (_1 === (14)) {
return (v.ptr).$get();
}
$panic(new ValueError.ptr("reflect.Value.Float", new flag(v.flag).kind()));
};
Value.prototype.Float = function() { return this.$val.Float(); };
Value.ptr.prototype.Int = function() {
var _1, k, p, v;
v = this;
k = new flag(v.flag).kind();
p = v.ptr;
_1 = k;
if (_1 === (2)) {
return (new $Int64(0, (p).$get()));
} else if (_1 === (3)) {
return (new $Int64(0, (p).$get()));
} else if (_1 === (4)) {
return (new $Int64(0, (p).$get()));
} else if (_1 === (5)) {
return (new $Int64(0, (p).$get()));
} else if (_1 === (6)) {
return (p).$get();
}
$panic(new ValueError.ptr("reflect.Value.Int", new flag(v.flag).kind()));
};
Value.prototype.Int = function() { return this.$val.Int(); };
Value.ptr.prototype.CanInterface = function() {
var v;
v = this;
if (v.flag === 0) {
$panic(new ValueError.ptr("reflect.Value.CanInterface", 0));
}
return ((v.flag & 96) >>> 0) === 0;
};
Value.prototype.CanInterface = function() { return this.$val.CanInterface(); };
Value.ptr.prototype.Interface = function() {
var _r, i, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; i = $f.i; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
i = $ifaceNil;
v = this;
_r = valueInterface($clone(v, Value), true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
i = _r;
$s = -1; return i;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Interface }; } $f._r = _r; $f.i = i; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Interface = function() { return this.$val.Interface(); };
Value.ptr.prototype.IsValid = function() {
var v;
v = this;
return !((v.flag === 0));
};
Value.prototype.IsValid = function() { return this.$val.IsValid(); };
Value.ptr.prototype.Kind = function() {
var v;
v = this;
return new flag(v.flag).kind();
};
Value.prototype.Kind = function() { return this.$val.Kind(); };
Value.ptr.prototype.MapIndex = function(key) {
var _r, c, e, fl, k, key, tt, typ, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; c = $f.c; e = $f.e; fl = $f.fl; k = $f.k; key = $f.key; tt = $f.tt; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(21);
tt = (v.typ.kindType);
_r = $clone(key, Value).assignTo("reflect.Value.MapIndex", tt.key, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
key = _r;
k = 0;
if (!((((key.flag & 128) >>> 0) === 0))) {
k = key.ptr;
} else {
k = ((key.$ptr_ptr || (key.$ptr_ptr = new ptrType$15(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, key))));
}
e = mapaccess(v.typ, $clone(v, Value).pointer(), k);
if (e === 0) {
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
}
typ = tt.elem;
fl = ((((v.flag | key.flag) >>> 0)) & 96) >>> 0;
fl = (fl | (((typ.Kind() >>> 0)))) >>> 0;
if (ifaceIndir(typ)) {
c = unsafe_New(typ);
typedmemmove(typ, c, e);
$s = -1; return new Value.ptr(typ, c, (fl | 128) >>> 0);
} else {
$s = -1; return new Value.ptr(typ, (e).$get(), fl);
}
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.MapIndex }; } $f._r = _r; $f.c = c; $f.e = e; $f.fl = fl; $f.k = k; $f.key = key; $f.tt = tt; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.MapIndex = function(key) { return this.$val.MapIndex(key); };
Value.ptr.prototype.MapKeys = function() {
var _r, a, c, fl, i, it, key, keyType, m, mlen, tt, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; a = $f.a; c = $f.c; fl = $f.fl; i = $f.i; it = $f.it; key = $f.key; keyType = $f.keyType; m = $f.m; mlen = $f.mlen; tt = $f.tt; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(21);
tt = (v.typ.kindType);
keyType = tt.key;
fl = (((v.flag & 96) >>> 0) | ((keyType.Kind() >>> 0))) >>> 0;
m = $clone(v, Value).pointer();
mlen = 0;
if (!(m === 0)) {
mlen = maplen(m);
}
it = mapiterinit(v.typ, m);
a = $makeSlice(sliceType$9, mlen);
i = 0;
i = 0;
/* while (true) { */ case 1:
/* if (!(i < a.$length)) { break; } */ if(!(i < a.$length)) { $s = 2; continue; }
_r = mapiterkey(it); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
key = _r;
if (key === 0) {
/* break; */ $s = 2; continue;
}
if (ifaceIndir(keyType)) {
c = unsafe_New(keyType);
typedmemmove(keyType, c, key);
((i < 0 || i >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + i] = new Value.ptr(keyType, c, (fl | 128) >>> 0));
} else {
((i < 0 || i >= a.$length) ? ($throwRuntimeError("index out of range"), undefined) : a.$array[a.$offset + i] = new Value.ptr(keyType, (key).$get(), fl));
}
mapiternext(it);
i = i + (1) >> 0;
/* } */ $s = 1; continue; case 2:
$s = -1; return $subslice(a, 0, i);
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.MapKeys }; } $f._r = _r; $f.a = a; $f.c = c; $f.fl = fl; $f.i = i; $f.it = it; $f.key = key; $f.keyType = keyType; $f.m = m; $f.mlen = mlen; $f.tt = tt; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.MapKeys = function() { return this.$val.MapKeys(); };
Value.ptr.prototype.Method = function(i) {
var _r, _v, fl, i, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _v = $f._v; fl = $f.fl; i = $f.i; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
if (v.typ === ptrType$1.nil) {
$panic(new ValueError.ptr("reflect.Value.Method", 0));
}
if (!((((v.flag & 512) >>> 0) === 0))) { _v = true; $s = 3; continue s; }
_r = v.typ.NumMethod(); /* */ $s = 4; case 4: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_v = ((i >>> 0)) >= ((_r >>> 0)); case 3:
/* */ if (_v) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (_v) { */ case 1:
$panic(new $String("reflect: Method index out of range"));
/* } */ case 2:
if ((v.typ.Kind() === 20) && $clone(v, Value).IsNil()) {
$panic(new $String("reflect: Method on nil interface value"));
}
fl = (v.flag & 160) >>> 0;
fl = (fl | (19)) >>> 0;
fl = (fl | ((((((i >>> 0)) << 10 >>> 0) | 512) >>> 0))) >>> 0;
$s = -1; return new Value.ptr(v.typ, v.ptr, fl);
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Method }; } $f._r = _r; $f._v = _v; $f.fl = fl; $f.i = i; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Method = function(i) { return this.$val.Method(i); };
Value.ptr.prototype.NumMethod = function() {
var _r, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
if (v.typ === ptrType$1.nil) {
$panic(new ValueError.ptr("reflect.Value.NumMethod", 0));
}
if (!((((v.flag & 512) >>> 0) === 0))) {
$s = -1; return 0;
}
_r = v.typ.NumMethod(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.NumMethod }; } $f._r = _r; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.NumMethod = function() { return this.$val.NumMethod(); };
Value.ptr.prototype.MethodByName = function(name$1) {
var _r, _r$1, _tuple, m, name$1, ok, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; m = $f.m; name$1 = $f.name$1; ok = $f.ok; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
if (v.typ === ptrType$1.nil) {
$panic(new ValueError.ptr("reflect.Value.MethodByName", 0));
}
if (!((((v.flag & 512) >>> 0) === 0))) {
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
}
_r = v.typ.MethodByName(name$1); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
m = $clone(_tuple[0], Method);
ok = _tuple[1];
if (!ok) {
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
}
_r$1 = $clone(v, Value).Method(m.Index); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.MethodByName }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f.m = m; $f.name$1 = name$1; $f.ok = ok; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.MethodByName = function(name$1) { return this.$val.MethodByName(name$1); };
Value.ptr.prototype.NumField = function() {
var tt, v;
v = this;
new flag(v.flag).mustBe(25);
tt = (v.typ.kindType);
return tt.fields.$length;
};
Value.prototype.NumField = function() { return this.$val.NumField(); };
Value.ptr.prototype.OverflowComplex = function(x) {
var _1, k, v, x;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (15)) {
return overflowFloat32(x.$real) || overflowFloat32(x.$imag);
} else if (_1 === (16)) {
return false;
}
$panic(new ValueError.ptr("reflect.Value.OverflowComplex", new flag(v.flag).kind()));
};
Value.prototype.OverflowComplex = function(x) { return this.$val.OverflowComplex(x); };
Value.ptr.prototype.OverflowFloat = function(x) {
var _1, k, v, x;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (13)) {
return overflowFloat32(x);
} else if (_1 === (14)) {
return false;
}
$panic(new ValueError.ptr("reflect.Value.OverflowFloat", new flag(v.flag).kind()));
};
Value.prototype.OverflowFloat = function(x) { return this.$val.OverflowFloat(x); };
overflowFloat32 = function(x) {
var x;
if (x < 0) {
x = -x;
}
return 3.4028234663852886e+38 < x && x <= 1.7976931348623157e+308;
};
Value.ptr.prototype.OverflowInt = function(x) {
var _1, bitSize, k, trunc, v, x;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) {
bitSize = $imul(v.typ.size, 8) >>> 0;
trunc = $shiftRightInt64(($shiftLeft64(x, ((64 - bitSize >>> 0)))), ((64 - bitSize >>> 0)));
return !((x.$high === trunc.$high && x.$low === trunc.$low));
}
$panic(new ValueError.ptr("reflect.Value.OverflowInt", new flag(v.flag).kind()));
};
Value.prototype.OverflowInt = function(x) { return this.$val.OverflowInt(x); };
Value.ptr.prototype.OverflowUint = function(x) {
var _1, bitSize, k, trunc, v, x;
v = this;
k = new flag(v.flag).kind();
_1 = k;
if ((_1 === (7)) || (_1 === (12)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11))) {
bitSize = $imul(v.typ.size, 8) >>> 0;
trunc = $shiftRightUint64(($shiftLeft64(x, ((64 - bitSize >>> 0)))), ((64 - bitSize >>> 0)));
return !((x.$high === trunc.$high && x.$low === trunc.$low));
}
$panic(new ValueError.ptr("reflect.Value.OverflowUint", new flag(v.flag).kind()));
};
Value.prototype.OverflowUint = function(x) { return this.$val.OverflowUint(x); };
Value.ptr.prototype.Recv = function() {
var _r, _tuple, ok, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; ok = $f.ok; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
x = new Value.ptr(ptrType$1.nil, 0, 0);
ok = false;
v = this;
new flag(v.flag).mustBe(18);
new flag(v.flag).mustBeExported();
_r = $clone(v, Value).recv(false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
x = _tuple[0];
ok = _tuple[1];
$s = -1; return [x, ok];
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Recv }; } $f._r = _r; $f._tuple = _tuple; $f.ok = ok; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Recv = function() { return this.$val.Recv(); };
Value.ptr.prototype.recv = function(nb) {
var _r, _tuple, nb, ok, p, selected, t, tt, v, val, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; nb = $f.nb; ok = $f.ok; p = $f.p; selected = $f.selected; t = $f.t; tt = $f.tt; v = $f.v; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
val = new Value.ptr(ptrType$1.nil, 0, 0);
ok = false;
v = this;
tt = (v.typ.kindType);
if ((((tt.dir >> 0)) & 1) === 0) {
$panic(new $String("reflect: recv on send-only channel"));
}
t = tt.elem;
val = new Value.ptr(t, 0, ((t.Kind() >>> 0)));
p = 0;
if (ifaceIndir(t)) {
p = unsafe_New(t);
val.ptr = p;
val.flag = (val.flag | (128)) >>> 0;
} else {
p = ((val.$ptr_ptr || (val.$ptr_ptr = new ptrType$15(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, val))));
}
_r = chanrecv($clone(v, Value).pointer(), nb, p); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
selected = _tuple[0];
ok = _tuple[1];
if (!selected) {
val = new Value.ptr(ptrType$1.nil, 0, 0);
}
$s = -1; return [val, ok];
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.recv }; } $f._r = _r; $f._tuple = _tuple; $f.nb = nb; $f.ok = ok; $f.p = p; $f.selected = selected; $f.t = t; $f.tt = tt; $f.v = v; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.recv = function(nb) { return this.$val.recv(nb); };
Value.ptr.prototype.Send = function(x) {
var _r, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(18);
new flag(v.flag).mustBeExported();
_r = $clone(v, Value).send($clone(x, Value), false); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r;
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Send }; } $f._r = _r; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Send = function(x) { return this.$val.Send(x); };
Value.ptr.prototype.send = function(x, nb) {
var _r, _r$1, nb, p, selected, tt, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; nb = $f.nb; p = $f.p; selected = $f.selected; tt = $f.tt; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
selected = false;
v = this;
tt = (v.typ.kindType);
if ((((tt.dir >> 0)) & 2) === 0) {
$panic(new $String("reflect: send on recv-only channel"));
}
new flag(x.flag).mustBeExported();
_r = $clone(x, Value).assignTo("reflect.Value.Send", tt.elem, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
x = _r;
p = 0;
if (!((((x.flag & 128) >>> 0) === 0))) {
p = x.ptr;
} else {
p = ((x.$ptr_ptr || (x.$ptr_ptr = new ptrType$15(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, x))));
}
_r$1 = chansend($clone(v, Value).pointer(), p, nb); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
selected = _r$1;
$s = -1; return selected;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.send }; } $f._r = _r; $f._r$1 = _r$1; $f.nb = nb; $f.p = p; $f.selected = selected; $f.tt = tt; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.send = function(x, nb) { return this.$val.send(x, nb); };
Value.ptr.prototype.SetBool = function(x) {
var v, x;
v = this;
new flag(v.flag).mustBeAssignable();
new flag(v.flag).mustBe(1);
(v.ptr).$set(x);
};
Value.prototype.SetBool = function(x) { return this.$val.SetBool(x); };
Value.ptr.prototype.setRunes = function(x) {
var _r, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBeAssignable();
new flag(v.flag).mustBe(23);
_r = v.typ.Elem().Kind(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
/* */ if (!((_r === 5))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((_r === 5))) { */ case 1:
$panic(new $String("reflect.Value.setRunes of non-rune slice"));
/* } */ case 2:
(v.ptr).$set(x);
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.setRunes }; } $f._r = _r; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.setRunes = function(x) { return this.$val.setRunes(x); };
Value.ptr.prototype.SetComplex = function(x) {
var _1, k, v, x;
v = this;
new flag(v.flag).mustBeAssignable();
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (15)) {
(v.ptr).$set((new $Complex64(x.$real, x.$imag)));
} else if (_1 === (16)) {
(v.ptr).$set(x);
} else {
$panic(new ValueError.ptr("reflect.Value.SetComplex", new flag(v.flag).kind()));
}
};
Value.prototype.SetComplex = function(x) { return this.$val.SetComplex(x); };
Value.ptr.prototype.SetFloat = function(x) {
var _1, k, v, x;
v = this;
new flag(v.flag).mustBeAssignable();
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (13)) {
(v.ptr).$set(($fround(x)));
} else if (_1 === (14)) {
(v.ptr).$set(x);
} else {
$panic(new ValueError.ptr("reflect.Value.SetFloat", new flag(v.flag).kind()));
}
};
Value.prototype.SetFloat = function(x) { return this.$val.SetFloat(x); };
Value.ptr.prototype.SetInt = function(x) {
var _1, k, v, x;
v = this;
new flag(v.flag).mustBeAssignable();
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (2)) {
(v.ptr).$set((((x.$low + ((x.$high >> 31) * 4294967296)) >> 0)));
} else if (_1 === (3)) {
(v.ptr).$set((((x.$low + ((x.$high >> 31) * 4294967296)) << 24 >> 24)));
} else if (_1 === (4)) {
(v.ptr).$set((((x.$low + ((x.$high >> 31) * 4294967296)) << 16 >> 16)));
} else if (_1 === (5)) {
(v.ptr).$set((((x.$low + ((x.$high >> 31) * 4294967296)) >> 0)));
} else if (_1 === (6)) {
(v.ptr).$set(x);
} else {
$panic(new ValueError.ptr("reflect.Value.SetInt", new flag(v.flag).kind()));
}
};
Value.prototype.SetInt = function(x) { return this.$val.SetInt(x); };
Value.ptr.prototype.SetMapIndex = function(key, val) {
var _r, _r$1, e, k, key, tt, v, val, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; e = $f.e; k = $f.k; key = $f.key; tt = $f.tt; v = $f.v; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(21);
new flag(v.flag).mustBeExported();
new flag(key.flag).mustBeExported();
tt = (v.typ.kindType);
_r = $clone(key, Value).assignTo("reflect.Value.SetMapIndex", tt.key, 0); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
key = _r;
k = 0;
if (!((((key.flag & 128) >>> 0) === 0))) {
k = key.ptr;
} else {
k = ((key.$ptr_ptr || (key.$ptr_ptr = new ptrType$15(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, key))));
}
if (val.typ === ptrType$1.nil) {
mapdelete(v.typ, $clone(v, Value).pointer(), k);
$s = -1; return;
}
new flag(val.flag).mustBeExported();
_r$1 = $clone(val, Value).assignTo("reflect.Value.SetMapIndex", tt.elem, 0); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
val = _r$1;
e = 0;
if (!((((val.flag & 128) >>> 0) === 0))) {
e = val.ptr;
} else {
e = ((val.$ptr_ptr || (val.$ptr_ptr = new ptrType$15(function() { return this.$target.ptr; }, function($v) { this.$target.ptr = $v; }, val))));
}
$r = mapassign(v.typ, $clone(v, Value).pointer(), k, e); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.SetMapIndex }; } $f._r = _r; $f._r$1 = _r$1; $f.e = e; $f.k = k; $f.key = key; $f.tt = tt; $f.v = v; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.SetMapIndex = function(key, val) { return this.$val.SetMapIndex(key, val); };
Value.ptr.prototype.SetUint = function(x) {
var _1, k, v, x;
v = this;
new flag(v.flag).mustBeAssignable();
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (7)) {
(v.ptr).$set(((x.$low >>> 0)));
} else if (_1 === (8)) {
(v.ptr).$set(((x.$low << 24 >>> 24)));
} else if (_1 === (9)) {
(v.ptr).$set(((x.$low << 16 >>> 16)));
} else if (_1 === (10)) {
(v.ptr).$set(((x.$low >>> 0)));
} else if (_1 === (11)) {
(v.ptr).$set(x);
} else if (_1 === (12)) {
(v.ptr).$set(((x.$low >>> 0)));
} else {
$panic(new ValueError.ptr("reflect.Value.SetUint", new flag(v.flag).kind()));
}
};
Value.prototype.SetUint = function(x) { return this.$val.SetUint(x); };
Value.ptr.prototype.SetPointer = function(x) {
var v, x;
v = this;
new flag(v.flag).mustBeAssignable();
new flag(v.flag).mustBe(26);
(v.ptr).$set(x);
};
Value.prototype.SetPointer = function(x) { return this.$val.SetPointer(x); };
Value.ptr.prototype.SetString = function(x) {
var v, x;
v = this;
new flag(v.flag).mustBeAssignable();
new flag(v.flag).mustBe(24);
(v.ptr).$set(x);
};
Value.prototype.SetString = function(x) { return this.$val.SetString(x); };
Value.ptr.prototype.String = function() {
var _1, _r, k, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; k = $f.k; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
k = new flag(v.flag).kind();
_1 = k;
if (_1 === (0)) {
$s = -1; return "<invalid Value>";
} else if (_1 === (24)) {
$s = -1; return (v.ptr).$get();
}
_r = $clone(v, Value).Type().String(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return "<" + _r + " Value>";
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.String }; } $f._1 = _1; $f._r = _r; $f.k = k; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.String = function() { return this.$val.String(); };
Value.ptr.prototype.TryRecv = function() {
var _r, _tuple, ok, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; ok = $f.ok; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
x = new Value.ptr(ptrType$1.nil, 0, 0);
ok = false;
v = this;
new flag(v.flag).mustBe(18);
new flag(v.flag).mustBeExported();
_r = $clone(v, Value).recv(true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
x = _tuple[0];
ok = _tuple[1];
$s = -1; return [x, ok];
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.TryRecv }; } $f._r = _r; $f._tuple = _tuple; $f.ok = ok; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.TryRecv = function() { return this.$val.TryRecv(); };
Value.ptr.prototype.TrySend = function(x) {
var _r, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
new flag(v.flag).mustBe(18);
new flag(v.flag).mustBeExported();
_r = $clone(v, Value).send($clone(x, Value), true); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.TrySend }; } $f._r = _r; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.TrySend = function(x) { return this.$val.TrySend(x); };
Value.ptr.prototype.Type = function() {
var f, i, m, m$1, tt, ut, v, x, x$1;
v = this;
f = v.flag;
if (f === 0) {
$panic(new ValueError.ptr("reflect.Value.Type", 0));
}
if (((f & 512) >>> 0) === 0) {
return v.typ;
}
i = ((v.flag >> 0)) >> 10 >> 0;
if (v.typ.Kind() === 20) {
tt = (v.typ.kindType);
if (((i >>> 0)) >= ((tt.methods.$length >>> 0))) {
$panic(new $String("reflect: internal error: invalid method index"));
}
m = (x = tt.methods, ((i < 0 || i >= x.$length) ? ($throwRuntimeError("index out of range"), undefined) : x.$array[x.$offset + i]));
return v.typ.typeOff(m.typ);
}
ut = v.typ.uncommon();
if (ut === ptrType$5.nil || ((i >>> 0)) >= ((ut.mcount >>> 0))) {
$panic(new $String("reflect: internal error: invalid method index"));
}
m$1 = $clone((x$1 = ut.methods(), ((i < 0 || i >= x$1.$length) ? ($throwRuntimeError("index out of range"), undefined) : x$1.$array[x$1.$offset + i])), method);
return v.typ.typeOff(m$1.mtyp);
};
Value.prototype.Type = function() { return this.$val.Type(); };
Value.ptr.prototype.Uint = function() {
var _1, k, p, v, x;
v = this;
k = new flag(v.flag).kind();
p = v.ptr;
_1 = k;
if (_1 === (7)) {
return (new $Uint64(0, (p).$get()));
} else if (_1 === (8)) {
return (new $Uint64(0, (p).$get()));
} else if (_1 === (9)) {
return (new $Uint64(0, (p).$get()));
} else if (_1 === (10)) {
return (new $Uint64(0, (p).$get()));
} else if (_1 === (11)) {
return (p).$get();
} else if (_1 === (12)) {
return ((x = (p).$get(), new $Uint64(0, x.constructor === Number ? x : 1)));
}
$panic(new ValueError.ptr("reflect.Value.Uint", new flag(v.flag).kind()));
};
Value.prototype.Uint = function() { return this.$val.Uint(); };
Value.ptr.prototype.UnsafeAddr = function() {
var v;
v = this;
if (v.typ === ptrType$1.nil) {
$panic(new ValueError.ptr("reflect.Value.UnsafeAddr", 0));
}
if (((v.flag & 256) >>> 0) === 0) {
$panic(new $String("reflect.Value.UnsafeAddr of unaddressable value"));
}
return (v.ptr);
};
Value.prototype.UnsafeAddr = function() { return this.$val.UnsafeAddr(); };
New = function(typ) {
var _r, _r$1, fl, ptr, typ, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; fl = $f.fl; ptr = $f.ptr; typ = $f.typ; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
if ($interfaceIsEqual(typ, $ifaceNil)) {
$panic(new $String("reflect: New(nil)"));
}
ptr = unsafe_New($assertType(typ, ptrType$1));
fl = 22;
_r = typ.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = _r.ptrTo(); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return new Value.ptr(_r$1, ptr, fl);
/* */ } return; } if ($f === undefined) { $f = { $blk: New }; } $f._r = _r; $f._r$1 = _r$1; $f.fl = fl; $f.ptr = ptr; $f.typ = typ; $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.New = New;
Value.ptr.prototype.assignTo = function(context, dst, target) {
var _r, _r$1, _r$2, _r$3, context, dst, fl, target, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; context = $f.context; dst = $f.dst; fl = $f.fl; target = $f.target; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
/* */ if (!((((v.flag & 512) >>> 0) === 0))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((((v.flag & 512) >>> 0) === 0))) { */ case 1:
_r = makeMethodValue(context, $clone(v, Value)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
v = _r;
/* } */ case 2:
_r$1 = directlyAssignable(dst, v.typ); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
/* */ if (_r$1) { $s = 5; continue; }
/* */ if (implements$1(dst, v.typ)) { $s = 6; continue; }
/* */ $s = 7; continue;
/* if (_r$1) { */ case 5:
fl = (v.flag & 480) >>> 0;
fl = (fl | (((dst.Kind() >>> 0)))) >>> 0;
$s = -1; return new Value.ptr(dst, v.ptr, fl);
/* } else if (implements$1(dst, v.typ)) { */ case 6:
if (target === 0) {
target = unsafe_New(dst);
}
_r$2 = valueInterface($clone(v, Value), false); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
x = _r$2;
_r$3 = dst.NumMethod(); /* */ $s = 13; case 13: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
/* */ if (_r$3 === 0) { $s = 10; continue; }
/* */ $s = 11; continue;
/* if (_r$3 === 0) { */ case 10:
(target).$set(x);
$s = 12; continue;
/* } else { */ case 11:
ifaceE2I(dst, x, target);
/* } */ case 12:
$s = -1; return new Value.ptr(dst, target, 148);
/* } */ case 7:
case 4:
$panic(new $String(context + ": value of type " + v.typ.String() + " is not assignable to type " + dst.String()));
$s = -1; return new Value.ptr(ptrType$1.nil, 0, 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.assignTo }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f.context = context; $f.dst = dst; $f.fl = fl; $f.target = target; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.assignTo = function(context, dst, target) { return this.$val.assignTo(context, dst, target); };
Value.ptr.prototype.Convert = function(t) {
var _r, _r$1, _r$2, _r$3, _r$4, op, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; op = $f.op; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
v = this;
/* */ if (!((((v.flag & 512) >>> 0) === 0))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!((((v.flag & 512) >>> 0) === 0))) { */ case 1:
_r = makeMethodValue("Convert", $clone(v, Value)); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
v = _r;
/* } */ case 2:
_r$1 = t.common(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = convertOp(_r$1, v.typ); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
op = _r$2;
/* */ if (op === $throwNilPointerError) { $s = 6; continue; }
/* */ $s = 7; continue;
/* if (op === $throwNilPointerError) { */ case 6:
_r$3 = t.String(); /* */ $s = 8; case 8: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
$panic(new $String("reflect.Value.Convert: value of type " + v.typ.String() + " cannot be converted to type " + _r$3));
/* } */ case 7:
_r$4 = op($clone(v, Value), t); /* */ $s = 9; case 9: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
$s = -1; return _r$4;
/* */ } return; } if ($f === undefined) { $f = { $blk: Value.ptr.prototype.Convert }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f.op = op; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Value.prototype.Convert = function(t) { return this.$val.Convert(t); };
convertOp = function(dst, src) {
var _1, _2, _3, _4, _5, _6, _7, _arg, _arg$1, _r, _r$1, _r$2, _r$3, _r$4, _r$5, _r$6, _r$7, _v, _v$1, _v$2, dst, src, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _2 = $f._2; _3 = $f._3; _4 = $f._4; _5 = $f._5; _6 = $f._6; _7 = $f._7; _arg = $f._arg; _arg$1 = $f._arg$1; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; _r$6 = $f._r$6; _r$7 = $f._r$7; _v = $f._v; _v$1 = $f._v$1; _v$2 = $f._v$2; dst = $f.dst; src = $f.src; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_1 = src.Kind();
/* */ if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { $s = 2; continue; }
/* */ if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { $s = 3; continue; }
/* */ if ((_1 === (13)) || (_1 === (14))) { $s = 4; continue; }
/* */ if ((_1 === (15)) || (_1 === (16))) { $s = 5; continue; }
/* */ if (_1 === (24)) { $s = 6; continue; }
/* */ if (_1 === (23)) { $s = 7; continue; }
/* */ $s = 8; continue;
/* if ((_1 === (2)) || (_1 === (3)) || (_1 === (4)) || (_1 === (5)) || (_1 === (6))) { */ case 2:
_2 = dst.Kind();
if ((_2 === (2)) || (_2 === (3)) || (_2 === (4)) || (_2 === (5)) || (_2 === (6)) || (_2 === (7)) || (_2 === (8)) || (_2 === (9)) || (_2 === (10)) || (_2 === (11)) || (_2 === (12))) {
$s = -1; return cvtInt;
} else if ((_2 === (13)) || (_2 === (14))) {
$s = -1; return cvtIntFloat;
} else if (_2 === (24)) {
$s = -1; return cvtIntString;
}
$s = 8; continue;
/* } else if ((_1 === (7)) || (_1 === (8)) || (_1 === (9)) || (_1 === (10)) || (_1 === (11)) || (_1 === (12))) { */ case 3:
_3 = dst.Kind();
if ((_3 === (2)) || (_3 === (3)) || (_3 === (4)) || (_3 === (5)) || (_3 === (6)) || (_3 === (7)) || (_3 === (8)) || (_3 === (9)) || (_3 === (10)) || (_3 === (11)) || (_3 === (12))) {
$s = -1; return cvtUint;
} else if ((_3 === (13)) || (_3 === (14))) {
$s = -1; return cvtUintFloat;
} else if (_3 === (24)) {
$s = -1; return cvtUintString;
}
$s = 8; continue;
/* } else if ((_1 === (13)) || (_1 === (14))) { */ case 4:
_4 = dst.Kind();
if ((_4 === (2)) || (_4 === (3)) || (_4 === (4)) || (_4 === (5)) || (_4 === (6))) {
$s = -1; return cvtFloatInt;
} else if ((_4 === (7)) || (_4 === (8)) || (_4 === (9)) || (_4 === (10)) || (_4 === (11)) || (_4 === (12))) {
$s = -1; return cvtFloatUint;
} else if ((_4 === (13)) || (_4 === (14))) {
$s = -1; return cvtFloat;
}
$s = 8; continue;
/* } else if ((_1 === (15)) || (_1 === (16))) { */ case 5:
_5 = dst.Kind();
if ((_5 === (15)) || (_5 === (16))) {
$s = -1; return cvtComplex;
}
$s = 8; continue;
/* } else if (_1 === (24)) { */ case 6:
if (!(dst.Kind() === 23)) { _v = false; $s = 11; continue s; }
_r = dst.Elem().PkgPath(); /* */ $s = 12; case 12: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_v = _r === ""; case 11:
/* */ if (_v) { $s = 9; continue; }
/* */ $s = 10; continue;
/* if (_v) { */ case 9:
_r$1 = dst.Elem().Kind(); /* */ $s = 14; case 14: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_6 = _r$1;
if (_6 === (8)) {
$s = -1; return cvtStringBytes;
} else if (_6 === (5)) {
$s = -1; return cvtStringRunes;
}
case 13:
/* } */ case 10:
$s = 8; continue;
/* } else if (_1 === (23)) { */ case 7:
if (!(dst.Kind() === 24)) { _v$1 = false; $s = 17; continue s; }
_r$2 = src.Elem().PkgPath(); /* */ $s = 18; case 18: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_v$1 = _r$2 === ""; case 17:
/* */ if (_v$1) { $s = 15; continue; }
/* */ $s = 16; continue;
/* if (_v$1) { */ case 15:
_r$3 = src.Elem().Kind(); /* */ $s = 20; case 20: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
_7 = _r$3;
if (_7 === (8)) {
$s = -1; return cvtBytesString;
} else if (_7 === (5)) {
$s = -1; return cvtRunesString;
}
case 19:
/* } */ case 16:
/* } */ case 8:
case 1:
_r$4 = haveIdenticalUnderlyingType(dst, src, false); /* */ $s = 23; case 23: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
/* */ if (_r$4) { $s = 21; continue; }
/* */ $s = 22; continue;
/* if (_r$4) { */ case 21:
$s = -1; return cvtDirect;
/* } */ case 22:
if (!((dst.Kind() === 22) && dst.Name() === "" && (src.Kind() === 22) && src.Name() === "")) { _v$2 = false; $s = 26; continue s; }
_r$5 = dst.Elem().common(); /* */ $s = 27; case 27: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
_arg = _r$5;
_r$6 = src.Elem().common(); /* */ $s = 28; case 28: if($c) { $c = false; _r$6 = _r$6.$blk(); } if (_r$6 && _r$6.$blk !== undefined) { break s; }
_arg$1 = _r$6;
_r$7 = haveIdenticalUnderlyingType(_arg, _arg$1, false); /* */ $s = 29; case 29: if($c) { $c = false; _r$7 = _r$7.$blk(); } if (_r$7 && _r$7.$blk !== undefined) { break s; }
_v$2 = _r$7; case 26:
/* */ if (_v$2) { $s = 24; continue; }
/* */ $s = 25; continue;
/* if (_v$2) { */ case 24:
$s = -1; return cvtDirect;
/* } */ case 25:
if (implements$1(dst, src)) {
if (src.Kind() === 20) {
$s = -1; return cvtI2I;
}
$s = -1; return cvtT2I;
}
$s = -1; return $throwNilPointerError;
/* */ } return; } if ($f === undefined) { $f = { $blk: convertOp }; } $f._1 = _1; $f._2 = _2; $f._3 = _3; $f._4 = _4; $f._5 = _5; $f._6 = _6; $f._7 = _7; $f._arg = _arg; $f._arg$1 = _arg$1; $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f._r$6 = _r$6; $f._r$7 = _r$7; $f._v = _v; $f._v$1 = _v$1; $f._v$2 = _v$2; $f.dst = dst; $f.src = src; $f.$s = $s; $f.$r = $r; return $f;
};
makeFloat = function(f, v, t) {
var _1, _r, f, ptr, t, typ, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; f = $f.f; ptr = $f.ptr; t = $f.t; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = t.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
typ = _r;
ptr = unsafe_New(typ);
_1 = typ.size;
if (_1 === (4)) {
(ptr).$set(($fround(v)));
} else if (_1 === (8)) {
(ptr).$set(v);
}
$s = -1; return new Value.ptr(typ, ptr, (((f | 128) >>> 0) | ((typ.Kind() >>> 0))) >>> 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: makeFloat }; } $f._1 = _1; $f._r = _r; $f.f = f; $f.ptr = ptr; $f.t = t; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
makeComplex = function(f, v, t) {
var _1, _r, f, ptr, t, typ, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _1 = $f._1; _r = $f._r; f = $f.f; ptr = $f.ptr; t = $f.t; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = t.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
typ = _r;
ptr = unsafe_New(typ);
_1 = typ.size;
if (_1 === (8)) {
(ptr).$set((new $Complex64(v.$real, v.$imag)));
} else if (_1 === (16)) {
(ptr).$set(v);
}
$s = -1; return new Value.ptr(typ, ptr, (((f | 128) >>> 0) | ((typ.Kind() >>> 0))) >>> 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: makeComplex }; } $f._1 = _1; $f._r = _r; $f.f = f; $f.ptr = ptr; $f.t = t; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
makeString = function(f, v, t) {
var _r, _r$1, f, ret, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; f = $f.f; ret = $f.ret; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = New(t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = $clone(_r, Value).Elem(); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
ret = _r$1;
$clone(ret, Value).SetString(v);
ret.flag = (((ret.flag & ~256) >>> 0) | f) >>> 0;
$s = -1; return ret;
/* */ } return; } if ($f === undefined) { $f = { $blk: makeString }; } $f._r = _r; $f._r$1 = _r$1; $f.f = f; $f.ret = ret; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
makeBytes = function(f, v, t) {
var _r, _r$1, f, ret, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; f = $f.f; ret = $f.ret; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = New(t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = $clone(_r, Value).Elem(); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
ret = _r$1;
$r = $clone(ret, Value).SetBytes(v); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
ret.flag = (((ret.flag & ~256) >>> 0) | f) >>> 0;
$s = -1; return ret;
/* */ } return; } if ($f === undefined) { $f = { $blk: makeBytes }; } $f._r = _r; $f._r$1 = _r$1; $f.f = f; $f.ret = ret; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
makeRunes = function(f, v, t) {
var _r, _r$1, f, ret, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; f = $f.f; ret = $f.ret; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = New(t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = $clone(_r, Value).Elem(); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
ret = _r$1;
$r = $clone(ret, Value).setRunes(v); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
ret.flag = (((ret.flag & ~256) >>> 0) | f) >>> 0;
$s = -1; return ret;
/* */ } return; } if ($f === undefined) { $f = { $blk: makeRunes }; } $f._r = _r; $f._r$1 = _r$1; $f.f = f; $f.ret = ret; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtInt = function(v, t) {
var _r, t, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeInt((v.flag & 96) >>> 0, ((x = $clone(v, Value).Int(), new $Uint64(x.$high, x.$low))), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtInt }; } $f._r = _r; $f.t = t; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
cvtUint = function(v, t) {
var _r, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeInt((v.flag & 96) >>> 0, $clone(v, Value).Uint(), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtUint }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtFloatInt = function(v, t) {
var _r, t, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeInt((v.flag & 96) >>> 0, ((x = (new $Int64(0, $clone(v, Value).Float())), new $Uint64(x.$high, x.$low))), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtFloatInt }; } $f._r = _r; $f.t = t; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
cvtFloatUint = function(v, t) {
var _r, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeInt((v.flag & 96) >>> 0, (new $Uint64(0, $clone(v, Value).Float())), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtFloatUint }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtIntFloat = function(v, t) {
var _r, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeFloat((v.flag & 96) >>> 0, ($flatten64($clone(v, Value).Int())), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtIntFloat }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtUintFloat = function(v, t) {
var _r, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeFloat((v.flag & 96) >>> 0, ($flatten64($clone(v, Value).Uint())), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtUintFloat }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtFloat = function(v, t) {
var _r, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeFloat((v.flag & 96) >>> 0, $clone(v, Value).Float(), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtFloat }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtComplex = function(v, t) {
var _r, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeComplex((v.flag & 96) >>> 0, $clone(v, Value).Complex(), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtComplex }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtIntString = function(v, t) {
var _r, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeString((v.flag & 96) >>> 0, ($encodeRune($clone(v, Value).Int().$low)), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtIntString }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtUintString = function(v, t) {
var _r, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = makeString((v.flag & 96) >>> 0, ($encodeRune($clone(v, Value).Uint().$low)), t); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtUintString }; } $f._r = _r; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtBytesString = function(v, t) {
var _arg, _arg$1, _arg$2, _r, _r$1, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_arg = (v.flag & 96) >>> 0;
_r = $clone(v, Value).Bytes(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_arg$1 = ($bytesToString(_r));
_arg$2 = t;
_r$1 = makeString(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtBytesString }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtStringBytes = function(v, t) {
var _arg, _arg$1, _arg$2, _r, _r$1, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_arg = (v.flag & 96) >>> 0;
_r = $clone(v, Value).String(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_arg$1 = (new sliceType$15($stringToBytes(_r)));
_arg$2 = t;
_r$1 = makeBytes(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtStringBytes }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtRunesString = function(v, t) {
var _arg, _arg$1, _arg$2, _r, _r$1, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_arg = (v.flag & 96) >>> 0;
_r = $clone(v, Value).runes(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_arg$1 = ($runesToString(_r));
_arg$2 = t;
_r$1 = makeString(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtRunesString }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtStringRunes = function(v, t) {
var _arg, _arg$1, _arg$2, _r, _r$1, t, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _arg = $f._arg; _arg$1 = $f._arg$1; _arg$2 = $f._arg$2; _r = $f._r; _r$1 = $f._r$1; t = $f.t; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_arg = (v.flag & 96) >>> 0;
_r = $clone(v, Value).String(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_arg$1 = (new sliceType$17($stringToRunes(_r)));
_arg$2 = t;
_r$1 = makeRunes(_arg, _arg$1, _arg$2); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return _r$1;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtStringRunes }; } $f._arg = _arg; $f._arg$1 = _arg$1; $f._arg$2 = _arg$2; $f._r = _r; $f._r$1 = _r$1; $f.t = t; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
cvtT2I = function(v, typ) {
var _r, _r$1, _r$2, _r$3, _r$4, target, typ, v, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; target = $f.target; typ = $f.typ; v = $f.v; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
_r = typ.common(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r$1 = unsafe_New(_r); /* */ $s = 2; case 2: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
target = _r$1;
_r$2 = valueInterface($clone(v, Value), false); /* */ $s = 3; case 3: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
x = _r$2;
_r$3 = typ.NumMethod(); /* */ $s = 7; case 7: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
/* */ if (_r$3 === 0) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (_r$3 === 0) { */ case 4:
(target).$set(x);
$s = 6; continue;
/* } else { */ case 5:
ifaceE2I($assertType(typ, ptrType$1), x, target);
/* } */ case 6:
_r$4 = typ.common(); /* */ $s = 8; case 8: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
$s = -1; return new Value.ptr(_r$4, target, (((((v.flag & 96) >>> 0) | 128) >>> 0) | 20) >>> 0);
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtT2I }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f.target = target; $f.typ = typ; $f.v = v; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
cvtI2I = function(v, typ) {
var _r, _r$1, _r$2, ret, typ, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; ret = $f.ret; typ = $f.typ; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
/* */ if ($clone(v, Value).IsNil()) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if ($clone(v, Value).IsNil()) { */ case 1:
_r = Zero(typ); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
ret = _r;
ret.flag = (ret.flag | (((v.flag & 96) >>> 0))) >>> 0;
$s = -1; return ret;
/* } */ case 2:
_r$1 = $clone(v, Value).Elem(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = cvtT2I($clone(_r$1, Value), typ); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
$s = -1; return _r$2;
/* */ } return; } if ($f === undefined) { $f = { $blk: cvtI2I }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.ret = ret; $f.typ = typ; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
ptrType$5.methods = [{prop: "methods", name: "methods", pkg: "reflect", typ: $funcType([], [sliceType$5], false)}];
ptrType$16.methods = [{prop: "in$", name: "in", pkg: "reflect", typ: $funcType([], [sliceType$2], false)}, {prop: "out", name: "out", pkg: "reflect", typ: $funcType([], [sliceType$2], false)}];
name.methods = [{prop: "name", name: "name", pkg: "reflect", typ: $funcType([], [$String], false)}, {prop: "tag", name: "tag", pkg: "reflect", typ: $funcType([], [$String], false)}, {prop: "pkgPath", name: "pkgPath", pkg: "reflect", typ: $funcType([], [$String], false)}, {prop: "isExported", name: "isExported", pkg: "reflect", typ: $funcType([], [$Bool], false)}, {prop: "data", name: "data", pkg: "reflect", typ: $funcType([$Int], [ptrType$4], false)}, {prop: "nameLen", name: "nameLen", pkg: "reflect", typ: $funcType([], [$Int], false)}, {prop: "tagLen", name: "tagLen", pkg: "reflect", typ: $funcType([], [$Int], false)}];
Kind.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
ptrType$1.methods = [{prop: "uncommon", name: "uncommon", pkg: "reflect", typ: $funcType([], [ptrType$5], false)}, {prop: "nameOff", name: "nameOff", pkg: "reflect", typ: $funcType([nameOff], [name], false)}, {prop: "typeOff", name: "typeOff", pkg: "reflect", typ: $funcType([typeOff], [ptrType$1], false)}, {prop: "ptrTo", name: "ptrTo", pkg: "reflect", typ: $funcType([], [ptrType$1], false)}, {prop: "pointers", name: "pointers", pkg: "reflect", typ: $funcType([], [$Bool], false)}, {prop: "Comparable", name: "Comparable", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Method", name: "Method", pkg: "", typ: $funcType([$Int], [Method], false)}, {prop: "textOff", name: "textOff", pkg: "reflect", typ: $funcType([textOff], [$UnsafePointer], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "Bits", name: "Bits", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Align", name: "Align", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "FieldAlign", name: "FieldAlign", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Kind", name: "Kind", pkg: "", typ: $funcType([], [Kind], false)}, {prop: "common", name: "common", pkg: "reflect", typ: $funcType([], [ptrType$1], false)}, {prop: "exportedMethods", name: "exportedMethods", pkg: "reflect", typ: $funcType([], [sliceType$5], false)}, {prop: "NumMethod", name: "NumMethod", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "MethodByName", name: "MethodByName", pkg: "", typ: $funcType([$String], [Method, $Bool], false)}, {prop: "PkgPath", name: "PkgPath", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "ChanDir", name: "ChanDir", pkg: "", typ: $funcType([], [ChanDir], false)}, {prop: "IsVariadic", name: "IsVariadic", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Elem", name: "Elem", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Field", name: "Field", pkg: "", typ: $funcType([$Int], [StructField], false)}, {prop: "FieldByIndex", name: "FieldByIndex", pkg: "", typ: $funcType([sliceType$13], [StructField], false)}, {prop: "FieldByName", name: "FieldByName", pkg: "", typ: $funcType([$String], [StructField, $Bool], false)}, {prop: "FieldByNameFunc", name: "FieldByNameFunc", pkg: "", typ: $funcType([funcType$3], [StructField, $Bool], false)}, {prop: "In", name: "In", pkg: "", typ: $funcType([$Int], [Type], false)}, {prop: "Key", name: "Key", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumField", name: "NumField", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumIn", name: "NumIn", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumOut", name: "NumOut", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Out", name: "Out", pkg: "", typ: $funcType([$Int], [Type], false)}, {prop: "Implements", name: "Implements", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "AssignableTo", name: "AssignableTo", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "ConvertibleTo", name: "ConvertibleTo", pkg: "", typ: $funcType([Type], [$Bool], false)}];
ChanDir.methods = [{prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
ptrType$7.methods = [{prop: "Method", name: "Method", pkg: "", typ: $funcType([$Int], [Method], false)}, {prop: "NumMethod", name: "NumMethod", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "MethodByName", name: "MethodByName", pkg: "", typ: $funcType([$String], [Method, $Bool], false)}];
ptrType$17.methods = [{prop: "offset", name: "offset", pkg: "reflect", typ: $funcType([], [$Uintptr], false)}, {prop: "anon", name: "anon", pkg: "reflect", typ: $funcType([], [$Bool], false)}];
ptrType$9.methods = [{prop: "Field", name: "Field", pkg: "", typ: $funcType([$Int], [StructField], false)}, {prop: "FieldByIndex", name: "FieldByIndex", pkg: "", typ: $funcType([sliceType$13], [StructField], false)}, {prop: "FieldByNameFunc", name: "FieldByNameFunc", pkg: "", typ: $funcType([funcType$3], [StructField, $Bool], false)}, {prop: "FieldByName", name: "FieldByName", pkg: "", typ: $funcType([$String], [StructField, $Bool], false)}];
StructTag.methods = [{prop: "Get", name: "Get", pkg: "", typ: $funcType([$String], [$String], false)}, {prop: "Lookup", name: "Lookup", pkg: "", typ: $funcType([$String], [$String, $Bool], false)}];
Value.methods = [{prop: "object", name: "object", pkg: "reflect", typ: $funcType([], [ptrType$2], false)}, {prop: "call", name: "call", pkg: "reflect", typ: $funcType([$String, sliceType$9], [sliceType$9], false)}, {prop: "Cap", name: "Cap", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Elem", name: "Elem", pkg: "", typ: $funcType([], [Value], false)}, {prop: "Field", name: "Field", pkg: "", typ: $funcType([$Int], [Value], false)}, {prop: "Index", name: "Index", pkg: "", typ: $funcType([$Int], [Value], false)}, {prop: "InterfaceData", name: "InterfaceData", pkg: "", typ: $funcType([], [arrayType$12], false)}, {prop: "IsNil", name: "IsNil", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Pointer", name: "Pointer", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "Set", name: "Set", pkg: "", typ: $funcType([Value], [], false)}, {prop: "SetBytes", name: "SetBytes", pkg: "", typ: $funcType([sliceType$15], [], false)}, {prop: "SetCap", name: "SetCap", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "SetLen", name: "SetLen", pkg: "", typ: $funcType([$Int], [], false)}, {prop: "Slice", name: "Slice", pkg: "", typ: $funcType([$Int, $Int], [Value], false)}, {prop: "Slice3", name: "Slice3", pkg: "", typ: $funcType([$Int, $Int, $Int], [Value], false)}, {prop: "Close", name: "Close", pkg: "", typ: $funcType([], [], false)}, {prop: "pointer", name: "pointer", pkg: "reflect", typ: $funcType([], [$UnsafePointer], false)}, {prop: "Addr", name: "Addr", pkg: "", typ: $funcType([], [Value], false)}, {prop: "Bool", name: "Bool", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Bytes", name: "Bytes", pkg: "", typ: $funcType([], [sliceType$15], false)}, {prop: "runes", name: "runes", pkg: "reflect", typ: $funcType([], [sliceType$17], false)}, {prop: "CanAddr", name: "CanAddr", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "CanSet", name: "CanSet", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Call", name: "Call", pkg: "", typ: $funcType([sliceType$9], [sliceType$9], false)}, {prop: "CallSlice", name: "CallSlice", pkg: "", typ: $funcType([sliceType$9], [sliceType$9], false)}, {prop: "Complex", name: "Complex", pkg: "", typ: $funcType([], [$Complex128], false)}, {prop: "FieldByIndex", name: "FieldByIndex", pkg: "", typ: $funcType([sliceType$13], [Value], false)}, {prop: "FieldByName", name: "FieldByName", pkg: "", typ: $funcType([$String], [Value], false)}, {prop: "FieldByNameFunc", name: "FieldByNameFunc", pkg: "", typ: $funcType([funcType$3], [Value], false)}, {prop: "Float", name: "Float", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Int", name: "Int", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "CanInterface", name: "CanInterface", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Interface", name: "Interface", pkg: "", typ: $funcType([], [$emptyInterface], false)}, {prop: "IsValid", name: "IsValid", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Kind", name: "Kind", pkg: "", typ: $funcType([], [Kind], false)}, {prop: "MapIndex", name: "MapIndex", pkg: "", typ: $funcType([Value], [Value], false)}, {prop: "MapKeys", name: "MapKeys", pkg: "", typ: $funcType([], [sliceType$9], false)}, {prop: "Method", name: "Method", pkg: "", typ: $funcType([$Int], [Value], false)}, {prop: "NumMethod", name: "NumMethod", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "MethodByName", name: "MethodByName", pkg: "", typ: $funcType([$String], [Value], false)}, {prop: "NumField", name: "NumField", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "OverflowComplex", name: "OverflowComplex", pkg: "", typ: $funcType([$Complex128], [$Bool], false)}, {prop: "OverflowFloat", name: "OverflowFloat", pkg: "", typ: $funcType([$Float64], [$Bool], false)}, {prop: "OverflowInt", name: "OverflowInt", pkg: "", typ: $funcType([$Int64], [$Bool], false)}, {prop: "OverflowUint", name: "OverflowUint", pkg: "", typ: $funcType([$Uint64], [$Bool], false)}, {prop: "Recv", name: "Recv", pkg: "", typ: $funcType([], [Value, $Bool], false)}, {prop: "recv", name: "recv", pkg: "reflect", typ: $funcType([$Bool], [Value, $Bool], false)}, {prop: "Send", name: "Send", pkg: "", typ: $funcType([Value], [], false)}, {prop: "send", name: "send", pkg: "reflect", typ: $funcType([Value, $Bool], [$Bool], false)}, {prop: "SetBool", name: "SetBool", pkg: "", typ: $funcType([$Bool], [], false)}, {prop: "setRunes", name: "setRunes", pkg: "reflect", typ: $funcType([sliceType$17], [], false)}, {prop: "SetComplex", name: "SetComplex", pkg: "", typ: $funcType([$Complex128], [], false)}, {prop: "SetFloat", name: "SetFloat", pkg: "", typ: $funcType([$Float64], [], false)}, {prop: "SetInt", name: "SetInt", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "SetMapIndex", name: "SetMapIndex", pkg: "", typ: $funcType([Value, Value], [], false)}, {prop: "SetUint", name: "SetUint", pkg: "", typ: $funcType([$Uint64], [], false)}, {prop: "SetPointer", name: "SetPointer", pkg: "", typ: $funcType([$UnsafePointer], [], false)}, {prop: "SetString", name: "SetString", pkg: "", typ: $funcType([$String], [], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "TryRecv", name: "TryRecv", pkg: "", typ: $funcType([], [Value, $Bool], false)}, {prop: "TrySend", name: "TrySend", pkg: "", typ: $funcType([Value], [$Bool], false)}, {prop: "Type", name: "Type", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Uint", name: "Uint", pkg: "", typ: $funcType([], [$Uint64], false)}, {prop: "UnsafeAddr", name: "UnsafeAddr", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "assignTo", name: "assignTo", pkg: "reflect", typ: $funcType([$String, ptrType$1, $UnsafePointer], [Value], false)}, {prop: "Convert", name: "Convert", pkg: "", typ: $funcType([Type], [Value], false)}];
flag.methods = [{prop: "kind", name: "kind", pkg: "reflect", typ: $funcType([], [Kind], false)}, {prop: "mustBe", name: "mustBe", pkg: "reflect", typ: $funcType([Kind], [], false)}, {prop: "mustBeExported", name: "mustBeExported", pkg: "reflect", typ: $funcType([], [], false)}, {prop: "mustBeAssignable", name: "mustBeAssignable", pkg: "reflect", typ: $funcType([], [], false)}];
ptrType$18.methods = [{prop: "Error", name: "Error", pkg: "", typ: $funcType([], [$String], false)}];
uncommonType.init("reflect", [{prop: "pkgPath", name: "pkgPath", anonymous: false, exported: false, typ: nameOff, tag: ""}, {prop: "mcount", name: "mcount", anonymous: false, exported: false, typ: $Uint16, tag: ""}, {prop: "_$2", name: "_", anonymous: false, exported: false, typ: $Uint16, tag: ""}, {prop: "moff", name: "moff", anonymous: false, exported: false, typ: $Uint32, tag: ""}, {prop: "_$4", name: "_", anonymous: false, exported: false, typ: $Uint32, tag: ""}, {prop: "_methods", name: "_methods", anonymous: false, exported: false, typ: sliceType$5, tag: ""}]);
funcType.init("reflect", [{prop: "rtype", name: "rtype", anonymous: true, exported: false, typ: rtype, tag: "reflect:\"func\""}, {prop: "inCount", name: "inCount", anonymous: false, exported: false, typ: $Uint16, tag: ""}, {prop: "outCount", name: "outCount", anonymous: false, exported: false, typ: $Uint16, tag: ""}, {prop: "_in", name: "_in", anonymous: false, exported: false, typ: sliceType$2, tag: ""}, {prop: "_out", name: "_out", anonymous: false, exported: false, typ: sliceType$2, tag: ""}]);
name.init("reflect", [{prop: "bytes", name: "bytes", anonymous: false, exported: false, typ: ptrType$4, tag: ""}]);
nameData.init("reflect", [{prop: "name", name: "name", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "tag", name: "tag", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "pkgPath", name: "pkgPath", anonymous: false, exported: false, typ: $String, tag: ""}, {prop: "exported", name: "exported", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
mapIter.init("reflect", [{prop: "t", name: "t", anonymous: false, exported: false, typ: Type, tag: ""}, {prop: "m", name: "m", anonymous: false, exported: false, typ: ptrType$2, tag: ""}, {prop: "keys", name: "keys", anonymous: false, exported: false, typ: ptrType$2, tag: ""}, {prop: "i", name: "i", anonymous: false, exported: false, typ: $Int, tag: ""}]);
Type.init([{prop: "Align", name: "Align", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "AssignableTo", name: "AssignableTo", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "Bits", name: "Bits", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "ChanDir", name: "ChanDir", pkg: "", typ: $funcType([], [ChanDir], false)}, {prop: "Comparable", name: "Comparable", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "ConvertibleTo", name: "ConvertibleTo", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "Elem", name: "Elem", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Field", name: "Field", pkg: "", typ: $funcType([$Int], [StructField], false)}, {prop: "FieldAlign", name: "FieldAlign", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "FieldByIndex", name: "FieldByIndex", pkg: "", typ: $funcType([sliceType$13], [StructField], false)}, {prop: "FieldByName", name: "FieldByName", pkg: "", typ: $funcType([$String], [StructField, $Bool], false)}, {prop: "FieldByNameFunc", name: "FieldByNameFunc", pkg: "", typ: $funcType([funcType$3], [StructField, $Bool], false)}, {prop: "Implements", name: "Implements", pkg: "", typ: $funcType([Type], [$Bool], false)}, {prop: "In", name: "In", pkg: "", typ: $funcType([$Int], [Type], false)}, {prop: "IsVariadic", name: "IsVariadic", pkg: "", typ: $funcType([], [$Bool], false)}, {prop: "Key", name: "Key", pkg: "", typ: $funcType([], [Type], false)}, {prop: "Kind", name: "Kind", pkg: "", typ: $funcType([], [Kind], false)}, {prop: "Len", name: "Len", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Method", name: "Method", pkg: "", typ: $funcType([$Int], [Method], false)}, {prop: "MethodByName", name: "MethodByName", pkg: "", typ: $funcType([$String], [Method, $Bool], false)}, {prop: "Name", name: "Name", pkg: "", typ: $funcType([], [$String], false)}, {prop: "NumField", name: "NumField", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumIn", name: "NumIn", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumMethod", name: "NumMethod", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "NumOut", name: "NumOut", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Out", name: "Out", pkg: "", typ: $funcType([$Int], [Type], false)}, {prop: "PkgPath", name: "PkgPath", pkg: "", typ: $funcType([], [$String], false)}, {prop: "Size", name: "Size", pkg: "", typ: $funcType([], [$Uintptr], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}, {prop: "common", name: "common", pkg: "reflect", typ: $funcType([], [ptrType$1], false)}, {prop: "uncommon", name: "uncommon", pkg: "reflect", typ: $funcType([], [ptrType$5], false)}]);
rtype.init("reflect", [{prop: "size", name: "size", anonymous: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "ptrdata", name: "ptrdata", anonymous: false, exported: false, typ: $Uintptr, tag: ""}, {prop: "hash", name: "hash", anonymous: false, exported: false, typ: $Uint32, tag: ""}, {prop: "tflag", name: "tflag", anonymous: false, exported: false, typ: tflag, tag: ""}, {prop: "align", name: "align", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "fieldAlign", name: "fieldAlign", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "kind", name: "kind", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "alg", name: "alg", anonymous: false, exported: false, typ: ptrType$3, tag: ""}, {prop: "gcdata", name: "gcdata", anonymous: false, exported: false, typ: ptrType$4, tag: ""}, {prop: "str", name: "str", anonymous: false, exported: false, typ: nameOff, tag: ""}, {prop: "ptrToThis", name: "ptrToThis", anonymous: false, exported: false, typ: typeOff, tag: ""}]);
typeAlg.init("reflect", [{prop: "hash", name: "hash", anonymous: false, exported: false, typ: funcType$4, tag: ""}, {prop: "equal", name: "equal", anonymous: false, exported: false, typ: funcType$5, tag: ""}]);
method.init("reflect", [{prop: "name", name: "name", anonymous: false, exported: false, typ: nameOff, tag: ""}, {prop: "mtyp", name: "mtyp", anonymous: false, exported: false, typ: typeOff, tag: ""}, {prop: "ifn", name: "ifn", anonymous: false, exported: false, typ: textOff, tag: ""}, {prop: "tfn", name: "tfn", anonymous: false, exported: false, typ: textOff, tag: ""}]);
arrayType.init("reflect", [{prop: "rtype", name: "rtype", anonymous: true, exported: false, typ: rtype, tag: "reflect:\"array\""}, {prop: "elem", name: "elem", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "slice", name: "slice", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "len", name: "len", anonymous: false, exported: false, typ: $Uintptr, tag: ""}]);
chanType.init("reflect", [{prop: "rtype", name: "rtype", anonymous: true, exported: false, typ: rtype, tag: "reflect:\"chan\""}, {prop: "elem", name: "elem", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "dir", name: "dir", anonymous: false, exported: false, typ: $Uintptr, tag: ""}]);
imethod.init("reflect", [{prop: "name", name: "name", anonymous: false, exported: false, typ: nameOff, tag: ""}, {prop: "typ", name: "typ", anonymous: false, exported: false, typ: typeOff, tag: ""}]);
interfaceType.init("reflect", [{prop: "rtype", name: "rtype", anonymous: true, exported: false, typ: rtype, tag: "reflect:\"interface\""}, {prop: "pkgPath", name: "pkgPath", anonymous: false, exported: false, typ: name, tag: ""}, {prop: "methods", name: "methods", anonymous: false, exported: false, typ: sliceType$6, tag: ""}]);
mapType.init("reflect", [{prop: "rtype", name: "rtype", anonymous: true, exported: false, typ: rtype, tag: "reflect:\"map\""}, {prop: "key", name: "key", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "elem", name: "elem", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "bucket", name: "bucket", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "hmap", name: "hmap", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "keysize", name: "keysize", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "indirectkey", name: "indirectkey", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "valuesize", name: "valuesize", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "indirectvalue", name: "indirectvalue", anonymous: false, exported: false, typ: $Uint8, tag: ""}, {prop: "bucketsize", name: "bucketsize", anonymous: false, exported: false, typ: $Uint16, tag: ""}, {prop: "reflexivekey", name: "reflexivekey", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "needkeyupdate", name: "needkeyupdate", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
ptrType.init("reflect", [{prop: "rtype", name: "rtype", anonymous: true, exported: false, typ: rtype, tag: "reflect:\"ptr\""}, {prop: "elem", name: "elem", anonymous: false, exported: false, typ: ptrType$1, tag: ""}]);
sliceType.init("reflect", [{prop: "rtype", name: "rtype", anonymous: true, exported: false, typ: rtype, tag: "reflect:\"slice\""}, {prop: "elem", name: "elem", anonymous: false, exported: false, typ: ptrType$1, tag: ""}]);
structField.init("reflect", [{prop: "name", name: "name", anonymous: false, exported: false, typ: name, tag: ""}, {prop: "typ", name: "typ", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "offsetAnon", name: "offsetAnon", anonymous: false, exported: false, typ: $Uintptr, tag: ""}]);
structType.init("reflect", [{prop: "rtype", name: "rtype", anonymous: true, exported: false, typ: rtype, tag: "reflect:\"struct\""}, {prop: "pkgPath", name: "pkgPath", anonymous: false, exported: false, typ: name, tag: ""}, {prop: "fields", name: "fields", anonymous: false, exported: false, typ: sliceType$7, tag: ""}]);
Method.init("", [{prop: "Name", name: "Name", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "PkgPath", name: "PkgPath", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Type", name: "Type", anonymous: false, exported: true, typ: Type, tag: ""}, {prop: "Func", name: "Func", anonymous: false, exported: true, typ: Value, tag: ""}, {prop: "Index", name: "Index", anonymous: false, exported: true, typ: $Int, tag: ""}]);
StructField.init("", [{prop: "Name", name: "Name", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "PkgPath", name: "PkgPath", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Type", name: "Type", anonymous: false, exported: true, typ: Type, tag: ""}, {prop: "Tag", name: "Tag", anonymous: false, exported: true, typ: StructTag, tag: ""}, {prop: "Offset", name: "Offset", anonymous: false, exported: true, typ: $Uintptr, tag: ""}, {prop: "Index", name: "Index", anonymous: false, exported: true, typ: sliceType$13, tag: ""}, {prop: "Anonymous", name: "Anonymous", anonymous: false, exported: true, typ: $Bool, tag: ""}]);
fieldScan.init("reflect", [{prop: "typ", name: "typ", anonymous: false, exported: false, typ: ptrType$9, tag: ""}, {prop: "index", name: "index", anonymous: false, exported: false, typ: sliceType$13, tag: ""}]);
Value.init("reflect", [{prop: "typ", name: "typ", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "ptr", name: "ptr", anonymous: false, exported: false, typ: $UnsafePointer, tag: ""}, {prop: "flag", name: "flag", anonymous: true, exported: false, typ: flag, tag: ""}]);
ValueError.init("", [{prop: "Method", name: "Method", anonymous: false, exported: true, typ: $String, tag: ""}, {prop: "Kind", name: "Kind", anonymous: false, exported: true, typ: Kind, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = js.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = math.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = runtime.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = strconv.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = sync.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = unicode.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = utf8.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
nameOffList = sliceType$1.nil;
typeOffList = sliceType$2.nil;
methodCache = new sync.Map.ptr(new sync.Mutex.ptr(0, 0), new $packages["sync/atomic"].Value.ptr(new $packages["sync/atomic"].noCopy.ptr(), $ifaceNil), false, 0);
initialized = false;
uncommonTypeMap = {};
nameMap = {};
callHelper = $assertType($internalize($call, $emptyInterface), funcType$1);
selectHelper = $assertType($internalize($select, $emptyInterface), funcType$1);
jsObjectPtr = reflectType($jsObjectPtr);
kindNames = new sliceType$4(["invalid", "bool", "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr", "float32", "float64", "complex64", "complex128", "array", "chan", "func", "interface", "map", "ptr", "slice", "string", "struct", "unsafe.Pointer"]);
uint8Type = $assertType(TypeOf(new $Uint8(0)), ptrType$1);
$r = init(); /* */ $s = 9; case 9: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["fmt"] = (function() {
var $pkg = {}, $init, errors, io, math, os, reflect, strconv, sync, utf8, fmtFlags, fmt, buffer, pp, scanError, ss, ssave, sliceType, ptrType, ptrType$1, arrayType, arrayType$1, sliceType$1, sliceType$2, ptrType$2, ptrType$5, ptrType$25, funcType, ppFree, space, ssFree, complexError, boolError, isSpace, notSpace, indexRune;
errors = $packages["errors"];
io = $packages["io"];
math = $packages["math"];
os = $packages["os"];
reflect = $packages["reflect"];
strconv = $packages["strconv"];
sync = $packages["sync"];
utf8 = $packages["unicode/utf8"];
fmtFlags = $pkg.fmtFlags = $newType(0, $kindStruct, "fmt.fmtFlags", true, "fmt", false, function(widPresent_, precPresent_, minus_, plus_, sharp_, space_, zero_, plusV_, sharpV_) {
this.$val = this;
if (arguments.length === 0) {
this.widPresent = false;
this.precPresent = false;
this.minus = false;
this.plus = false;
this.sharp = false;
this.space = false;
this.zero = false;
this.plusV = false;
this.sharpV = false;
return;
}
this.widPresent = widPresent_;
this.precPresent = precPresent_;
this.minus = minus_;
this.plus = plus_;
this.sharp = sharp_;
this.space = space_;
this.zero = zero_;
this.plusV = plusV_;
this.sharpV = sharpV_;
});
fmt = $pkg.fmt = $newType(0, $kindStruct, "fmt.fmt", true, "fmt", false, function(buf_, fmtFlags_, wid_, prec_, intbuf_) {
this.$val = this;
if (arguments.length === 0) {
this.buf = ptrType$1.nil;
this.fmtFlags = new fmtFlags.ptr(false, false, false, false, false, false, false, false, false);
this.wid = 0;
this.prec = 0;
this.intbuf = arrayType.zero();
return;
}
this.buf = buf_;
this.fmtFlags = fmtFlags_;
this.wid = wid_;
this.prec = prec_;
this.intbuf = intbuf_;
});
buffer = $pkg.buffer = $newType(12, $kindSlice, "fmt.buffer", true, "fmt", false, null);
pp = $pkg.pp = $newType(0, $kindStruct, "fmt.pp", true, "fmt", false, function(buf_, arg_, value_, fmt_, reordered_, goodArgNum_, panicking_, erroring_) {
this.$val = this;
if (arguments.length === 0) {
this.buf = buffer.nil;
this.arg = $ifaceNil;
this.value = new reflect.Value.ptr(ptrType.nil, 0, 0);
this.fmt = new fmt.ptr(ptrType$1.nil, new fmtFlags.ptr(false, false, false, false, false, false, false, false, false), 0, 0, arrayType.zero());
this.reordered = false;
this.goodArgNum = false;
this.panicking = false;
this.erroring = false;
return;
}
this.buf = buf_;
this.arg = arg_;
this.value = value_;
this.fmt = fmt_;
this.reordered = reordered_;
this.goodArgNum = goodArgNum_;
this.panicking = panicking_;
this.erroring = erroring_;
});
scanError = $pkg.scanError = $newType(0, $kindStruct, "fmt.scanError", true, "fmt", false, function(err_) {
this.$val = this;
if (arguments.length === 0) {
this.err = $ifaceNil;
return;
}
this.err = err_;
});
ss = $pkg.ss = $newType(0, $kindStruct, "fmt.ss", true, "fmt", false, function(rs_, buf_, count_, atEOF_, ssave_) {
this.$val = this;
if (arguments.length === 0) {
this.rs = $ifaceNil;
this.buf = buffer.nil;
this.count = 0;
this.atEOF = false;
this.ssave = new ssave.ptr(false, false, false, 0, 0, 0);
return;
}
this.rs = rs_;
this.buf = buf_;
this.count = count_;
this.atEOF = atEOF_;
this.ssave = ssave_;
});
ssave = $pkg.ssave = $newType(0, $kindStruct, "fmt.ssave", true, "fmt", false, function(validSave_, nlIsEnd_, nlIsSpace_, argLimit_, limit_, maxWid_) {
this.$val = this;
if (arguments.length === 0) {
this.validSave = false;
this.nlIsEnd = false;
this.nlIsSpace = false;
this.argLimit = 0;
this.limit = 0;
this.maxWid = 0;
return;
}
this.validSave = validSave_;
this.nlIsEnd = nlIsEnd_;
this.nlIsSpace = nlIsSpace_;
this.argLimit = argLimit_;
this.limit = limit_;
this.maxWid = maxWid_;
});
sliceType = $sliceType($emptyInterface);
ptrType = $ptrType(reflect.rtype);
ptrType$1 = $ptrType(buffer);
arrayType = $arrayType($Uint8, 68);
arrayType$1 = $arrayType($Uint16, 2);
sliceType$1 = $sliceType(arrayType$1);
sliceType$2 = $sliceType($Uint8);
ptrType$2 = $ptrType(pp);
ptrType$5 = $ptrType(ss);
ptrType$25 = $ptrType(fmt);
funcType = $funcType([$Int32], [$Bool], false);
$ptrType(buffer).prototype.Write = function(p) {
var b, p;
b = this;
b.$set($appendSlice(b.$get(), p));
};
$ptrType(buffer).prototype.WriteString = function(s) {
var b, s;
b = this;
b.$set($appendSlice(b.$get(), s));
};
$ptrType(buffer).prototype.WriteByte = function(c) {
var b, c;
b = this;
b.$set($append(b.$get(), c));
};
$ptrType(buffer).prototype.WriteRune = function(r) {
var b, bp, n, r, w, x;
bp = this;
if (r < 128) {
bp.$set($append(bp.$get(), ((r << 24 >>> 24))));
return;
}
b = bp.$get();
n = b.$length;
while (true) {
if (!((n + 4 >> 0) > b.$capacity)) { break; }
b = $append(b, 0);
}
w = utf8.EncodeRune((x = $subslice(b, n, (n + 4 >> 0)), $subslice(new sliceType$2(x.$array), x.$offset, x.$offset + x.$length)), r);
bp.$set($subslice(b, 0, (n + w >> 0)));
};
pp.ptr.prototype.Width = function() {
var _tmp, _tmp$1, ok, p, wid;
wid = 0;
ok = false;
p = this;
_tmp = p.fmt.wid;
_tmp$1 = p.fmt.fmtFlags.widPresent;
wid = _tmp;
ok = _tmp$1;
return [wid, ok];
};
pp.prototype.Width = function() { return this.$val.Width(); };
pp.ptr.prototype.Precision = function() {
var _tmp, _tmp$1, ok, p, prec;
prec = 0;
ok = false;
p = this;
_tmp = p.fmt.prec;
_tmp$1 = p.fmt.fmtFlags.precPresent;
prec = _tmp;
ok = _tmp$1;
return [prec, ok];
};
pp.prototype.Precision = function() { return this.$val.Precision(); };
pp.ptr.prototype.Flag = function(b) {
var _1, b, p;
p = this;
_1 = b;
if (_1 === (45)) {
return p.fmt.fmtFlags.minus;
} else if (_1 === (43)) {
return p.fmt.fmtFlags.plus || p.fmt.fmtFlags.plusV;
} else if (_1 === (35)) {
return p.fmt.fmtFlags.sharp || p.fmt.fmtFlags.sharpV;
} else if (_1 === (32)) {
return p.fmt.fmtFlags.space;
} else if (_1 === (48)) {
return p.fmt.fmtFlags.zero;
}
return false;
};
pp.prototype.Flag = function(b) { return this.$val.Flag(b); };
pp.ptr.prototype.Write = function(b) {
var _tmp, _tmp$1, b, err, p, ret;
ret = 0;
err = $ifaceNil;
p = this;
(p.$ptr_buf || (p.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, p))).Write(b);
_tmp = b.$length;
_tmp$1 = $ifaceNil;
ret = _tmp;
err = _tmp$1;
return [ret, err];
};
pp.prototype.Write = function(b) { return this.$val.Write(b); };
ss.ptr.prototype.Read = function(buf) {
var _tmp, _tmp$1, buf, err, n, s;
n = 0;
err = $ifaceNil;
s = this;
_tmp = 0;
_tmp$1 = errors.New("ScanState's Read should not be called. Use ReadRune");
n = _tmp;
err = _tmp$1;
return [n, err];
};
ss.prototype.Read = function(buf) { return this.$val.Read(buf); };
ss.ptr.prototype.ReadRune = function() {
var _r, _tuple, err, r, s, size, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; r = $f.r; s = $f.s; size = $f.size; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = 0;
size = 0;
err = $ifaceNil;
s = this;
if (s.atEOF || s.count >= s.ssave.argLimit) {
err = io.EOF;
$s = -1; return [r, size, err];
}
_r = s.rs.ReadRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
r = _tuple[0];
size = _tuple[1];
err = _tuple[2];
if ($interfaceIsEqual(err, $ifaceNil)) {
s.count = s.count + (1) >> 0;
if (s.ssave.nlIsEnd && (r === 10)) {
s.atEOF = true;
}
} else if ($interfaceIsEqual(err, io.EOF)) {
s.atEOF = true;
}
$s = -1; return [r, size, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.ReadRune }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.r = r; $f.s = s; $f.size = size; $f.$s = $s; $f.$r = $r; return $f;
};
ss.prototype.ReadRune = function() { return this.$val.ReadRune(); };
ss.ptr.prototype.Width = function() {
var _tmp, _tmp$1, _tmp$2, _tmp$3, ok, s, wid;
wid = 0;
ok = false;
s = this;
if (s.ssave.maxWid === 1073741824) {
_tmp = 0;
_tmp$1 = false;
wid = _tmp;
ok = _tmp$1;
return [wid, ok];
}
_tmp$2 = s.ssave.maxWid;
_tmp$3 = true;
wid = _tmp$2;
ok = _tmp$3;
return [wid, ok];
};
ss.prototype.Width = function() { return this.$val.Width(); };
ss.ptr.prototype.getRune = function() {
var _r, _tuple, err, r, s, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; r = $f.r; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = 0;
s = this;
_r = s.ReadRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
r = _tuple[0];
err = _tuple[2];
if (!($interfaceIsEqual(err, $ifaceNil))) {
if ($interfaceIsEqual(err, io.EOF)) {
r = -1;
$s = -1; return r;
}
s.error(err);
}
$s = -1; return r;
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.getRune }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.r = r; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
};
ss.prototype.getRune = function() { return this.$val.getRune(); };
ss.ptr.prototype.UnreadRune = function() {
var _r, s, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
s = this;
_r = s.rs.UnreadRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_r;
s.atEOF = false;
s.count = s.count - (1) >> 0;
$s = -1; return $ifaceNil;
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.UnreadRune }; } $f._r = _r; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
};
ss.prototype.UnreadRune = function() { return this.$val.UnreadRune(); };
ss.ptr.prototype.error = function(err) {
var err, s, x;
s = this;
$panic((x = new scanError.ptr(err), new x.constructor.elem(x)));
};
ss.prototype.error = function(err) { return this.$val.error(err); };
ss.ptr.prototype.errorString = function(err) {
var err, s, x;
s = this;
$panic((x = new scanError.ptr(errors.New(err)), new x.constructor.elem(x)));
};
ss.prototype.errorString = function(err) { return this.$val.errorString(err); };
ss.ptr.prototype.Token = function(skipSpace, f) {
var _r, err, f, s, skipSpace, tok, $s, $deferred, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; f = $f.f; s = $f.s; skipSpace = $f.skipSpace; tok = $f.tok; $s = $f.$s; $deferred = $f.$deferred; $r = $f.$r; } var $err = null; try { s: while (true) { switch ($s) { case 0: $deferred = []; $deferred.index = $curGoroutine.deferStack.length; $curGoroutine.deferStack.push($deferred);
err = [err];
tok = sliceType$2.nil;
err[0] = $ifaceNil;
s = this;
$deferred.push([(function(err) { return function() {
var _tuple, e, ok, se;
e = $recover();
if (!($interfaceIsEqual(e, $ifaceNil))) {
_tuple = $assertType(e, scanError, true);
se = $clone(_tuple[0], scanError);
ok = _tuple[1];
if (ok) {
err[0] = se.err;
} else {
$panic(e);
}
}
}; })(err), []]);
if (f === $throwNilPointerError) {
f = notSpace;
}
s.buf = $subslice(s.buf, 0, 0);
_r = s.token(skipSpace, f); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
tok = _r;
$s = -1; return [tok, err[0]];
/* */ } return; } } catch(err) { $err = err; $s = -1; } finally { $callDeferred($deferred, $err); if (!$curGoroutine.asleep) { return [tok, err[0]]; } if($curGoroutine.asleep) { if ($f === undefined) { $f = { $blk: ss.ptr.prototype.Token }; } $f._r = _r; $f.err = err; $f.f = f; $f.s = s; $f.skipSpace = skipSpace; $f.tok = tok; $f.$s = $s; $f.$deferred = $deferred; $f.$r = $r; return $f; } }
};
ss.prototype.Token = function(skipSpace, f) { return this.$val.Token(skipSpace, f); };
isSpace = function(r) {
var _i, _ref, r, rng, rx;
if (r >= 65536) {
return false;
}
rx = ((r << 16 >>> 16));
_ref = space;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
rng = $clone(((_i < 0 || _i >= _ref.$length) ? ($throwRuntimeError("index out of range"), undefined) : _ref.$array[_ref.$offset + _i]), arrayType$1);
if (rx < rng[0]) {
return false;
}
if (rx <= rng[1]) {
return true;
}
_i++;
}
return false;
};
notSpace = function(r) {
var r;
return !isSpace(r);
};
ss.ptr.prototype.SkipSpace = function() {
var s, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
s = this;
$r = s.skipSpace(false); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.SkipSpace }; } $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
};
ss.prototype.SkipSpace = function() { return this.$val.SkipSpace(); };
ss.ptr.prototype.skipSpace = function(stopAtNewline) {
var _r, _r$1, _r$2, _v, r, s, stopAtNewline, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _v = $f._v; r = $f.r; s = $f.s; stopAtNewline = $f.stopAtNewline; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
s = this;
/* while (true) { */ case 1:
_r = s.getRune(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
r = _r;
if (r === -1) {
$s = -1; return;
}
if (!(r === 13)) { _v = false; $s = 6; continue s; }
_r$1 = s.peek("\n"); /* */ $s = 7; case 7: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_v = _r$1; case 6:
/* */ if (_v) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (_v) { */ case 4:
/* continue; */ $s = 1; continue;
/* } */ case 5:
/* */ if (r === 10) { $s = 8; continue; }
/* */ $s = 9; continue;
/* if (r === 10) { */ case 8:
if (stopAtNewline) {
/* break; */ $s = 2; continue;
}
if (s.ssave.nlIsSpace) {
/* continue; */ $s = 1; continue;
}
s.errorString("unexpected newline");
$s = -1; return;
/* } */ case 9:
/* */ if (!isSpace(r)) { $s = 10; continue; }
/* */ $s = 11; continue;
/* if (!isSpace(r)) { */ case 10:
_r$2 = s.UnreadRune(); /* */ $s = 12; case 12: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_r$2;
/* break; */ $s = 2; continue;
/* } */ case 11:
/* } */ $s = 1; continue; case 2:
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.skipSpace }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._v = _v; $f.r = r; $f.s = s; $f.stopAtNewline = stopAtNewline; $f.$s = $s; $f.$r = $r; return $f;
};
ss.prototype.skipSpace = function(stopAtNewline) { return this.$val.skipSpace(stopAtNewline); };
ss.ptr.prototype.token = function(skipSpace, f) {
var _r, _r$1, _r$2, f, r, s, skipSpace, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; f = $f.f; r = $f.r; s = $f.s; skipSpace = $f.skipSpace; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
s = this;
/* */ if (skipSpace) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (skipSpace) { */ case 1:
$r = s.skipSpace(false); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
/* } */ case 2:
/* while (true) { */ case 4:
_r = s.getRune(); /* */ $s = 6; case 6: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
r = _r;
if (r === -1) {
/* break; */ $s = 5; continue;
}
_r$1 = f(r); /* */ $s = 9; case 9: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
/* */ if (!_r$1) { $s = 7; continue; }
/* */ $s = 8; continue;
/* if (!_r$1) { */ case 7:
_r$2 = s.UnreadRune(); /* */ $s = 10; case 10: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
_r$2;
/* break; */ $s = 5; continue;
/* } */ case 8:
(s.$ptr_buf || (s.$ptr_buf = new ptrType$1(function() { return this.$target.buf; }, function($v) { this.$target.buf = $v; }, s))).WriteRune(r);
/* } */ $s = 4; continue; case 5:
$s = -1; return (x = s.buf, $subslice(new sliceType$2(x.$array), x.$offset, x.$offset + x.$length));
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.token }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.f = f; $f.r = r; $f.s = s; $f.skipSpace = skipSpace; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
ss.prototype.token = function(skipSpace, f) { return this.$val.token(skipSpace, f); };
indexRune = function(s, r) {
var _i, _ref, _rune, c, i, r, s;
_ref = s;
_i = 0;
while (true) {
if (!(_i < _ref.length)) { break; }
_rune = $decodeRune(_ref, _i);
i = _i;
c = _rune[0];
if (c === r) {
return i;
}
_i += _rune[1];
}
return -1;
};
ss.ptr.prototype.peek = function(ok) {
var _r, _r$1, ok, r, s, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; ok = $f.ok; r = $f.r; s = $f.s; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
s = this;
_r = s.getRune(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
r = _r;
/* */ if (!((r === -1))) { $s = 2; continue; }
/* */ $s = 3; continue;
/* if (!((r === -1))) { */ case 2:
_r$1 = s.UnreadRune(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$1;
/* } */ case 3:
$s = -1; return indexRune(ok, r) >= 0;
/* */ } return; } if ($f === undefined) { $f = { $blk: ss.ptr.prototype.peek }; } $f._r = _r; $f._r$1 = _r$1; $f.ok = ok; $f.r = r; $f.s = s; $f.$s = $s; $f.$r = $r; return $f;
};
ss.prototype.peek = function(ok) { return this.$val.peek(ok); };
ptrType$25.methods = [{prop: "clearflags", name: "clearflags", pkg: "fmt", typ: $funcType([], [], false)}, {prop: "init", name: "init", pkg: "fmt", typ: $funcType([ptrType$1], [], false)}, {prop: "writePadding", name: "writePadding", pkg: "fmt", typ: $funcType([$Int], [], false)}, {prop: "pad", name: "pad", pkg: "fmt", typ: $funcType([sliceType$2], [], false)}, {prop: "padString", name: "padString", pkg: "fmt", typ: $funcType([$String], [], false)}, {prop: "fmt_boolean", name: "fmt_boolean", pkg: "fmt", typ: $funcType([$Bool], [], false)}, {prop: "fmt_unicode", name: "fmt_unicode", pkg: "fmt", typ: $funcType([$Uint64], [], false)}, {prop: "fmt_integer", name: "fmt_integer", pkg: "fmt", typ: $funcType([$Uint64, $Int, $Bool, $String], [], false)}, {prop: "truncate", name: "truncate", pkg: "fmt", typ: $funcType([$String], [$String], false)}, {prop: "fmt_s", name: "fmt_s", pkg: "fmt", typ: $funcType([$String], [], false)}, {prop: "fmt_sbx", name: "fmt_sbx", pkg: "fmt", typ: $funcType([$String, sliceType$2, $String], [], false)}, {prop: "fmt_sx", name: "fmt_sx", pkg: "fmt", typ: $funcType([$String, $String], [], false)}, {prop: "fmt_bx", name: "fmt_bx", pkg: "fmt", typ: $funcType([sliceType$2, $String], [], false)}, {prop: "fmt_q", name: "fmt_q", pkg: "fmt", typ: $funcType([$String], [], false)}, {prop: "fmt_c", name: "fmt_c", pkg: "fmt", typ: $funcType([$Uint64], [], false)}, {prop: "fmt_qc", name: "fmt_qc", pkg: "fmt", typ: $funcType([$Uint64], [], false)}, {prop: "fmt_float", name: "fmt_float", pkg: "fmt", typ: $funcType([$Float64, $Int, $Int32, $Int], [], false)}];
ptrType$1.methods = [{prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$2], [], false)}, {prop: "WriteString", name: "WriteString", pkg: "", typ: $funcType([$String], [], false)}, {prop: "WriteByte", name: "WriteByte", pkg: "", typ: $funcType([$Uint8], [], false)}, {prop: "WriteRune", name: "WriteRune", pkg: "", typ: $funcType([$Int32], [], false)}];
ptrType$2.methods = [{prop: "free", name: "free", pkg: "fmt", typ: $funcType([], [], false)}, {prop: "Width", name: "Width", pkg: "", typ: $funcType([], [$Int, $Bool], false)}, {prop: "Precision", name: "Precision", pkg: "", typ: $funcType([], [$Int, $Bool], false)}, {prop: "Flag", name: "Flag", pkg: "", typ: $funcType([$Int], [$Bool], false)}, {prop: "Write", name: "Write", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "unknownType", name: "unknownType", pkg: "fmt", typ: $funcType([reflect.Value], [], false)}, {prop: "badVerb", name: "badVerb", pkg: "fmt", typ: $funcType([$Int32], [], false)}, {prop: "fmtBool", name: "fmtBool", pkg: "fmt", typ: $funcType([$Bool, $Int32], [], false)}, {prop: "fmt0x64", name: "fmt0x64", pkg: "fmt", typ: $funcType([$Uint64, $Bool], [], false)}, {prop: "fmtInteger", name: "fmtInteger", pkg: "fmt", typ: $funcType([$Uint64, $Bool, $Int32], [], false)}, {prop: "fmtFloat", name: "fmtFloat", pkg: "fmt", typ: $funcType([$Float64, $Int, $Int32], [], false)}, {prop: "fmtComplex", name: "fmtComplex", pkg: "fmt", typ: $funcType([$Complex128, $Int, $Int32], [], false)}, {prop: "fmtString", name: "fmtString", pkg: "fmt", typ: $funcType([$String, $Int32], [], false)}, {prop: "fmtBytes", name: "fmtBytes", pkg: "fmt", typ: $funcType([sliceType$2, $Int32, $String], [], false)}, {prop: "fmtPointer", name: "fmtPointer", pkg: "fmt", typ: $funcType([reflect.Value, $Int32], [], false)}, {prop: "catchPanic", name: "catchPanic", pkg: "fmt", typ: $funcType([$emptyInterface, $Int32], [], false)}, {prop: "handleMethods", name: "handleMethods", pkg: "fmt", typ: $funcType([$Int32], [$Bool], false)}, {prop: "printArg", name: "printArg", pkg: "fmt", typ: $funcType([$emptyInterface, $Int32], [], false)}, {prop: "printValue", name: "printValue", pkg: "fmt", typ: $funcType([reflect.Value, $Int32, $Int], [], false)}, {prop: "argNumber", name: "argNumber", pkg: "fmt", typ: $funcType([$Int, $String, $Int, $Int], [$Int, $Int, $Bool], false)}, {prop: "badArgNum", name: "badArgNum", pkg: "fmt", typ: $funcType([$Int32], [], false)}, {prop: "missingArg", name: "missingArg", pkg: "fmt", typ: $funcType([$Int32], [], false)}, {prop: "doPrintf", name: "doPrintf", pkg: "fmt", typ: $funcType([$String, sliceType], [], false)}, {prop: "doPrint", name: "doPrint", pkg: "fmt", typ: $funcType([sliceType], [], false)}, {prop: "doPrintln", name: "doPrintln", pkg: "fmt", typ: $funcType([sliceType], [], false)}];
ptrType$5.methods = [{prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$2], [$Int, $error], false)}, {prop: "ReadRune", name: "ReadRune", pkg: "", typ: $funcType([], [$Int32, $Int, $error], false)}, {prop: "Width", name: "Width", pkg: "", typ: $funcType([], [$Int, $Bool], false)}, {prop: "getRune", name: "getRune", pkg: "fmt", typ: $funcType([], [$Int32], false)}, {prop: "mustReadRune", name: "mustReadRune", pkg: "fmt", typ: $funcType([], [$Int32], false)}, {prop: "UnreadRune", name: "UnreadRune", pkg: "", typ: $funcType([], [$error], false)}, {prop: "error", name: "error", pkg: "fmt", typ: $funcType([$error], [], false)}, {prop: "errorString", name: "errorString", pkg: "fmt", typ: $funcType([$String], [], false)}, {prop: "Token", name: "Token", pkg: "", typ: $funcType([$Bool, funcType], [sliceType$2, $error], false)}, {prop: "SkipSpace", name: "SkipSpace", pkg: "", typ: $funcType([], [], false)}, {prop: "free", name: "free", pkg: "fmt", typ: $funcType([ssave], [], false)}, {prop: "skipSpace", name: "skipSpace", pkg: "fmt", typ: $funcType([$Bool], [], false)}, {prop: "token", name: "token", pkg: "fmt", typ: $funcType([$Bool, funcType], [sliceType$2], false)}, {prop: "consume", name: "consume", pkg: "fmt", typ: $funcType([$String, $Bool], [$Bool], false)}, {prop: "peek", name: "peek", pkg: "fmt", typ: $funcType([$String], [$Bool], false)}, {prop: "notEOF", name: "notEOF", pkg: "fmt", typ: $funcType([], [], false)}, {prop: "accept", name: "accept", pkg: "fmt", typ: $funcType([$String], [$Bool], false)}, {prop: "okVerb", name: "okVerb", pkg: "fmt", typ: $funcType([$Int32, $String, $String], [$Bool], false)}, {prop: "scanBool", name: "scanBool", pkg: "fmt", typ: $funcType([$Int32], [$Bool], false)}, {prop: "getBase", name: "getBase", pkg: "fmt", typ: $funcType([$Int32], [$Int, $String], false)}, {prop: "scanNumber", name: "scanNumber", pkg: "fmt", typ: $funcType([$String, $Bool], [$String], false)}, {prop: "scanRune", name: "scanRune", pkg: "fmt", typ: $funcType([$Int], [$Int64], false)}, {prop: "scanBasePrefix", name: "scanBasePrefix", pkg: "fmt", typ: $funcType([], [$Int, $String, $Bool], false)}, {prop: "scanInt", name: "scanInt", pkg: "fmt", typ: $funcType([$Int32, $Int], [$Int64], false)}, {prop: "scanUint", name: "scanUint", pkg: "fmt", typ: $funcType([$Int32, $Int], [$Uint64], false)}, {prop: "floatToken", name: "floatToken", pkg: "fmt", typ: $funcType([], [$String], false)}, {prop: "complexTokens", name: "complexTokens", pkg: "fmt", typ: $funcType([], [$String, $String], false)}, {prop: "convertFloat", name: "convertFloat", pkg: "fmt", typ: $funcType([$String, $Int], [$Float64], false)}, {prop: "scanComplex", name: "scanComplex", pkg: "fmt", typ: $funcType([$Int32, $Int], [$Complex128], false)}, {prop: "convertString", name: "convertString", pkg: "fmt", typ: $funcType([$Int32], [$String], false)}, {prop: "quotedString", name: "quotedString", pkg: "fmt", typ: $funcType([], [$String], false)}, {prop: "hexByte", name: "hexByte", pkg: "fmt", typ: $funcType([], [$Uint8, $Bool], false)}, {prop: "hexString", name: "hexString", pkg: "fmt", typ: $funcType([], [$String], false)}, {prop: "scanOne", name: "scanOne", pkg: "fmt", typ: $funcType([$Int32, $emptyInterface], [], false)}, {prop: "doScan", name: "doScan", pkg: "fmt", typ: $funcType([sliceType], [$Int, $error], false)}, {prop: "advance", name: "advance", pkg: "fmt", typ: $funcType([$String], [$Int], false)}, {prop: "doScanf", name: "doScanf", pkg: "fmt", typ: $funcType([$String, sliceType], [$Int, $error], false)}];
fmtFlags.init("fmt", [{prop: "widPresent", name: "widPresent", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "precPresent", name: "precPresent", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "minus", name: "minus", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "plus", name: "plus", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "sharp", name: "sharp", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "space", name: "space", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "zero", name: "zero", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "plusV", name: "plusV", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "sharpV", name: "sharpV", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
fmt.init("fmt", [{prop: "buf", name: "buf", anonymous: false, exported: false, typ: ptrType$1, tag: ""}, {prop: "fmtFlags", name: "fmtFlags", anonymous: true, exported: false, typ: fmtFlags, tag: ""}, {prop: "wid", name: "wid", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "prec", name: "prec", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "intbuf", name: "intbuf", anonymous: false, exported: false, typ: arrayType, tag: ""}]);
buffer.init($Uint8);
pp.init("fmt", [{prop: "buf", name: "buf", anonymous: false, exported: false, typ: buffer, tag: ""}, {prop: "arg", name: "arg", anonymous: false, exported: false, typ: $emptyInterface, tag: ""}, {prop: "value", name: "value", anonymous: false, exported: false, typ: reflect.Value, tag: ""}, {prop: "fmt", name: "fmt", anonymous: false, exported: false, typ: fmt, tag: ""}, {prop: "reordered", name: "reordered", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "goodArgNum", name: "goodArgNum", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "panicking", name: "panicking", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "erroring", name: "erroring", anonymous: false, exported: false, typ: $Bool, tag: ""}]);
scanError.init("fmt", [{prop: "err", name: "err", anonymous: false, exported: false, typ: $error, tag: ""}]);
ss.init("fmt", [{prop: "rs", name: "rs", anonymous: false, exported: false, typ: io.RuneScanner, tag: ""}, {prop: "buf", name: "buf", anonymous: false, exported: false, typ: buffer, tag: ""}, {prop: "count", name: "count", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "atEOF", name: "atEOF", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "ssave", name: "ssave", anonymous: true, exported: false, typ: ssave, tag: ""}]);
ssave.init("fmt", [{prop: "validSave", name: "validSave", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "nlIsEnd", name: "nlIsEnd", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "nlIsSpace", name: "nlIsSpace", anonymous: false, exported: false, typ: $Bool, tag: ""}, {prop: "argLimit", name: "argLimit", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "limit", name: "limit", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "maxWid", name: "maxWid", anonymous: false, exported: false, typ: $Int, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = errors.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = io.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = math.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = os.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = reflect.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = strconv.$init(); /* */ $s = 6; case 6: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = sync.$init(); /* */ $s = 7; case 7: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = utf8.$init(); /* */ $s = 8; case 8: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
ppFree = new sync.Pool.ptr(0, 0, sliceType.nil, (function() {
return new pp.ptr(buffer.nil, $ifaceNil, new reflect.Value.ptr(ptrType.nil, 0, 0), new fmt.ptr(ptrType$1.nil, new fmtFlags.ptr(false, false, false, false, false, false, false, false, false), 0, 0, arrayType.zero()), false, false, false, false);
}));
space = new sliceType$1([$toNativeArray($kindUint16, [9, 13]), $toNativeArray($kindUint16, [32, 32]), $toNativeArray($kindUint16, [133, 133]), $toNativeArray($kindUint16, [160, 160]), $toNativeArray($kindUint16, [5760, 5760]), $toNativeArray($kindUint16, [8192, 8202]), $toNativeArray($kindUint16, [8232, 8233]), $toNativeArray($kindUint16, [8239, 8239]), $toNativeArray($kindUint16, [8287, 8287]), $toNativeArray($kindUint16, [12288, 12288])]);
ssFree = new sync.Pool.ptr(0, 0, sliceType.nil, (function() {
return new ss.ptr($ifaceNil, buffer.nil, 0, false, new ssave.ptr(false, false, false, 0, 0, 0));
}));
complexError = errors.New("syntax error scanning complex number");
boolError = errors.New("syntax error scanning boolean");
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["math/rand"] = (function() {
var $pkg = {}, $init, nosync, math, Source, Source64, Rand, lockedSource, rngSource, arrayType, ptrType, ptrType$1, sliceType, ptrType$2, ptrType$3, sliceType$1, ptrType$5, ke, we, fe, kn, wn, fn, globalRand, rng_cooked, absInt32, NewSource, New, read, seedrand;
nosync = $packages["github.com/gopherjs/gopherjs/nosync"];
math = $packages["math"];
Source = $pkg.Source = $newType(8, $kindInterface, "rand.Source", true, "math/rand", true, null);
Source64 = $pkg.Source64 = $newType(8, $kindInterface, "rand.Source64", true, "math/rand", true, null);
Rand = $pkg.Rand = $newType(0, $kindStruct, "rand.Rand", true, "math/rand", true, function(src_, s64_, readVal_, readPos_) {
this.$val = this;
if (arguments.length === 0) {
this.src = $ifaceNil;
this.s64 = $ifaceNil;
this.readVal = new $Int64(0, 0);
this.readPos = 0;
return;
}
this.src = src_;
this.s64 = s64_;
this.readVal = readVal_;
this.readPos = readPos_;
});
lockedSource = $pkg.lockedSource = $newType(0, $kindStruct, "rand.lockedSource", true, "math/rand", false, function(lk_, src_) {
this.$val = this;
if (arguments.length === 0) {
this.lk = new nosync.Mutex.ptr(false);
this.src = $ifaceNil;
return;
}
this.lk = lk_;
this.src = src_;
});
rngSource = $pkg.rngSource = $newType(0, $kindStruct, "rand.rngSource", true, "math/rand", false, function(tap_, feed_, vec_) {
this.$val = this;
if (arguments.length === 0) {
this.tap = 0;
this.feed = 0;
this.vec = arrayType.zero();
return;
}
this.tap = tap_;
this.feed = feed_;
this.vec = vec_;
});
arrayType = $arrayType($Int64, 607);
ptrType = $ptrType(lockedSource);
ptrType$1 = $ptrType($Int8);
sliceType = $sliceType($Int);
ptrType$2 = $ptrType($Int64);
ptrType$3 = $ptrType(Rand);
sliceType$1 = $sliceType($Uint8);
ptrType$5 = $ptrType(rngSource);
Rand.ptr.prototype.ExpFloat64 = function() {
var _r, _r$1, _r$2, _r$3, i, j, r, x, x$1, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; i = $f.i; j = $f.j; r = $f.r; x = $f.x; x$1 = $f.x$1; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
/* while (true) { */ case 1:
_r = r.Uint32(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
j = _r;
i = (j & 255) >>> 0;
x = (j) * (((i < 0 || i >= we.length) ? ($throwRuntimeError("index out of range"), undefined) : we[i]));
if (j < ((i < 0 || i >= ke.length) ? ($throwRuntimeError("index out of range"), undefined) : ke[i])) {
$s = -1; return x;
}
/* */ if (i === 0) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (i === 0) { */ case 4:
_r$1 = r.Float64(); /* */ $s = 6; case 6: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = math.Log(_r$1); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
$s = -1; return 7.69711747013105 - _r$2;
/* } */ case 5:
_r$3 = r.Float64(); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
/* */ if ($fround(((i < 0 || i >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[i]) + $fround(($fround(_r$3)) * ($fround((x$1 = i - 1 >>> 0, ((x$1 < 0 || x$1 >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[x$1])) - ((i < 0 || i >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[i]))))) < ($fround(math.Exp(-x)))) { $s = 8; continue; }
/* */ $s = 9; continue;
/* if ($fround(((i < 0 || i >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[i]) + $fround(($fround(_r$3)) * ($fround((x$1 = i - 1 >>> 0, ((x$1 < 0 || x$1 >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[x$1])) - ((i < 0 || i >= fe.length) ? ($throwRuntimeError("index out of range"), undefined) : fe[i]))))) < ($fround(math.Exp(-x)))) { */ case 8:
$s = -1; return x;
/* } */ case 9:
/* } */ $s = 1; continue; case 2:
$s = -1; return 0;
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.ExpFloat64 }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f.i = i; $f.j = j; $f.r = r; $f.x = x; $f.x$1 = x$1; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.ExpFloat64 = function() { return this.$val.ExpFloat64(); };
absInt32 = function(i) {
var i;
if (i < 0) {
return ((-i >>> 0));
}
return ((i >>> 0));
};
Rand.ptr.prototype.NormFloat64 = function() {
var _r, _r$1, _r$2, _r$3, _r$4, _r$5, i, j, r, x, x$1, y, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; _r$5 = $f._r$5; i = $f.i; j = $f.j; r = $f.r; x = $f.x; x$1 = $f.x$1; y = $f.y; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
/* while (true) { */ case 1:
_r = r.Uint32(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
j = ((_r >> 0));
i = j & 127;
x = (j) * (((i < 0 || i >= wn.length) ? ($throwRuntimeError("index out of range"), undefined) : wn[i]));
if (absInt32(j) < ((i < 0 || i >= kn.length) ? ($throwRuntimeError("index out of range"), undefined) : kn[i])) {
$s = -1; return x;
}
/* */ if (i === 0) { $s = 4; continue; }
/* */ $s = 5; continue;
/* if (i === 0) { */ case 4:
/* while (true) { */ case 6:
_r$1 = r.Float64(); /* */ $s = 8; case 8: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = math.Log(_r$1); /* */ $s = 9; case 9: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
x = -_r$2 * 0.29047645161474317;
_r$3 = r.Float64(); /* */ $s = 10; case 10: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
_r$4 = math.Log(_r$3); /* */ $s = 11; case 11: if($c) { $c = false; _r$4 = _r$4.$blk(); } if (_r$4 && _r$4.$blk !== undefined) { break s; }
y = -_r$4;
if (y + y >= x * x) {
/* break; */ $s = 7; continue;
}
/* } */ $s = 6; continue; case 7:
if (j > 0) {
$s = -1; return 3.442619855899 + x;
}
$s = -1; return -3.442619855899 - x;
/* } */ case 5:
_r$5 = r.Float64(); /* */ $s = 14; case 14: if($c) { $c = false; _r$5 = _r$5.$blk(); } if (_r$5 && _r$5.$blk !== undefined) { break s; }
/* */ if ($fround(((i < 0 || i >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[i]) + $fround(($fround(_r$5)) * ($fround((x$1 = i - 1 >> 0, ((x$1 < 0 || x$1 >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[x$1])) - ((i < 0 || i >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[i]))))) < ($fround(math.Exp(-0.5 * x * x)))) { $s = 12; continue; }
/* */ $s = 13; continue;
/* if ($fround(((i < 0 || i >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[i]) + $fround(($fround(_r$5)) * ($fround((x$1 = i - 1 >> 0, ((x$1 < 0 || x$1 >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[x$1])) - ((i < 0 || i >= fn.length) ? ($throwRuntimeError("index out of range"), undefined) : fn[i]))))) < ($fround(math.Exp(-0.5 * x * x)))) { */ case 12:
$s = -1; return x;
/* } */ case 13:
/* } */ $s = 1; continue; case 2:
$s = -1; return 0;
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.NormFloat64 }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f._r$5 = _r$5; $f.i = i; $f.j = j; $f.r = r; $f.x = x; $f.x$1 = x$1; $f.y = y; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.NormFloat64 = function() { return this.$val.NormFloat64(); };
NewSource = function(seed) {
var rng, seed;
rng = new rngSource.ptr(0, 0, arrayType.zero());
rng.Seed(seed);
return rng;
};
$pkg.NewSource = NewSource;
New = function(src) {
var _tuple, s64, src;
_tuple = $assertType(src, Source64, true);
s64 = _tuple[0];
return new Rand.ptr(src, s64, new $Int64(0, 0), 0);
};
$pkg.New = New;
Rand.ptr.prototype.Seed = function(seed) {
var _tuple, lk, ok, r, seed, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _tuple = $f._tuple; lk = $f.lk; ok = $f.ok; r = $f.r; seed = $f.seed; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
_tuple = $assertType(r.src, ptrType, true);
lk = _tuple[0];
ok = _tuple[1];
/* */ if (ok) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (ok) { */ case 1:
$r = lk.seedPos(seed, (r.$ptr_readPos || (r.$ptr_readPos = new ptrType$1(function() { return this.$target.readPos; }, function($v) { this.$target.readPos = $v; }, r)))); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$s = -1; return;
/* } */ case 2:
$r = r.src.Seed(seed); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
r.readPos = 0;
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Seed }; } $f._tuple = _tuple; $f.lk = lk; $f.ok = ok; $f.r = r; $f.seed = seed; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Seed = function(seed) { return this.$val.Seed(seed); };
Rand.ptr.prototype.Int63 = function() {
var _r, r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
_r = r.src.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int63 }; } $f._r = _r; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Int63 = function() { return this.$val.Int63(); };
Rand.ptr.prototype.Uint32 = function() {
var _r, r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
_r = r.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return (($shiftRightInt64(_r, 31).$low >>> 0));
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Uint32 }; } $f._r = _r; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Uint32 = function() { return this.$val.Uint32(); };
Rand.ptr.prototype.Uint64 = function() {
var _r, _r$1, _r$2, r, x, x$1, x$2, x$3, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; r = $f.r; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
/* */ if (!($interfaceIsEqual(r.s64, $ifaceNil))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (!($interfaceIsEqual(r.s64, $ifaceNil))) { */ case 1:
_r = r.s64.Uint64(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r;
/* } */ case 2:
_r$1 = r.Int63(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_r$2 = r.Int63(); /* */ $s = 5; case 5: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
$s = -1; return (x = $shiftRightUint64(((x$1 = _r$1, new $Uint64(x$1.$high, x$1.$low))), 31), x$2 = $shiftLeft64(((x$3 = _r$2, new $Uint64(x$3.$high, x$3.$low))), 32), new $Uint64(x.$high | x$2.$high, (x.$low | x$2.$low) >>> 0));
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Uint64 }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.r = r; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Uint64 = function() { return this.$val.Uint64(); };
Rand.ptr.prototype.Int31 = function() {
var _r, r, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
_r = r.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return (((x = $shiftRightInt64(_r, 32), x.$low + ((x.$high >> 31) * 4294967296)) >> 0));
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int31 }; } $f._r = _r; $f.r = r; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Int31 = function() { return this.$val.Int31(); };
Rand.ptr.prototype.Int = function() {
var _r, r, u, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; r = $f.r; u = $f.u; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
_r = r.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
u = ((_r.$low >>> 0));
$s = -1; return ((((u << 1 >>> 0) >>> 1 >>> 0) >> 0));
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int }; } $f._r = _r; $f.r = r; $f.u = u; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Int = function() { return this.$val.Int(); };
Rand.ptr.prototype.Int63n = function(n) {
var _r, _r$1, _r$2, max, n, r, v, x, x$1, x$2, x$3, x$4, x$5, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; max = $f.max; n = $f.n; r = $f.r; v = $f.v; x = $f.x; x$1 = $f.x$1; x$2 = $f.x$2; x$3 = $f.x$3; x$4 = $f.x$4; x$5 = $f.x$5; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
if ((n.$high < 0 || (n.$high === 0 && n.$low <= 0))) {
$panic(new $String("invalid argument to Int63n"));
}
/* */ if ((x = (x$1 = new $Int64(n.$high - 0, n.$low - 1), new $Int64(n.$high & x$1.$high, (n.$low & x$1.$low) >>> 0)), (x.$high === 0 && x.$low === 0))) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if ((x = (x$1 = new $Int64(n.$high - 0, n.$low - 1), new $Int64(n.$high & x$1.$high, (n.$low & x$1.$low) >>> 0)), (x.$high === 0 && x.$low === 0))) { */ case 1:
_r = r.Int63(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return (x$2 = _r, x$3 = new $Int64(n.$high - 0, n.$low - 1), new $Int64(x$2.$high & x$3.$high, (x$2.$low & x$3.$low) >>> 0));
/* } */ case 2:
max = ((x$4 = (x$5 = $div64(new $Uint64(2147483648, 0), (new $Uint64(n.$high, n.$low)), true), new $Uint64(2147483647 - x$5.$high, 4294967295 - x$5.$low)), new $Int64(x$4.$high, x$4.$low)));
_r$1 = r.Int63(); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
v = _r$1;
/* while (true) { */ case 5:
/* if (!((v.$high > max.$high || (v.$high === max.$high && v.$low > max.$low)))) { break; } */ if(!((v.$high > max.$high || (v.$high === max.$high && v.$low > max.$low)))) { $s = 6; continue; }
_r$2 = r.Int63(); /* */ $s = 7; case 7: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
v = _r$2;
/* } */ $s = 5; continue; case 6:
$s = -1; return $div64(v, n, true);
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int63n }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f.max = max; $f.n = n; $f.r = r; $f.v = v; $f.x = x; $f.x$1 = x$1; $f.x$2 = x$2; $f.x$3 = x$3; $f.x$4 = x$4; $f.x$5 = x$5; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Int63n = function(n) { return this.$val.Int63n(n); };
Rand.ptr.prototype.Int31n = function(n) {
var _r, _r$1, _r$2, _r$3, _r$4, max, n, r, v, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _r$2 = $f._r$2; _r$3 = $f._r$3; _r$4 = $f._r$4; max = $f.max; n = $f.n; r = $f.r; v = $f.v; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
if (n <= 0) {
$panic(new $String("invalid argument to Int31n"));
}
/* */ if ((n & ((n - 1 >> 0))) === 0) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if ((n & ((n - 1 >> 0))) === 0) { */ case 1:
_r = r.Int31(); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return _r & ((n - 1 >> 0));
/* } */ case 2:
max = (((2147483647 - (_r$1 = 2147483648 % ((n >>> 0)), _r$1 === _r$1 ? _r$1 : $throwRuntimeError("integer divide by zero")) >>> 0) >> 0));
_r$2 = r.Int31(); /* */ $s = 4; case 4: if($c) { $c = false; _r$2 = _r$2.$blk(); } if (_r$2 && _r$2.$blk !== undefined) { break s; }
v = _r$2;
/* while (true) { */ case 5:
/* if (!(v > max)) { break; } */ if(!(v > max)) { $s = 6; continue; }
_r$3 = r.Int31(); /* */ $s = 7; case 7: if($c) { $c = false; _r$3 = _r$3.$blk(); } if (_r$3 && _r$3.$blk !== undefined) { break s; }
v = _r$3;
/* } */ $s = 5; continue; case 6:
$s = -1; return (_r$4 = v % n, _r$4 === _r$4 ? _r$4 : $throwRuntimeError("integer divide by zero"));
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Int31n }; } $f._r = _r; $f._r$1 = _r$1; $f._r$2 = _r$2; $f._r$3 = _r$3; $f._r$4 = _r$4; $f.max = max; $f.n = n; $f.r = r; $f.v = v; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Int31n = function(n) { return this.$val.Int31n(n); };
Rand.ptr.prototype.Intn = function(n) {
var _r, _r$1, n, r, x, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; n = $f.n; r = $f.r; x = $f.x; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
if (n <= 0) {
$panic(new $String("invalid argument to Intn"));
}
/* */ if (n <= 2147483647) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (n <= 2147483647) { */ case 1:
_r = r.Int31n(((n >> 0))); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
$s = -1; return ((_r >> 0));
/* } */ case 2:
_r$1 = r.Int63n((new $Int64(0, n))); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
$s = -1; return (((x = _r$1, x.$low + ((x.$high >> 31) * 4294967296)) >> 0));
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Intn }; } $f._r = _r; $f._r$1 = _r$1; $f.n = n; $f.r = r; $f.x = x; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Intn = function(n) { return this.$val.Intn(n); };
Rand.ptr.prototype.Float64 = function() {
var _r, f, r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
/* again: */ case 1:
_r = r.Int63(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
f = ($flatten64(_r)) / 9.223372036854776e+18;
/* */ if (f === 1) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (f === 1) { */ case 3:
/* goto again */ $s = 1; continue;
/* } */ case 4:
$s = -1; return f;
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Float64 }; } $f._r = _r; $f.f = f; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Float64 = function() { return this.$val.Float64(); };
Rand.ptr.prototype.Float32 = function() {
var _r, f, r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; f = $f.f; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
/* again: */ case 1:
_r = r.Float64(); /* */ $s = 2; case 2: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
f = ($fround(_r));
/* */ if (f === 1) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (f === 1) { */ case 3:
/* goto again */ $s = 1; continue;
/* } */ case 4:
$s = -1; return f;
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Float32 }; } $f._r = _r; $f.f = f; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Float32 = function() { return this.$val.Float32(); };
Rand.ptr.prototype.Perm = function(n) {
var _r, i, j, m, n, r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; i = $f.i; j = $f.j; m = $f.m; n = $f.n; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
m = $makeSlice(sliceType, n);
i = 0;
/* while (true) { */ case 1:
/* if (!(i < n)) { break; } */ if(!(i < n)) { $s = 2; continue; }
_r = r.Intn(i + 1 >> 0); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
j = _r;
((i < 0 || i >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + i] = ((j < 0 || j >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + j]));
((j < 0 || j >= m.$length) ? ($throwRuntimeError("index out of range"), undefined) : m.$array[m.$offset + j] = i);
i = i + (1) >> 0;
/* } */ $s = 1; continue; case 2:
$s = -1; return m;
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Perm }; } $f._r = _r; $f.i = i; $f.j = j; $f.m = m; $f.n = n; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Perm = function(n) { return this.$val.Perm(n); };
Rand.ptr.prototype.Read = function(p) {
var _r, _r$1, _tuple, _tuple$1, _tuple$2, err, lk, n, ok, p, r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _r$1 = $f._r$1; _tuple = $f._tuple; _tuple$1 = $f._tuple$1; _tuple$2 = $f._tuple$2; err = $f.err; lk = $f.lk; n = $f.n; ok = $f.ok; p = $f.p; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
r = this;
_tuple = $assertType(r.src, ptrType, true);
lk = _tuple[0];
ok = _tuple[1];
/* */ if (ok) { $s = 1; continue; }
/* */ $s = 2; continue;
/* if (ok) { */ case 1:
_r = lk.read(p, (r.$ptr_readVal || (r.$ptr_readVal = new ptrType$2(function() { return this.$target.readVal; }, function($v) { this.$target.readVal = $v; }, r))), (r.$ptr_readPos || (r.$ptr_readPos = new ptrType$1(function() { return this.$target.readPos; }, function($v) { this.$target.readPos = $v; }, r)))); /* */ $s = 3; case 3: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple$1 = _r;
n = _tuple$1[0];
err = _tuple$1[1];
$s = -1; return [n, err];
/* } */ case 2:
_r$1 = read(p, $methodVal(r, "Int63"), (r.$ptr_readVal || (r.$ptr_readVal = new ptrType$2(function() { return this.$target.readVal; }, function($v) { this.$target.readVal = $v; }, r))), (r.$ptr_readPos || (r.$ptr_readPos = new ptrType$1(function() { return this.$target.readPos; }, function($v) { this.$target.readPos = $v; }, r)))); /* */ $s = 4; case 4: if($c) { $c = false; _r$1 = _r$1.$blk(); } if (_r$1 && _r$1.$blk !== undefined) { break s; }
_tuple$2 = _r$1;
n = _tuple$2[0];
err = _tuple$2[1];
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: Rand.ptr.prototype.Read }; } $f._r = _r; $f._r$1 = _r$1; $f._tuple = _tuple; $f._tuple$1 = _tuple$1; $f._tuple$2 = _tuple$2; $f.err = err; $f.lk = lk; $f.n = n; $f.ok = ok; $f.p = p; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
};
Rand.prototype.Read = function(p) { return this.$val.Read(p); };
read = function(p, int63, readVal, readPos) {
var _r, err, int63, n, p, pos, readPos, readVal, val, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; err = $f.err; int63 = $f.int63; n = $f.n; p = $f.p; pos = $f.pos; readPos = $f.readPos; readVal = $f.readVal; val = $f.val; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
pos = readPos.$get();
val = readVal.$get();
n = 0;
/* while (true) { */ case 1:
/* if (!(n < p.$length)) { break; } */ if(!(n < p.$length)) { $s = 2; continue; }
/* */ if (pos === 0) { $s = 3; continue; }
/* */ $s = 4; continue;
/* if (pos === 0) { */ case 3:
_r = int63(); /* */ $s = 5; case 5: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
val = _r;
pos = 7;
/* } */ case 4:
((n < 0 || n >= p.$length) ? ($throwRuntimeError("index out of range"), undefined) : p.$array[p.$offset + n] = ((val.$low << 24 >>> 24)));
val = $shiftRightInt64(val, (8));
pos = pos - (1) << 24 >> 24;
n = n + (1) >> 0;
/* } */ $s = 1; continue; case 2:
readPos.$set(pos);
readVal.$set(val);
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: read }; } $f._r = _r; $f.err = err; $f.int63 = int63; $f.n = n; $f.p = p; $f.pos = pos; $f.readPos = readPos; $f.readVal = readVal; $f.val = val; $f.$s = $s; $f.$r = $r; return $f;
};
lockedSource.ptr.prototype.Int63 = function() {
var _r, n, r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; n = $f.n; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = new $Int64(0, 0);
r = this;
r.lk.Lock();
_r = r.src.Int63(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
n = _r;
r.lk.Unlock();
$s = -1; return n;
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.Int63 }; } $f._r = _r; $f.n = n; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
};
lockedSource.prototype.Int63 = function() { return this.$val.Int63(); };
lockedSource.ptr.prototype.Uint64 = function() {
var _r, n, r, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; n = $f.n; r = $f.r; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = new $Uint64(0, 0);
r = this;
r.lk.Lock();
_r = r.src.Uint64(); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
n = _r;
r.lk.Unlock();
$s = -1; return n;
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.Uint64 }; } $f._r = _r; $f.n = n; $f.r = r; $f.$s = $s; $f.$r = $r; return $f;
};
lockedSource.prototype.Uint64 = function() { return this.$val.Uint64(); };
lockedSource.ptr.prototype.Seed = function(seed) {
var r, seed, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; r = $f.r; seed = $f.seed; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
r.lk.Lock();
$r = r.src.Seed(seed); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
r.lk.Unlock();
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.Seed }; } $f.r = r; $f.seed = seed; $f.$s = $s; $f.$r = $r; return $f;
};
lockedSource.prototype.Seed = function(seed) { return this.$val.Seed(seed); };
lockedSource.ptr.prototype.seedPos = function(seed, readPos) {
var r, readPos, seed, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; r = $f.r; readPos = $f.readPos; seed = $f.seed; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
r = this;
r.lk.Lock();
$r = r.src.Seed(seed); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
readPos.$set(0);
r.lk.Unlock();
$s = -1; return;
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.seedPos }; } $f.r = r; $f.readPos = readPos; $f.seed = seed; $f.$s = $s; $f.$r = $r; return $f;
};
lockedSource.prototype.seedPos = function(seed, readPos) { return this.$val.seedPos(seed, readPos); };
lockedSource.ptr.prototype.read = function(p, readVal, readPos) {
var _r, _tuple, err, n, p, r, readPos, readVal, $s, $r;
/* */ $s = 0; var $f, $c = false; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; _r = $f._r; _tuple = $f._tuple; err = $f.err; n = $f.n; p = $f.p; r = $f.r; readPos = $f.readPos; readVal = $f.readVal; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
n = 0;
err = $ifaceNil;
r = this;
r.lk.Lock();
_r = read(p, $methodVal(r.src, "Int63"), readVal, readPos); /* */ $s = 1; case 1: if($c) { $c = false; _r = _r.$blk(); } if (_r && _r.$blk !== undefined) { break s; }
_tuple = _r;
n = _tuple[0];
err = _tuple[1];
r.lk.Unlock();
$s = -1; return [n, err];
/* */ } return; } if ($f === undefined) { $f = { $blk: lockedSource.ptr.prototype.read }; } $f._r = _r; $f._tuple = _tuple; $f.err = err; $f.n = n; $f.p = p; $f.r = r; $f.readPos = readPos; $f.readVal = readVal; $f.$s = $s; $f.$r = $r; return $f;
};
lockedSource.prototype.read = function(p, readVal, readPos) { return this.$val.read(p, readVal, readPos); };
seedrand = function(x) {
var _q, _r, hi, lo, x;
hi = (_q = x / 44488, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"));
lo = (_r = x % 44488, _r === _r ? _r : $throwRuntimeError("integer divide by zero"));
x = ($imul(48271, lo)) - ($imul(3399, hi)) >> 0;
if (x < 0) {
x = x + (2147483647) >> 0;
}
return x;
};
rngSource.ptr.prototype.Seed = function(seed) {
var i, rng, seed, u, x, x$1, x$2, x$3, x$4, x$5;
rng = this;
rng.tap = 0;
rng.feed = 334;
seed = $div64(seed, new $Int64(0, 2147483647), true);
if ((seed.$high < 0 || (seed.$high === 0 && seed.$low < 0))) {
seed = (x = new $Int64(0, 2147483647), new $Int64(seed.$high + x.$high, seed.$low + x.$low));
}
if ((seed.$high === 0 && seed.$low === 0)) {
seed = new $Int64(0, 89482311);
}
x$1 = (((seed.$low + ((seed.$high >> 31) * 4294967296)) >> 0));
i = -20;
while (true) {
if (!(i < 607)) { break; }
x$1 = seedrand(x$1);
if (i >= 0) {
u = new $Int64(0, 0);
u = $shiftLeft64((new $Int64(0, x$1)), 40);
x$1 = seedrand(x$1);
u = (x$2 = $shiftLeft64((new $Int64(0, x$1)), 20), new $Int64(u.$high ^ x$2.$high, (u.$low ^ x$2.$low) >>> 0));
x$1 = seedrand(x$1);
u = (x$3 = (new $Int64(0, x$1)), new $Int64(u.$high ^ x$3.$high, (u.$low ^ x$3.$low) >>> 0));
u = (x$4 = ((i < 0 || i >= rng_cooked.length) ? ($throwRuntimeError("index out of range"), undefined) : rng_cooked[i]), new $Int64(u.$high ^ x$4.$high, (u.$low ^ x$4.$low) >>> 0));
(x$5 = rng.vec, ((i < 0 || i >= x$5.length) ? ($throwRuntimeError("index out of range"), undefined) : x$5[i] = u));
}
i = i + (1) >> 0;
}
};
rngSource.prototype.Seed = function(seed) { return this.$val.Seed(seed); };
rngSource.ptr.prototype.Int63 = function() {
var rng, x, x$1;
rng = this;
return ((x = (x$1 = rng.Uint64(), new $Uint64(x$1.$high & 2147483647, (x$1.$low & 4294967295) >>> 0)), new $Int64(x.$high, x.$low)));
};
rngSource.prototype.Int63 = function() { return this.$val.Int63(); };
rngSource.ptr.prototype.Uint64 = function() {
var rng, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8;
rng = this;
rng.tap = rng.tap - (1) >> 0;
if (rng.tap < 0) {
rng.tap = rng.tap + (607) >> 0;
}
rng.feed = rng.feed - (1) >> 0;
if (rng.feed < 0) {
rng.feed = rng.feed + (607) >> 0;
}
x$6 = (x = (x$1 = rng.vec, x$2 = rng.feed, ((x$2 < 0 || x$2 >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[x$2])), x$3 = (x$4 = rng.vec, x$5 = rng.tap, ((x$5 < 0 || x$5 >= x$4.length) ? ($throwRuntimeError("index out of range"), undefined) : x$4[x$5])), new $Int64(x.$high + x$3.$high, x.$low + x$3.$low));
(x$7 = rng.vec, x$8 = rng.feed, ((x$8 < 0 || x$8 >= x$7.length) ? ($throwRuntimeError("index out of range"), undefined) : x$7[x$8] = x$6));
return (new $Uint64(x$6.$high, x$6.$low));
};
rngSource.prototype.Uint64 = function() { return this.$val.Uint64(); };
ptrType$3.methods = [{prop: "ExpFloat64", name: "ExpFloat64", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "NormFloat64", name: "NormFloat64", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Uint32", name: "Uint32", pkg: "", typ: $funcType([], [$Uint32], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}, {prop: "Int31", name: "Int31", pkg: "", typ: $funcType([], [$Int32], false)}, {prop: "Int", name: "Int", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "Int63n", name: "Int63n", pkg: "", typ: $funcType([$Int64], [$Int64], false)}, {prop: "Int31n", name: "Int31n", pkg: "", typ: $funcType([$Int32], [$Int32], false)}, {prop: "Intn", name: "Intn", pkg: "", typ: $funcType([$Int], [$Int], false)}, {prop: "Float64", name: "Float64", pkg: "", typ: $funcType([], [$Float64], false)}, {prop: "Float32", name: "Float32", pkg: "", typ: $funcType([], [$Float32], false)}, {prop: "Perm", name: "Perm", pkg: "", typ: $funcType([$Int], [sliceType], false)}, {prop: "Read", name: "Read", pkg: "", typ: $funcType([sliceType$1], [$Int, $error], false)}];
ptrType.methods = [{prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}, {prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "seedPos", name: "seedPos", pkg: "math/rand", typ: $funcType([$Int64, ptrType$1], [], false)}, {prop: "read", name: "read", pkg: "math/rand", typ: $funcType([sliceType$1, ptrType$2, ptrType$1], [$Int, $error], false)}];
ptrType$5.methods = [{prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}];
Source.init([{prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}]);
Source64.init([{prop: "Int63", name: "Int63", pkg: "", typ: $funcType([], [$Int64], false)}, {prop: "Seed", name: "Seed", pkg: "", typ: $funcType([$Int64], [], false)}, {prop: "Uint64", name: "Uint64", pkg: "", typ: $funcType([], [$Uint64], false)}]);
Rand.init("math/rand", [{prop: "src", name: "src", anonymous: false, exported: false, typ: Source, tag: ""}, {prop: "s64", name: "s64", anonymous: false, exported: false, typ: Source64, tag: ""}, {prop: "readVal", name: "readVal", anonymous: false, exported: false, typ: $Int64, tag: ""}, {prop: "readPos", name: "readPos", anonymous: false, exported: false, typ: $Int8, tag: ""}]);
lockedSource.init("math/rand", [{prop: "lk", name: "lk", anonymous: false, exported: false, typ: nosync.Mutex, tag: ""}, {prop: "src", name: "src", anonymous: false, exported: false, typ: Source64, tag: ""}]);
rngSource.init("math/rand", [{prop: "tap", name: "tap", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "feed", name: "feed", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "vec", name: "vec", anonymous: false, exported: false, typ: arrayType, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = nosync.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = math.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
ke = $toNativeArray($kindUint32, [3801129273, 0, 2615860924, 3279400049, 3571300752, 3733536696, 3836274812, 3906990442, 3958562475, 3997804264, 4028649213, 4053523342, 4074002619, 4091154507, 4105727352, 4118261130, 4129155133, 4138710916, 4147160435, 4154685009, 4161428406, 4167506077, 4173011791, 4178022498, 4182601930, 4186803325, 4190671498, 4194244443, 4197554582, 4200629752, 4203493986, 4206168142, 4208670408, 4211016720, 4213221098, 4215295924, 4217252177, 4219099625, 4220846988, 4222502074, 4224071896, 4225562770, 4226980400, 4228329951, 4229616109, 4230843138, 4232014925, 4233135020, 4234206673, 4235232866, 4236216336, 4237159604, 4238064994, 4238934652, 4239770563, 4240574564, 4241348362, 4242093539, 4242811568, 4243503822, 4244171579, 4244816032, 4245438297, 4246039419, 4246620374, 4247182079, 4247725394, 4248251127, 4248760037, 4249252839, 4249730206, 4250192773, 4250641138, 4251075867, 4251497493, 4251906522, 4252303431, 4252688672, 4253062674, 4253425844, 4253778565, 4254121205, 4254454110, 4254777611, 4255092022, 4255397640, 4255694750, 4255983622, 4256264513, 4256537670, 4256803325, 4257061702, 4257313014, 4257557464, 4257795244, 4258026541, 4258251531, 4258470383, 4258683258, 4258890309, 4259091685, 4259287526, 4259477966, 4259663135, 4259843154, 4260018142, 4260188212, 4260353470, 4260514019, 4260669958, 4260821380, 4260968374, 4261111028, 4261249421, 4261383632, 4261513736, 4261639802, 4261761900, 4261880092, 4261994441, 4262105003, 4262211835, 4262314988, 4262414513, 4262510454, 4262602857, 4262691764, 4262777212, 4262859239, 4262937878, 4263013162, 4263085118, 4263153776, 4263219158, 4263281289, 4263340187, 4263395872, 4263448358, 4263497660, 4263543789, 4263586755, 4263626565, 4263663224, 4263696735, 4263727099, 4263754314, 4263778377, 4263799282, 4263817020, 4263831582, 4263842955, 4263851124, 4263856071, 4263857776, 4263856218, 4263851370, 4263843206, 4263831695, 4263816804, 4263798497, 4263776735, 4263751476, 4263722676, 4263690284, 4263654251, 4263614520, 4263571032, 4263523724, 4263472530, 4263417377, 4263358192, 4263294892, 4263227394, 4263155608, 4263079437, 4262998781, 4262913534, 4262823581, 4262728804, 4262629075, 4262524261, 4262414220, 4262298801, 4262177846, 4262051187, 4261918645, 4261780032, 4261635148, 4261483780, 4261325704, 4261160681, 4260988457, 4260808763, 4260621313, 4260425802, 4260221905, 4260009277, 4259787550, 4259556329, 4259315195, 4259063697, 4258801357, 4258527656, 4258242044, 4257943926, 4257632664, 4257307571, 4256967906, 4256612870, 4256241598, 4255853155, 4255446525, 4255020608, 4254574202, 4254106002, 4253614578, 4253098370, 4252555662, 4251984571, 4251383021, 4250748722, 4250079132, 4249371435, 4248622490, 4247828790, 4246986404, 4246090910, 4245137315, 4244119963, 4243032411, 4241867296, 4240616155, 4239269214, 4237815118, 4236240596, 4234530035, 4232664930, 4230623176, 4228378137, 4225897409, 4223141146, 4220059768, 4216590757, 4212654085, 4208145538, 4202926710, 4196809522, 4189531420, 4180713890, 4169789475, 4155865042, 4137444620, 4111806704, 4073393724, 4008685917, 3873074895]);
we = $toNativeArray($kindFloat32, [2.0249555365836613e-09, 1.4866739783681027e-11, 2.4409616689036184e-11, 3.1968806074589295e-11, 3.844677007314168e-11, 4.42282044321729e-11, 4.951644302919611e-11, 5.443358958023836e-11, 5.905943789574764e-11, 6.34494193296753e-11, 6.764381416113352e-11, 7.167294535648239e-11, 7.556032188826833e-11, 7.932458162551725e-11, 8.298078890689453e-11, 8.654132271912474e-11, 9.001651507523079e-11, 9.341507428706208e-11, 9.674443190998971e-11, 1.0001099254308699e-10, 1.0322031424037093e-10, 1.0637725422757427e-10, 1.0948611461891744e-10, 1.1255067711157807e-10, 1.1557434870246297e-10, 1.1856014781042035e-10, 1.2151082917633005e-10, 1.2442885610752796e-10, 1.2731647680563896e-10, 1.3017574518325858e-10, 1.330085347417409e-10, 1.3581656632677408e-10, 1.386014220061682e-10, 1.413645728254309e-10, 1.4410737880776736e-10, 1.4683107507629245e-10, 1.4953686899854546e-10, 1.522258291641876e-10, 1.5489899640730442e-10, 1.575573282952547e-10, 1.6020171300645814e-10, 1.628330109637588e-10, 1.6545202707884954e-10, 1.68059510752272e-10, 1.7065616975120435e-10, 1.73242697965037e-10, 1.758197337720091e-10, 1.783878739169964e-10, 1.8094774290045024e-10, 1.834998542005195e-10, 1.8604476292871652e-10, 1.8858298256319017e-10, 1.9111498494872592e-10, 1.9364125580789704e-10, 1.9616222535212557e-10, 1.9867835154840918e-10, 2.011900368525943e-10, 2.0369768372052732e-10, 2.062016807302669e-10, 2.0870240258208383e-10, 2.1120022397624894e-10, 2.136955057352452e-10, 2.1618855317040442e-10, 2.1867974098199738e-10, 2.2116936060356807e-10, 2.2365774510202385e-10, 2.2614519978869652e-10, 2.2863201609713002e-10, 2.3111849933865614e-10, 2.3360494094681883e-10, 2.3609159072179864e-10, 2.3857874009713953e-10, 2.4106666662859766e-10, 2.4355562011635357e-10, 2.460458781161634e-10, 2.485376904282077e-10, 2.5103127909709144e-10, 2.5352694943414633e-10, 2.560248957284017e-10, 2.585253955356137e-10, 2.610286709003873e-10, 2.6353494386732734e-10, 2.6604446423661443e-10, 2.6855745405285347e-10, 2.71074163116225e-10, 2.7359478571575835e-10, 2.7611959940720965e-10, 2.786487707240326e-10, 2.8118254946640775e-10, 2.8372118543451563e-10, 2.8626484516180994e-10, 2.8881380620404684e-10, 2.9136826285025563e-10, 2.9392840938946563e-10, 2.96494523377433e-10, 2.990667713476114e-10, 3.016454031001814e-10, 3.042306406797479e-10, 3.068226783753403e-10, 3.09421765987139e-10, 3.12028125559749e-10, 3.1464195138219964e-10, 3.17263521010247e-10, 3.1989300097734485e-10, 3.225306410836737e-10, 3.2517669112941405e-10, 3.2783134540359526e-10, 3.3049485370639786e-10, 3.3316743808242677e-10, 3.3584937608743815e-10, 3.385408342548857e-10, 3.4124211789610115e-10, 3.4395342130011386e-10, 3.4667499426710435e-10, 3.494071143528288e-10, 3.521500313574677e-10, 3.54903967325626e-10, 3.576691720574843e-10, 3.6044595086437425e-10, 3.632345535464765e-10, 3.660352021483959e-10, 3.688482297370399e-10, 3.716738583570134e-10, 3.7451239331964814e-10, 3.773641121807003e-10, 3.802292924959261e-10, 3.831082673322328e-10, 3.8600128648980103e-10, 3.8890865527996255e-10, 3.9183070676962473e-10, 3.9476774627011935e-10, 3.977200790927782e-10, 4.006880383045086e-10, 4.0367195697221803e-10, 4.066721681628138e-10, 4.0968900494320337e-10, 4.127228558914453e-10, 4.15774054074447e-10, 4.188429603146915e-10, 4.2192993543466173e-10, 4.25035395767992e-10, 4.2815970213716525e-10, 4.313032986313914e-10, 4.3446651831757777e-10, 4.376498607960855e-10, 4.408536868893975e-10, 4.4407846844229937e-10, 4.4732464954400086e-10, 4.5059267428371186e-10, 4.538830145062178e-10, 4.5719619756745544e-10, 4.605326675566346e-10, 4.638929240741163e-10, 4.672775499869886e-10, 4.706869893844612e-10, 4.74121908400349e-10, 4.775827511238617e-10, 4.810701836888143e-10, 4.845848167178701e-10, 4.881271498113904e-10, 4.916979601254923e-10, 4.952977472605369e-10, 4.989272883726414e-10, 5.025872495956207e-10, 5.062783525744408e-10, 5.100013189540675e-10, 5.13756870379467e-10, 5.175458395179078e-10, 5.21369003525507e-10, 5.252272505806843e-10, 5.29121357839557e-10, 5.330522134805449e-10, 5.3702081670437e-10, 5.41028055689452e-10, 5.450749851476644e-10, 5.491624932574268e-10, 5.532918012640664e-10, 5.574638528571541e-10, 5.616799247931681e-10, 5.659410717839819e-10, 5.702485705860738e-10, 5.746036979559221e-10, 5.790077306500052e-10, 5.83462111958255e-10, 5.879682296594524e-10, 5.925275825546805e-10, 5.971417249561739e-10, 6.01812211176167e-10, 6.065408175714992e-10, 6.113292094767075e-10, 6.16179329782085e-10, 6.21092954844471e-10, 6.260721940876124e-10, 6.311191569352559e-10, 6.362359528111483e-10, 6.414249686947926e-10, 6.466885360545405e-10, 6.520292639144998e-10, 6.574497612987784e-10, 6.629528592760892e-10, 6.685415554485985e-10, 6.742187919073217e-10, 6.799880103436351e-10, 6.858525969377638e-10, 6.918161599145378e-10, 6.978825850545434e-10, 7.040559801829716e-10, 7.103406751696184e-10, 7.167412219288849e-10, 7.232625609532306e-10, 7.2990985477972e-10, 7.366885990123251e-10, 7.436047333442275e-10, 7.506645305355164e-10, 7.57874762946642e-10, 7.652426470272644e-10, 7.727759543385559e-10, 7.804830115532013e-10, 7.883728114777e-10, 7.964550685635174e-10, 8.047402189070851e-10, 8.132396422944055e-10, 8.219657177122031e-10, 8.309318788590758e-10, 8.401527806789488e-10, 8.496445214056791e-10, 8.594246980742071e-10, 8.695127395874636e-10, 8.799300732498239e-10, 8.90700457834015e-10, 9.01850316648023e-10, 9.134091816243028e-10, 9.254100818978372e-10, 9.37890431984556e-10, 9.508922538259412e-10, 9.64463842123564e-10, 9.78660263939446e-10, 9.935448019859905e-10, 1.0091912860943353e-09, 1.0256859805934937e-09, 1.0431305819125214e-09, 1.0616465484503124e-09, 1.0813799855569073e-09, 1.1025096391392708e-09, 1.1252564435793033e-09, 1.149898620766976e-09, 1.176793218427008e-09, 1.2064089727203964e-09, 1.2393785997488749e-09, 1.2765849488616254e-09, 1.319313880365769e-09, 1.36954347862428e-09, 1.4305497897382224e-09, 1.5083649884672923e-09, 1.6160853766322703e-09, 1.7921247819074893e-09]);
fe = $toNativeArray($kindFloat32, [1, 0.9381436705589294, 0.900469958782196, 0.8717043399810791, 0.847785472869873, 0.8269932866096497, 0.8084216713905334, 0.7915276288986206, 0.7759568691253662, 0.7614634037017822, 0.7478685975074768, 0.7350381016731262, 0.7228676676750183, 0.7112747430801392, 0.7001926302909851, 0.6895664930343628, 0.6793505549430847, 0.669506311416626, 0.6600008606910706, 0.6508058309555054, 0.6418967247009277, 0.633251965045929, 0.62485271692276, 0.6166821718215942, 0.608725368976593, 0.6009689569473267, 0.5934008955955505, 0.5860103368759155, 0.5787873864173889, 0.5717230439186096, 0.5648092031478882, 0.5580382943153381, 0.5514034032821655, 0.5448982119560242, 0.5385168790817261, 0.5322538614273071, 0.526104211807251, 0.5200631618499756, 0.5141264200210571, 0.5082897543907166, 0.5025495290756226, 0.4969019889831543, 0.4913438558578491, 0.4858720004558563, 0.48048335313796997, 0.4751752018928528, 0.4699448347091675, 0.4647897481918335, 0.4597076177597046, 0.4546961486339569, 0.4497532546520233, 0.44487687945365906, 0.4400651156902313, 0.4353161156177521, 0.4306281507015228, 0.42599955201148987, 0.42142874002456665, 0.4169141948223114, 0.4124544560909271, 0.40804818272590637, 0.4036940038204193, 0.39939069747924805, 0.3951369822025299, 0.39093172550201416, 0.38677382469177246, 0.38266217708587646, 0.378595769405365, 0.37457355856895447, 0.37059465050697327, 0.366658091545105, 0.362762987613678, 0.358908474445343, 0.35509374737739563, 0.35131800174713135, 0.3475804924964905, 0.34388044476509094, 0.34021714329719543, 0.33658990263938904, 0.3329980671405792, 0.3294409513473511, 0.32591795921325684, 0.32242849469184875, 0.3189719021320343, 0.3155476748943329, 0.31215524673461914, 0.3087940812110901, 0.30546361207962036, 0.30216339230537415, 0.29889291524887085, 0.29565170407295227, 0.2924392819404602, 0.2892552316188812, 0.28609907627105713, 0.2829704284667969, 0.27986884117126465, 0.2767939269542694, 0.2737452983856201, 0.2707225978374481, 0.26772540807724, 0.26475343108177185, 0.2618062496185303, 0.258883535861969, 0.2559850215911865, 0.25311028957366943, 0.25025907158851624, 0.24743106961250305, 0.2446259707212448, 0.24184346199035645, 0.23908329010009766, 0.23634515702724457, 0.2336287796497345, 0.23093391954898834, 0.22826029360294342, 0.22560766339302063, 0.22297576069831848, 0.22036437690258026, 0.21777324378490448, 0.21520215272903442, 0.212650865316391, 0.21011915802955627, 0.20760682225227356, 0.20511364936828613, 0.20263944566249847, 0.20018397271633148, 0.19774706661701202, 0.1953285187482834, 0.19292815029621124, 0.19054576754570007, 0.18818120658397675, 0.18583425879478455, 0.18350479006767273, 0.18119260668754578, 0.17889754474163055, 0.17661945521831512, 0.17435817420482635, 0.1721135377883911, 0.16988539695739746, 0.16767361760139465, 0.16547803580760956, 0.16329853236675262, 0.16113494336605072, 0.1589871346950531, 0.15685498714447021, 0.15473836660385132, 0.15263713896274567, 0.1505511850118637, 0.1484803706407547, 0.14642459154129028, 0.1443837285041809, 0.14235764741897583, 0.1403462439775467, 0.13834942877292633, 0.136367067694664, 0.13439907133579254, 0.1324453204870224, 0.1305057406425476, 0.12858019769191742, 0.12666863203048706, 0.12477091699838638, 0.12288697808980942, 0.1210167184472084, 0.11916005611419678, 0.11731690168380737, 0.11548716574907303, 0.11367076635360718, 0.11186762899160385, 0.11007767915725708, 0.1083008274435997, 0.10653700679540634, 0.10478614270687103, 0.1030481606721878, 0.10132300108671188, 0.0996105819940567, 0.09791085124015808, 0.09622374176979065, 0.09454918652772903, 0.09288713335990906, 0.09123751521110535, 0.08960027992725372, 0.08797537535429001, 0.08636274188756943, 0.0847623273730278, 0.08317409455776215, 0.08159798383712769, 0.08003395050764084, 0.07848194986581802, 0.07694194465875626, 0.07541389018297195, 0.07389774918556213, 0.07239348441362381, 0.070901058614254, 0.06942043453454971, 0.06795158982276917, 0.06649449467658997, 0.06504911929368973, 0.06361543387174606, 0.06219341605901718, 0.06078304722905159, 0.0593843050301075, 0.05799717456102371, 0.05662164092063904, 0.05525768920779228, 0.05390531197190285, 0.05256449431180954, 0.05123523622751236, 0.04991753399372101, 0.04861138388514519, 0.047316793352365494, 0.04603376239538193, 0.044762298464775085, 0.04350241273641586, 0.04225412383675575, 0.04101744294166565, 0.039792392402887344, 0.03857899457216263, 0.03737728297710419, 0.03618728369474411, 0.03500903770327568, 0.03384258225560188, 0.0326879620552063, 0.031545232981443405, 0.030414443463087082, 0.0292956605553627, 0.028188949450850487, 0.027094384655356407, 0.02601204626262188, 0.024942025542259216, 0.023884421214461327, 0.022839335724711418, 0.021806888282299042, 0.020787203684449196, 0.019780423492193222, 0.018786700442433357, 0.017806200310587883, 0.016839107498526573, 0.015885621309280396, 0.014945968054234982, 0.01402039173990488, 0.013109165243804455, 0.012212592177093029, 0.011331013403832912, 0.010464809834957123, 0.009614413604140282, 0.008780314587056637, 0.007963077165186405, 0.007163353264331818, 0.0063819061033427715, 0.005619642324745655, 0.004877655766904354, 0.004157294984906912, 0.003460264764726162, 0.0027887988835573196, 0.0021459676790982485, 0.001536299823783338, 0.0009672692976891994, 0.0004541343660093844]);
kn = $toNativeArray($kindUint32, [1991057938, 0, 1611602771, 1826899878, 1918584482, 1969227037, 2001281515, 2023368125, 2039498179, 2051788381, 2061460127, 2069267110, 2075699398, 2081089314, 2085670119, 2089610331, 2093034710, 2096037586, 2098691595, 2101053571, 2103168620, 2105072996, 2106796166, 2108362327, 2109791536, 2111100552, 2112303493, 2113412330, 2114437283, 2115387130, 2116269447, 2117090813, 2117856962, 2118572919, 2119243101, 2119871411, 2120461303, 2121015852, 2121537798, 2122029592, 2122493434, 2122931299, 2123344971, 2123736059, 2124106020, 2124456175, 2124787725, 2125101763, 2125399283, 2125681194, 2125948325, 2126201433, 2126441213, 2126668298, 2126883268, 2127086657, 2127278949, 2127460589, 2127631985, 2127793506, 2127945490, 2128088244, 2128222044, 2128347141, 2128463758, 2128572095, 2128672327, 2128764606, 2128849065, 2128925811, 2128994934, 2129056501, 2129110560, 2129157136, 2129196237, 2129227847, 2129251929, 2129268426, 2129277255, 2129278312, 2129271467, 2129256561, 2129233410, 2129201800, 2129161480, 2129112170, 2129053545, 2128985244, 2128906855, 2128817916, 2128717911, 2128606255, 2128482298, 2128345305, 2128194452, 2128028813, 2127847342, 2127648860, 2127432031, 2127195339, 2126937058, 2126655214, 2126347546, 2126011445, 2125643893, 2125241376, 2124799783, 2124314271, 2123779094, 2123187386, 2122530867, 2121799464, 2120980787, 2120059418, 2119015917, 2117825402, 2116455471, 2114863093, 2112989789, 2110753906, 2108037662, 2104664315, 2100355223, 2094642347, 2086670106, 2074676188, 2054300022, 2010539237]);
wn = $toNativeArray($kindFloat32, [1.7290404663583558e-09, 1.2680928529462676e-10, 1.689751810696194e-10, 1.9862687883343e-10, 2.223243117382978e-10, 2.4244936613904144e-10, 2.601613091623989e-10, 2.761198769629658e-10, 2.9073962681813725e-10, 3.042996965518796e-10, 3.169979556627567e-10, 3.289802041894774e-10, 3.4035738116777736e-10, 3.5121602848242617e-10, 3.61625090983253e-10, 3.7164057942185025e-10, 3.813085680537398e-10, 3.906675816178762e-10, 3.997501218933053e-10, 4.0858399996679395e-10, 4.1719308563337165e-10, 4.255982233303257e-10, 4.3381759295968436e-10, 4.4186720948857783e-10, 4.497613115272969e-10, 4.57512583373898e-10, 4.6513240481438345e-10, 4.726310454117311e-10, 4.800177477726209e-10, 4.873009773476156e-10, 4.944885056978876e-10, 5.015873272284921e-10, 5.086040477664255e-10, 5.155446070048697e-10, 5.224146670812502e-10, 5.292193350214802e-10, 5.359634958068682e-10, 5.426517013518151e-10, 5.492881705038144e-10, 5.558769555769061e-10, 5.624218868405251e-10, 5.689264614971989e-10, 5.75394121238304e-10, 5.818281967329142e-10, 5.882316855831959e-10, 5.946076964136182e-10, 6.009590047817426e-10, 6.072883862451306e-10, 6.135985053390414e-10, 6.19892026598734e-10, 6.261713370037114e-10, 6.324390455780815e-10, 6.386973727678935e-10, 6.449488165749528e-10, 6.511955974453087e-10, 6.574400468473129e-10, 6.636843297158634e-10, 6.699307220081607e-10, 6.761814441702541e-10, 6.824387166481927e-10, 6.887046488657234e-10, 6.949815167800466e-10, 7.012714853260604e-10, 7.075767749498141e-10, 7.13899661608508e-10, 7.202424212593428e-10, 7.266072743483676e-10, 7.329966078550854e-10, 7.394128087589991e-10, 7.458582640396116e-10, 7.523354716987285e-10, 7.588469852493063e-10, 7.653954137154528e-10, 7.719834771435785e-10, 7.786139510912449e-10, 7.852897221383159e-10, 7.920137878869582e-10, 7.987892014504894e-10, 8.056192379868321e-10, 8.125072836762115e-10, 8.194568912323064e-10, 8.264716688799467e-10, 8.3355555791087e-10, 8.407127216614185e-10, 8.479473234679347e-10, 8.552640262671218e-10, 8.626675485068347e-10, 8.701631637464402e-10, 8.777562010564566e-10, 8.854524335966119e-10, 8.932581896381464e-10, 9.011799639857543e-10, 9.092249730890956e-10, 9.174008219758889e-10, 9.25715837318819e-10, 9.341788453909317e-10, 9.42799727177146e-10, 9.515889187738935e-10, 9.605578554783278e-10, 9.697193048552322e-10, 9.790869226478094e-10, 9.886760299337993e-10, 9.985036131254788e-10, 1.008588212947359e-09, 1.0189509236369076e-09, 1.0296150598776421e-09, 1.040606933955246e-09, 1.0519566329136865e-09, 1.0636980185552147e-09, 1.0758701707302976e-09, 1.0885182755160372e-09, 1.101694735439196e-09, 1.115461056855338e-09, 1.1298901814171813e-09, 1.1450695946990663e-09, 1.1611052119775422e-09, 1.178127595480305e-09, 1.1962995039027646e-09, 1.2158286599728285e-09, 1.2369856250415978e-09, 1.2601323318151003e-09, 1.2857697129220469e-09, 1.3146201904845611e-09, 1.3477839955200466e-09, 1.3870635751089821e-09, 1.43574030442295e-09, 1.5008658760251592e-09, 1.6030947680434338e-09]);
fn = $toNativeArray($kindFloat32, [1, 0.963599681854248, 0.9362826943397522, 0.9130436182022095, 0.8922816514968872, 0.8732430338859558, 0.8555005788803101, 0.8387836217880249, 0.8229072093963623, 0.8077383041381836, 0.7931770086288452, 0.7791460752487183, 0.7655841708183289, 0.7524415850639343, 0.7396772503852844, 0.7272568941116333, 0.7151514887809753, 0.7033361196517944, 0.6917891502380371, 0.6804918646812439, 0.6694276928901672, 0.6585819721221924, 0.6479418277740479, 0.6374954581260681, 0.6272324919700623, 0.6171433925628662, 0.6072195172309875, 0.5974531769752502, 0.5878370404243469, 0.5783646702766418, 0.5690299868583679, 0.5598273873329163, 0.550751805305481, 0.5417983531951904, 0.5329626798629761, 0.5242405533790588, 0.5156282186508179, 0.5071220397949219, 0.49871864914894104, 0.4904148280620575, 0.48220765590667725, 0.47409430146217346, 0.466072142124176, 0.45813870429992676, 0.45029163360595703, 0.44252872467041016, 0.4348478317260742, 0.42724698781967163, 0.41972434520721436, 0.41227802634239197, 0.40490642189979553, 0.39760786294937134, 0.3903807997703552, 0.3832238018512726, 0.3761354684829712, 0.3691144585609436, 0.36215949058532715, 0.3552693724632263, 0.3484429717063904, 0.3416791558265686, 0.33497685194015503, 0.32833510637283325, 0.3217529058456421, 0.3152293860912323, 0.30876362323760986, 0.3023548424243927, 0.2960021495819092, 0.2897048592567444, 0.28346219658851624, 0.2772735059261322, 0.271138072013855, 0.2650552988052368, 0.25902456045150757, 0.25304529070854187, 0.24711695313453674, 0.24123899638652802, 0.23541094362735748, 0.22963231801986694, 0.22390270233154297, 0.21822164952754974, 0.21258877217769623, 0.20700371265411377, 0.20146611332893372, 0.1959756463766098, 0.19053204357624054, 0.18513499200344086, 0.17978426814079285, 0.1744796335697174, 0.16922089457511902, 0.16400785744190216, 0.1588403731584549, 0.15371830761432648, 0.14864157140254974, 0.14361007511615753, 0.13862377405166626, 0.13368265330791473, 0.12878671288490295, 0.12393598258495331, 0.11913054436445236, 0.11437050998210907, 0.10965602099895477, 0.1049872562289238, 0.10036443918943405, 0.09578784555196762, 0.09125780314207077, 0.08677466958761215, 0.08233889937400818, 0.07795098423957825, 0.07361150532960892, 0.06932111829519272, 0.06508058309555054, 0.06089077144861221, 0.05675266310572624, 0.05266740173101425, 0.048636294901371, 0.044660862535238266, 0.040742866694927216, 0.03688438981771469, 0.03308788686990738, 0.029356317594647408, 0.025693291798233986, 0.02210330404341221, 0.018592102453112602, 0.015167297795414925, 0.011839478276669979, 0.0086244847625494, 0.005548994988203049, 0.0026696291752159595]);
rng_cooked = $toNativeArray($kindInt64, [new $Int64(-973649357, 3952672746), new $Int64(-1065661887, 3130416987), new $Int64(324977939, 3414273807), new $Int64(1241840476, 2806224363), new $Int64(-1477934308, 1997590414), new $Int64(2103305448, 2402795971), new $Int64(1663160183, 1140819369), new $Int64(1120601685, 1788868961), new $Int64(1848035537, 1089001426), new $Int64(1235702047, 873593504), new $Int64(1911387977, 581324885), new $Int64(-1654874170, 1609182556), new $Int64(1069394745, 1241596776), new $Int64(1895445337, 1771189259), new $Int64(-1374618802, 3467012610), new $Int64(-140526423, 2344407434), new $Int64(-1745367887, 782467244), new $Int64(26335124, 3404933915), new $Int64(1063924276, 618867887), new $Int64(-968700782, 520164395), new $Int64(-1591572833, 1341358184), new $Int64(-1515085039, 665794848), new $Int64(1527227641, 3183648150), new $Int64(1781176124, 696329606), new $Int64(1789146075, 4151988961), new $Int64(-2087444114, 998951326), new $Int64(-612324923, 1364957564), new $Int64(63173359, 4090230633), new $Int64(-1498029007, 4009697548), new $Int64(248009524, 2569622517), new $Int64(778703922, 3742421481), new $Int64(-1109106023, 1506914633), new $Int64(1738099768, 1983412561), new $Int64(236311649, 1436266083), new $Int64(-1111517500, 3922894967), new $Int64(-1336974714, 1792680179), new $Int64(563141142, 1188796351), new $Int64(1349617468, 405968250), new $Int64(1044074554, 433754187), new $Int64(870549669, 4073162024), new $Int64(-1094251604, 433121399), new $Int64(2451824, 4162580594), new $Int64(-137262572, 4132415622), new $Int64(-1536231048, 3033822028), new $Int64(2016407895, 824682382), new $Int64(2366218, 3583765414), new $Int64(-624604839, 535386927), new $Int64(1637219058, 2286693689), new $Int64(1453075389, 2968466525), new $Int64(193683513, 1351410206), new $Int64(-283806096, 1412813499), new $Int64(492736522, 4126267639), new $Int64(512765208, 2105529399), new $Int64(2132966268, 2413882233), new $Int64(947457634, 32226200), new $Int64(1149341356, 2032329073), new $Int64(106485445, 1356518208), new $Int64(-2067810156, 3430061722), new $Int64(-1484435135, 3820169661), new $Int64(-1665985194, 2981816134), new $Int64(1017155588, 4184371017), new $Int64(206574701, 2119206761), new $Int64(-852109057, 2472200560), new $Int64(-560457548, 2853524696), new $Int64(1307803389, 1681119904), new $Int64(-174986835, 95608918), new $Int64(392686347, 3690479145), new $Int64(-1205570926, 1397922290), new $Int64(-1159314025, 1516129515), new $Int64(-320178155, 1547420459), new $Int64(1311333971, 1470949486), new $Int64(-1953469798, 1336785672), new $Int64(-45086614, 4131677129), new $Int64(-1392278100, 4246329084), new $Int64(-1142500187, 3788585631), new $Int64(-66478285, 3080389532), new $Int64(-646438364, 2215402037), new $Int64(391002300, 1171593935), new $Int64(1408774047, 1423855166), new $Int64(-519177718, 2276716302), new $Int64(-368453140, 2068027241), new $Int64(1369359303, 3427553297), new $Int64(189241615, 3289637845), new $Int64(1057480830, 3486407650), new $Int64(-1512910664, 3071877822), new $Int64(1159653919, 3363620705), new $Int64(-934256930, 4159821533), new $Int64(-76621938, 1894661), new $Int64(-674493898, 1156868282), new $Int64(348271067, 776219088), new $Int64(-501428838, 2425634259), new $Int64(1716021749, 680510161), new $Int64(-574263456, 1310101429), new $Int64(1095885995, 2964454134), new $Int64(-325695512, 3467098407), new $Int64(1990672920, 2109628894), new $Int64(-2139648704, 1232604732), new $Int64(-1838070714, 3261916179), new $Int64(1699175360, 434597899), new $Int64(235436061, 1624796439), new $Int64(-1626402839, 3589632480), new $Int64(1198416575, 864579159), new $Int64(-1938748161, 1380889830), new $Int64(619206309, 2654509477), new $Int64(1419738251, 1468209306), new $Int64(-1744284772, 100794388), new $Int64(-1191421458, 2991674471), new $Int64(-208666741, 2224662036), new $Int64(-173659161, 977097250), new $Int64(1351320195, 726419512), new $Int64(-183459897, 1747974366), new $Int64(-753095183, 1556430604), new $Int64(-1049492215, 1080776742), new $Int64(-385846958, 280794874), new $Int64(117767733, 919835643), new $Int64(-967009426, 3434019658), new $Int64(-1951414480, 2461941785), new $Int64(133215641, 3615001066), new $Int64(417204809, 3103414427), new $Int64(790056561, 3380809712), new $Int64(-1267681408, 2724693469), new $Int64(547796833, 598827710), new $Int64(-1846559452, 3452273442), new $Int64(-75778224, 649274915), new $Int64(-801301329, 2585724112), new $Int64(-1510934263, 3165579553), new $Int64(1185578221, 2635894283), new $Int64(-52910178, 2053289721), new $Int64(985976581, 3169337108), new $Int64(1170569632, 144717764), new $Int64(1079216270, 1383666384), new $Int64(-124804942, 681540375), new $Int64(1375448925, 537050586), new $Int64(-1964768344, 315246468), new $Int64(226402871, 849323088), new $Int64(-885062465, 45543944), new $Int64(-946445250, 2319052083), new $Int64(-40708194, 3613090841), new $Int64(560472520, 2992171180), new $Int64(-381863169, 2068244785), new $Int64(917538188, 4239862634), new $Int64(-1369555809, 3892253031), new $Int64(720683925, 958186149), new $Int64(-423297785, 1877702262), new $Int64(1357886971, 837674867), new $Int64(1837048883, 1507589294), new $Int64(1905518400, 873336795), new $Int64(-1879761037, 2764496274), new $Int64(-1806480530, 4196182374), new $Int64(-1066765755, 550964545), new $Int64(818747069, 420611474), new $Int64(-1924830376, 204265180), new $Int64(1549974541, 1787046383), new $Int64(1215581865, 3102292318), new $Int64(418321538, 1552199393), new $Int64(1243493047, 980542004), new $Int64(267284263, 3293718720), new $Int64(1179528763, 3771917473), new $Int64(599484404, 2195808264), new $Int64(252818753, 3894702887), new $Int64(-1367475956, 2099949527), new $Int64(1424094358, 338442522), new $Int64(490737398, 637158004), new $Int64(-1727621530, 281976339), new $Int64(574970164, 3619802330), new $Int64(-431930823, 3084554784), new $Int64(-1264611183, 4129772886), new $Int64(-2104399043, 1680378557), new $Int64(-1621962591, 3339087776), new $Int64(1680500332, 4220317857), new $Int64(-1935828963, 2959322499), new $Int64(1675600481, 1488354890), new $Int64(-834863562, 3958162143), new $Int64(-1226511573, 2773705983), new $Int64(1876039582, 225908689), new $Int64(-1183735113, 908216283), new $Int64(-605696219, 3574646075), new $Int64(-1827723091, 1936937569), new $Int64(1519770881, 75492235), new $Int64(816689472, 1935193178), new $Int64(2142521206, 2018250883), new $Int64(455141620, 3943126022), new $Int64(-601399488, 3066544345), new $Int64(1932392669, 2793082663), new $Int64(-1239009361, 3297036421), new $Int64(1640597065, 2206987825), new $Int64(-553246738, 807894872), new $Int64(-1781325307, 766252117), new $Int64(2060649606, 3833114345), new $Int64(845619743, 1255067973), new $Int64(1201145605, 741697208), new $Int64(-1476242608, 2810093753), new $Int64(1109032642, 4229340371), new $Int64(1462188720, 1361684224), new $Int64(-1159399429, 1906263026), new $Int64(475781207, 3904421704), new $Int64(-623537128, 1769075545), new $Int64(1062308525, 2621599764), new $Int64(1279509432, 3431891480), new $Int64(-1742751146, 1871896503), new $Int64(128756421, 1412808876), new $Int64(1605404688, 952876175), new $Int64(-230443691, 1824438899), new $Int64(1662295856, 1005035476), new $Int64(-156574141, 527508597), new $Int64(1288873303, 3066806859), new $Int64(565995893, 3244940914), new $Int64(-889746188, 209092916), new $Int64(-247669406, 1242699167), new $Int64(-713830396, 456723774), new $Int64(1776978905, 1001252870), new $Int64(1468772157, 2026725874), new $Int64(857254202, 2137562569), new $Int64(765939740, 3183366709), new $Int64(1533887628, 2612072960), new $Int64(56977098, 1727148468), new $Int64(-1197583895, 3803658212), new $Int64(1883670356, 479946959), new $Int64(685713571, 1562982345), new $Int64(-1946242443, 1766109365), new $Int64(700596547, 3257093788), new $Int64(-184714929, 2365720207), new $Int64(93384808, 3742754173), new $Int64(-458385235, 2878193673), new $Int64(1096135042, 2174002182), new $Int64(-834260953, 3573511231), new $Int64(-754572527, 1760299077), new $Int64(-1375627191, 2260779833), new $Int64(-866019274, 1452805722), new $Int64(-1229671918, 2940011802), new $Int64(1890251082, 1886183802), new $Int64(893897673, 2514369088), new $Int64(1644345561, 3924317791), new $Int64(-1974867432, 500935732), new $Int64(1403501753, 676580929), new $Int64(-1565912283, 1184984890), new $Int64(-691968413, 1271474274), new $Int64(-1828754738, 3163791473), new $Int64(2051027584, 2842487377), new $Int64(1511537551, 2170968612), new $Int64(573262976, 3535856740), new $Int64(-2053227187, 1488599718), new $Int64(-1180531831, 3408913763), new $Int64(-2086531912, 2501050084), new $Int64(-875130448, 1639124157), new $Int64(-2009482504, 4088176393), new $Int64(1574896563, 3989947576), new $Int64(-165243708, 3414355209), new $Int64(-792329287, 2275136352), new $Int64(-2057774345, 2151835223), new $Int64(-931144933, 1654534827), new $Int64(-679921451, 377892833), new $Int64(-482716010, 660204544), new $Int64(85706799, 390828249), new $Int64(-1422172693, 3402783878), new $Int64(-1468634160, 3717936603), new $Int64(1113532086, 2211058823), new $Int64(1564224320, 2692150867), new $Int64(1952770442, 1928910388), new $Int64(788716862, 3931011137), new $Int64(1083670504, 1112701047), new $Int64(-68150572, 2452299106), new $Int64(-896164822, 2337204777), new $Int64(1774877857, 273889282), new $Int64(1798719843, 1462008793), new $Int64(2138834788, 1554494002), new $Int64(-1194967131, 182675323), new $Int64(-1598554764, 1882802136), new $Int64(589279648, 3700220025), new $Int64(381039426, 3083431543), new $Int64(-851859191, 3622207527), new $Int64(338126939, 432729309), new $Int64(-1667470126, 2391914317), new $Int64(-1849558151, 235747924), new $Int64(2120733629, 3088823825), new $Int64(-745079795, 2314658321), new $Int64(1165929723, 2957634338), new $Int64(501323675, 4117056981), new $Int64(1564699815, 1482500298), new $Int64(-740826490, 840489337), new $Int64(799522364, 3483178565), new $Int64(532129761, 2074004656), new $Int64(724246478, 3643392642), new $Int64(-665153481, 1583624461), new $Int64(-885822954, 287473085), new $Int64(1667835381, 3136843981), new $Int64(1138806821, 1266970974), new $Int64(135185781, 1998688839), new $Int64(392094735, 1492900209), new $Int64(1031326774, 1538112737), new $Int64(-2070568842, 2207265429), new $Int64(-1886797613, 963263315), new $Int64(1671145500, 2295892134), new $Int64(1068469660, 2002560897), new $Int64(-356250305, 1369254035), new $Int64(33436120, 3353312708), new $Int64(57507843, 947771099), new $Int64(-1945755145, 1747061399), new $Int64(1507240140, 2047354631), new $Int64(720000810, 4165367136), new $Int64(479265078, 3388864963), new $Int64(-952181250, 286492130), new $Int64(2045622690, 2795735007), new $Int64(-715730566, 3703961339), new $Int64(-148436487, 1797825479), new $Int64(1429039600, 1116589674), new $Int64(-1665420098, 2593309206), new $Int64(1329049334, 3404995677), new $Int64(-750579440, 3453462936), new $Int64(1014767077, 3016498634), new $Int64(75698599, 1650371545), new $Int64(1592007860, 212344364), new $Int64(1127766888, 3843932156), new $Int64(-748019856, 3573129983), new $Int64(-890581831, 665897820), new $Int64(1071492673, 1675628772), new $Int64(243225682, 2831752928), new $Int64(2120298836, 1486294219), new $Int64(-1954407413, 268782709), new $Int64(-1002123503, 4186179080), new $Int64(624342951, 1613720397), new $Int64(857179861, 2703686015), new $Int64(-911618704, 2205342611), new $Int64(-672703993, 1411666394), new $Int64(-1528454899, 677744900), new $Int64(-1876628533, 4172867247), new $Int64(135494707, 2163418403), new $Int64(849547544, 2841526879), new $Int64(-1117516959, 1082141470), new $Int64(-1770111792, 4046134367), new $Int64(51415528, 2142943655), new $Int64(-249824333, 3124627521), new $Int64(998228909, 219992939), new $Int64(-1078790951, 1756846531), new $Int64(1283749206, 1225118210), new $Int64(-525858006, 1647770243), new $Int64(-2035959705, 444807907), new $Int64(2036369448, 3952076173), new $Int64(53201823, 1461839639), new $Int64(315761893, 3699250910), new $Int64(702974850, 1373688981), new $Int64(734022261, 147523747), new $Int64(-2047330906, 1211276581), new $Int64(1294440951, 2548832680), new $Int64(1144696256, 1995631888), new $Int64(-1992983070, 2011457303), new $Int64(-1351022674, 3057425772), new $Int64(667839456, 81484597), new $Int64(-1681980888, 3646681560), new $Int64(-1372462725, 635548515), new $Int64(602489502, 2508044581), new $Int64(-1794220117, 1014917157), new $Int64(719992433, 3214891315), new $Int64(-1294799037, 959582252), new $Int64(226415134, 3347040449), new $Int64(-362868096, 4102971975), new $Int64(397887437, 4078022210), new $Int64(-536803826, 2851767182), new $Int64(-1398321012, 1540160644), new $Int64(-1549098876, 1057290595), new $Int64(-112592988, 3907769253), new $Int64(579300318, 4248952684), new $Int64(-1054576049, 132554364), new $Int64(-1085862414, 1029351092), new $Int64(697840928, 2583007416), new $Int64(298619124, 1486185789), new $Int64(55905697, 2871589073), new $Int64(2017643612, 723203291), new $Int64(146250550, 2494333952), new $Int64(-1082993397, 2230939180), new $Int64(-1804568072, 3943232912), new $Int64(1768732449, 2181367922), new $Int64(-729261111, 2889274791), new $Int64(1824032949, 2046728161), new $Int64(1653899792, 1376052477), new $Int64(1022327048, 381236993), new $Int64(-1113097690, 3188942166), new $Int64(-74480109, 350070824), new $Int64(144881592, 61758415), new $Int64(-741824226, 3492950336), new $Int64(-2030042720, 3093818430), new $Int64(-453590535, 2962480613), new $Int64(-1912050708, 3154871160), new $Int64(-1636478569, 3228564679), new $Int64(610731502, 888276216), new $Int64(-946702974, 3574998604), new $Int64(-1277068380, 1967526716), new $Int64(-1556147941, 1554691298), new $Int64(-1573024234, 339944798), new $Int64(1223764147, 1154515356), new $Int64(1825645307, 967516237), new $Int64(1546195135, 596588202), new $Int64(-1867600880, 3764362170), new $Int64(-1655392592, 266611402), new $Int64(-393255880, 2047856075), new $Int64(-1000726433, 21444105), new $Int64(-949424754, 3065563181), new $Int64(-232418803, 1140663212), new $Int64(633187674, 2323741028), new $Int64(2126290159, 3103873707), new $Int64(1008658319, 2766828349), new $Int64(-485587503, 1970872996), new $Int64(1628585413, 3766615585), new $Int64(-595148528, 2036813414), new $Int64(-1994877121, 3105536507), new $Int64(13954645, 3396176938), new $Int64(-721402003, 1377154485), new $Int64(-61839181, 3807014186), new $Int64(543009040, 3710110597), new $Int64(-1751425519, 916420443), new $Int64(734556788, 2103831255), new $Int64(-1766161494, 717331943), new $Int64(-1574598896, 3550505941), new $Int64(45939673, 378749927), new $Int64(-1997615719, 611017331), new $Int64(592130075, 758907650), new $Int64(1012992349, 154266815), new $Int64(-1040454942, 1407468696), new $Int64(-1678191250, 970098704), new $Int64(-285057486, 1971660656), new $Int64(998365243, 3332747885), new $Int64(1947089649, 1935189867), new $Int64(1510248801, 203520055), new $Int64(-1305165746, 3916463034), new $Int64(-388598655, 3474113316), new $Int64(1036101639, 316544223), new $Int64(-1773744891, 1650844677), new $Int64(-907191419, 4267565603), new $Int64(-1070275024, 2501167616), new $Int64(-1520651863, 3929401789), new $Int64(-2091360852, 337170252), new $Int64(-960502090, 2061966842), new $Int64(-304190848, 2508461464), new $Int64(-1941471116, 2791377107), new $Int64(1240791848, 1227227588), new $Int64(1813978778, 1709681848), new $Int64(1153692192, 3768820575), new $Int64(-1002297449, 2887126398), new $Int64(-1447111334, 296561685), new $Int64(700300844, 3729960077), new $Int64(-1572311344, 372833036), new $Int64(2078875613, 2409779288), new $Int64(1829161290, 555274064), new $Int64(-1105595719, 4239804901), new $Int64(1839403216, 3723486978), new $Int64(-1649093095, 2145871984), new $Int64(-1582765715, 3565480803), new $Int64(-1568653827, 2197313814), new $Int64(974785092, 3613674566), new $Int64(438638731, 3042093666), new $Int64(-96556264, 3324034321), new $Int64(869420878, 3708873369), new $Int64(946682149, 1698090092), new $Int64(1618900382, 4213940712), new $Int64(-1843479747, 2087477361), new $Int64(-1766167800, 2407950639), new $Int64(-1296225558, 3942568569), new $Int64(-1223900450, 4088074412), new $Int64(723260036, 2964773675), new $Int64(-673921829, 1539178386), new $Int64(1062961552, 2694849566), new $Int64(460977733, 2120273838), new $Int64(-1604570740, 2484608657), new $Int64(880846449, 2956190677), new $Int64(1970902366, 4223313749), new $Int64(662161910, 3502682327), new $Int64(705634754, 4133891139), new $Int64(-1031359300, 1166449596), new $Int64(1038247601, 3362705993), new $Int64(93734798, 3892921029), new $Int64(1876124043, 786869787), new $Int64(1057490746, 1046342263), new $Int64(242763728, 493777327), new $Int64(-853573201, 3304827646), new $Int64(616460742, 125356352), new $Int64(499300063, 74094113), new $Int64(-795586925, 2500816079), new $Int64(-490248444, 514015239), new $Int64(1377565129, 543520454), new $Int64(-2039776725, 3614531153), new $Int64(2056746300, 2356753985), new $Int64(1390062617, 2018141668), new $Int64(131272971, 2087974891), new $Int64(-1502927041, 3166972343), new $Int64(372256200, 1517638666), new $Int64(-935275664, 173466846), new $Int64(-695774461, 4241513471), new $Int64(-1413550842, 2783126920), new $Int64(1972004134, 4167264826), new $Int64(29260506, 3907395640), new $Int64(-910901561, 1539634186), new $Int64(-595957298, 178241987), new $Int64(-113277636, 182168164), new $Int64(-1102530459, 2386154934), new $Int64(1379126408, 4077374341), new $Int64(-2114679722, 1732699140), new $Int64(-421057745, 1041306002), new $Int64(1860414813, 2068001749), new $Int64(1005320202, 3208962910), new $Int64(844054010, 697710380), new $Int64(-1509359403, 2228431183), new $Int64(-810313977, 3554678728), new $Int64(-750989047, 173470263), new $Int64(-85886265, 3848297795), new $Int64(-926936977, 246236185), new $Int64(-1984190461, 2066374846), new $Int64(1771673660, 312890749), new $Int64(703378057, 3573310289), new $Int64(-598851901, 143166754), new $Int64(613554316, 2081511079), new $Int64(1197802104, 486038032), new $Int64(-1906483789, 2982218564), new $Int64(364901986, 1000939191), new $Int64(1902782651, 2750454885), new $Int64(-671844857, 3375313137), new $Int64(-1643868040, 881302957), new $Int64(-1508784745, 2514186393), new $Int64(-1703622845, 360024739), new $Int64(1399671872, 292500025), new $Int64(1381210821, 2276300752), new $Int64(521803381, 4069087683), new $Int64(-1938982667, 1637778212), new $Int64(720490469, 1676670893), new $Int64(1067262482, 3855174429), new $Int64(2114075974, 2067248671), new $Int64(-89426259, 2884561259), new $Int64(-805741095, 2456511185), new $Int64(983726246, 561175414), new $Int64(-1719489563, 432588903), new $Int64(885133709, 4059399550), new $Int64(-93096266, 1075014784), new $Int64(-1733832628, 2728058415), new $Int64(1839142064, 1299703678), new $Int64(1262333188, 2347583393), new $Int64(1285481956, 2468164145), new $Int64(-1158354011, 1140014346), new $Int64(2033889184, 1936972070), new $Int64(-1737578993, 3870530098), new $Int64(-484494257, 1717789158), new $Int64(-232997156, 1153452491), new $Int64(-990424416, 3948827651), new $Int64(-1357145630, 2101413152), new $Int64(1495744672, 3854091229), new $Int64(83644069, 4215565463), new $Int64(-1385277313, 1202710438), new $Int64(-564909037, 2072216740), new $Int64(705690639, 2066751068), new $Int64(-2113583312, 173902580), new $Int64(-741983806, 142459001), new $Int64(172391592, 1889151926), new $Int64(-498943125, 3034199774), new $Int64(1618587731, 516490102), new $Int64(93114264, 3692577783), new $Int64(-2078821353, 2953948865), new $Int64(-320938673, 4041040923), new $Int64(-1942517976, 592046130), new $Int64(-705643640, 384297211), new $Int64(-2051649464, 265863924), new $Int64(2101717619, 1333136237), new $Int64(1499611781, 1406273556), new $Int64(1074670496, 426305476), new $Int64(125704633, 2750898176), new $Int64(488068495, 1633944332), new $Int64(2037723464, 3236349343), new $Int64(-1703423246, 4013676611), new $Int64(1718532237, 2265047407), new $Int64(1433593806, 875071080), new $Int64(-343047503, 1418843655), new $Int64(2009228711, 451657300), new $Int64(1229446621, 1866374663), new $Int64(1653472867, 1551455622), new $Int64(577191481, 3560962459), new $Int64(1669204077, 3347903778), new $Int64(-298327194, 2675874918), new $Int64(-1831355577, 2762991672), new $Int64(530492383, 3689068477), new $Int64(844089962, 4071997905), new $Int64(1508155730, 1381702441), new $Int64(2089931018, 2373284878), new $Int64(-864267462, 2143983064), new $Int64(308739063, 1938207195), new $Int64(1754949306, 1188152253), new $Int64(1272345009, 615870490), new $Int64(742653194, 2662252621), new $Int64(1477718295, 3839976789), new $Int64(-2091334213, 306752547), new $Int64(-1426688067, 2162363077), new $Int64(-57052633, 2767224719), new $Int64(-1471624099, 2628837712), new $Int64(1678405918, 2967771969), new $Int64(1694285728, 499792248), new $Int64(-1744131281, 4285253508), new $Int64(962357072, 2856511070), new $Int64(679471692, 2526409716), new $Int64(-1793706473, 1240875658), new $Int64(-914893422, 2577342868), new $Int64(-1001298215, 4136853496), new $Int64(-1477114974, 2403540137), new $Int64(1372824515, 1371410668), new $Int64(-176562048, 371758825), new $Int64(-441063112, 1528834084), new $Int64(-71688630, 1504757260), new $Int64(-1461820072, 699052551), new $Int64(-505543539, 3347789870), new $Int64(1951619734, 3430604759), new $Int64(2119672219, 1935601723), new $Int64(966789690, 834676166)]);
globalRand = New(new lockedSource.ptr(new nosync.Mutex.ptr(false), $assertType(NewSource(new $Int64(0, 1)), Source64)));
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["github.com/suntong/game24"] = (function() {
var $pkg = {}, $init, fmt, io, rand, strconv, time, Expr, arrayType, arrayType$1, arrayType$2, ptrType, sliceType$1, calc, CalcInit, NewExpr, exprEval, Resolve, Solve;
fmt = $packages["fmt"];
io = $packages["io"];
rand = $packages["math/rand"];
strconv = $packages["strconv"];
time = $packages["time"];
Expr = $pkg.Expr = $newType(0, $kindStruct, "game24.Expr", true, "github.com/suntong/game24", true, function(op_, left_, right_, value_) {
this.$val = this;
if (arguments.length === 0) {
this.op = 0;
this.left = ptrType.nil;
this.right = ptrType.nil;
this.value = 0;
return;
}
this.op = op_;
this.left = left_;
this.right = right_;
this.value = value_;
});
arrayType = $arrayType($Int, 100);
arrayType$1 = $arrayType(arrayType, 100);
arrayType$2 = $arrayType(arrayType$1, 5);
ptrType = $ptrType(Expr);
sliceType$1 = $sliceType(ptrType);
CalcInit = function() {
var _q, _r, i, j, op, x, x$1, x$2, x$3, x$4, x$5, x$6, x$7, x$8, x$9;
op = 1;
while (true) {
if (!(op <= 4)) { break; }
i = 0;
while (true) {
if (!(i <= 99)) { break; }
j = 0;
while (true) {
if (!(j <= 99)) { break; }
if ((op === 1)) {
(x = (x$1 = ((op < 0 || op >= calc.length) ? ($throwRuntimeError("index out of range"), undefined) : calc[op]), ((i < 0 || i >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[i])), ((j < 0 || j >= x.length) ? ($throwRuntimeError("index out of range"), undefined) : x[j] = (i + j >> 0)));
} else if ((op === 2)) {
(x$2 = (x$3 = ((op < 0 || op >= calc.length) ? ($throwRuntimeError("index out of range"), undefined) : calc[op]), ((i < 0 || i >= x$3.length) ? ($throwRuntimeError("index out of range"), undefined) : x$3[i])), ((j < 0 || j >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[j] = (i - j >> 0)));
} else if ((op === 3)) {
(x$4 = (x$5 = ((op < 0 || op >= calc.length) ? ($throwRuntimeError("index out of range"), undefined) : calc[op]), ((i < 0 || i >= x$5.length) ? ($throwRuntimeError("index out of range"), undefined) : x$5[i])), ((j < 0 || j >= x$4.length) ? ($throwRuntimeError("index out of range"), undefined) : x$4[j] = ($imul(i, j))));
} else if ((op === 4)) {
if ((j === 0) || !(((_r = i % j, _r === _r ? _r : $throwRuntimeError("integer divide by zero")) === 0))) {
(x$6 = (x$7 = ((op < 0 || op >= calc.length) ? ($throwRuntimeError("index out of range"), undefined) : calc[op]), ((i < 0 || i >= x$7.length) ? ($throwRuntimeError("index out of range"), undefined) : x$7[i])), ((j < 0 || j >= x$6.length) ? ($throwRuntimeError("index out of range"), undefined) : x$6[j] = -1));
} else {
(x$8 = (x$9 = ((op < 0 || op >= calc.length) ? ($throwRuntimeError("index out of range"), undefined) : calc[op]), ((i < 0 || i >= x$9.length) ? ($throwRuntimeError("index out of range"), undefined) : x$9[i])), ((j < 0 || j >= x$8.length) ? ($throwRuntimeError("index out of range"), undefined) : x$8[j] = (_q = i / j, (_q === _q && _q !== 1/0 && _q !== -1/0) ? _q >> 0 : $throwRuntimeError("integer divide by zero"))));
}
}
j = j + (1) >> 0;
}
i = i + (1) >> 0;
}
op = op + (1) >> 0;
}
};
$pkg.CalcInit = CalcInit;
NewExpr = function(value) {
var value;
return new Expr.ptr(0, ptrType.nil, ptrType.nil, value);
};
$pkg.NewExpr = NewExpr;
Expr.ptr.prototype.Value = function() {
var x;
x = this;
return x.value;
};
Expr.prototype.Value = function() { return this.$val.Value(); };
Expr.ptr.prototype.String = function() {
var _tmp, _tmp$1, _tmp$10, _tmp$11, _tmp$12, _tmp$2, _tmp$3, _tmp$4, _tmp$5, _tmp$6, _tmp$7, _tmp$8, _tmp$9, bl1, bl2, br1, br2, opstr, x;
x = this;
if (x.op === 0) {
return strconv.Itoa(x.value);
}
_tmp = "";
_tmp$1 = "";
_tmp$2 = "";
_tmp$3 = "";
_tmp$4 = "";
bl1 = _tmp;
br1 = _tmp$1;
bl2 = _tmp$2;
br2 = _tmp$3;
opstr = _tmp$4;
if ((x.left.op === 0)) {
} else if (x.left.op >= x.op) {
} else if ((x.left.op === 1) && (x.op === 2)) {
_tmp$5 = "";
_tmp$6 = "";
bl1 = _tmp$5;
br1 = _tmp$6;
} else {
_tmp$7 = "(";
_tmp$8 = ")";
bl1 = _tmp$7;
br1 = _tmp$8;
}
if ((x.right.op === 0) || x.op < x.right.op) {
_tmp$9 = "";
_tmp$10 = "";
bl2 = _tmp$9;
br2 = _tmp$10;
} else {
_tmp$11 = "(";
_tmp$12 = ")";
bl2 = _tmp$11;
br2 = _tmp$12;
}
if ((x.op === 1)) {
opstr = " + ";
} else if ((x.op === 2)) {
opstr = " - ";
} else if ((x.op === 3)) {
opstr = " * ";
} else if ((x.op === 4)) {
opstr = " / ";
}
return bl1 + x.left.String() + br1 + opstr + bl2 + x.right.String() + br2;
};
Expr.prototype.String = function() { return this.$val.String(); };
exprEval = function(x) {
var _tmp, _tmp$1, l, r, ret, x, x$1, x$2, x$3;
ret = 0;
if (x.op === 0) {
ret = x.value;
return ret;
}
_tmp = exprEval(x.left);
_tmp$1 = exprEval(x.right);
l = _tmp;
r = _tmp$1;
if (l < 0 || r < 0 || l > 99 || r > 99) {
ret = -1;
return ret;
}
ret = (x$1 = (x$2 = (x$3 = x.op, ((x$3 < 0 || x$3 >= calc.length) ? ($throwRuntimeError("index out of range"), undefined) : calc[x$3])), ((l < 0 || l >= x$2.length) ? ($throwRuntimeError("index out of range"), undefined) : x$2[l])), ((r < 0 || r >= x$1.length) ? ($throwRuntimeError("index out of range"), undefined) : x$1[r]));
return ret;
};
Resolve = function(exIn) {
var _tuple, exIn, r;
_tuple = Solve(exIn);
r = _tuple[0];
return r;
};
$pkg.Resolve = Resolve;
Solve = function(exIn) {
var OK, OK$1, OK$2, _i, _ref, _tuple, _tuple$1, _tuple$2, ex, exIn, i, j, node, o, r, r$1, r$2;
if (exIn.$length === 1) {
if (exprEval((0 >= exIn.$length ? ($throwRuntimeError("index out of range"), undefined) : exIn.$array[exIn.$offset + 0])) === 24) {
return ["- !!\n: " + (0 >= exIn.$length ? ($throwRuntimeError("index out of range"), undefined) : exIn.$array[exIn.$offset + 0]).String() + "\n", true];
}
return ["- XX\n", false];
}
node = new Expr.ptr(0, ptrType.nil, ptrType.nil, 0);
ex = $makeSlice(sliceType$1, (exIn.$length - 1 >> 0));
_ref = ex;
_i = 0;
while (true) {
if (!(_i < _ref.$length)) { break; }
i = _i;
$copySlice($subslice(ex, i), $subslice(exIn, (i + 1 >> 0)));
((i < 0 || i >= ex.$length) ? ($throwRuntimeError("index out of range"), undefined) : ex.$array[ex.$offset + i] = node);
j = i + 1 >> 0;
while (true) {
if (!(j < exIn.$length)) { break; }
node.left = ((i < 0 || i >= exIn.$length) ? ($throwRuntimeError("index out of range"), undefined) : exIn.$array[exIn.$offset + i]);
node.right = ((j < 0 || j >= exIn.$length) ? ($throwRuntimeError("index out of range"), undefined) : exIn.$array[exIn.$offset + j]);
o = 1;
while (true) {
if (!(o <= 4)) { break; }
node.op = o;
_tuple = Solve(ex);
r = _tuple[0];
OK = _tuple[1];
if (OK) {
return [r, true];
}
o = o + (1) >> 0;
}
node.left = ((j < 0 || j >= exIn.$length) ? ($throwRuntimeError("index out of range"), undefined) : exIn.$array[exIn.$offset + j]);
node.right = ((i < 0 || i >= exIn.$length) ? ($throwRuntimeError("index out of range"), undefined) : exIn.$array[exIn.$offset + i]);
node.op = 2;
_tuple$1 = Solve(ex);
r$1 = _tuple$1[0];
OK$1 = _tuple$1[1];
if (OK$1) {
return [r$1, true];
}
node.op = 4;
_tuple$2 = Solve(ex);
r$2 = _tuple$2[0];
OK$2 = _tuple$2[1];
if (OK$2) {
return [r$2, true];
}
if (j < ex.$length) {
((j < 0 || j >= ex.$length) ? ($throwRuntimeError("index out of range"), undefined) : ex.$array[ex.$offset + j] = ((j < 0 || j >= exIn.$length) ? ($throwRuntimeError("index out of range"), undefined) : exIn.$array[exIn.$offset + j]));
}
j = j + (1) >> 0;
}
((i < 0 || i >= ex.$length) ? ($throwRuntimeError("index out of range"), undefined) : ex.$array[ex.$offset + i] = ((i < 0 || i >= exIn.$length) ? ($throwRuntimeError("index out of range"), undefined) : exIn.$array[exIn.$offset + i]));
_i++;
}
return ["- XX\n", false];
};
$pkg.Solve = Solve;
ptrType.methods = [{prop: "Value", name: "Value", pkg: "", typ: $funcType([], [$Int], false)}, {prop: "String", name: "String", pkg: "", typ: $funcType([], [$String], false)}];
Expr.init("github.com/suntong/game24", [{prop: "op", name: "op", anonymous: false, exported: false, typ: $Int, tag: ""}, {prop: "left", name: "left", anonymous: false, exported: false, typ: ptrType, tag: ""}, {prop: "right", name: "right", anonymous: false, exported: false, typ: ptrType, tag: ""}, {prop: "value", name: "value", anonymous: false, exported: false, typ: $Int, tag: ""}]);
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = fmt.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = io.$init(); /* */ $s = 2; case 2: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = rand.$init(); /* */ $s = 3; case 3: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = strconv.$init(); /* */ $s = 4; case 4: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
$r = time.$init(); /* */ $s = 5; case 5: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
calc = arrayType$2.zero();
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$packages["."] = (function() {
var $pkg = {}, $init, game24, ptrType, sliceType, rand_digitRange, main, Play;
game24 = $packages["github.com/suntong/game24"];
ptrType = $ptrType(game24.Expr);
sliceType = $sliceType(ptrType);
main = function() {
game24.CalcInit();
Play();
};
Play = function() {
var cards, i, k;
cards = $makeSlice(sliceType, 4);
k = 0;
while (true) {
if (!(k < 30)) { break; }
console.log();
i = 0;
while (true) {
if (!(i < 4)) { break; }
((i < 0 || i >= cards.$length) ? ($throwRuntimeError("index out of range"), undefined) : cards.$array[cards.$offset + i] = game24.NewExpr(rand_digitRange + 1 >> 0));
console.log(((i < 0 || i >= cards.$length) ? ($throwRuntimeError("index out of range"), undefined) : cards.$array[cards.$offset + i]).Value());
if (i === 1) {
console.log();
}
i = i + (1) >> 0;
}
console.log();
console.log(game24.Resolve(cards));
k = k + (1) >> 0;
}
};
$pkg.Play = Play;
$init = function() {
$pkg.$init = function() {};
/* */ var $f, $c = false, $s = 0, $r; if (this !== undefined && this.$blk !== undefined) { $f = this; $c = true; $s = $f.$s; $r = $f.$r; } s: while (true) { switch ($s) { case 0:
$r = game24.$init(); /* */ $s = 1; case 1: if($c) { $c = false; $r = $r.$blk(); } if ($r && $r.$blk !== undefined) { break s; }
rand_digitRange = 0;
if ($pkg === $mainPkg) {
main();
$mainFinished = true;
}
/* */ } return; } if ($f === undefined) { $f = { $blk: $init }; } $f.$s = $s; $f.$r = $r; return $f;
};
$pkg.$init = $init;
return $pkg;
})();
$synthesizeMethods();
var $mainPkg = $packages["."];
$packages["runtime"].$init();
$go($mainPkg.$init, []);
$flushConsole();
}).call(this);
//# sourceMappingURL=tojs.js.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment