aboutsummaryrefslogtreecommitdiff
path: root/tests/test-fix-closure.js
blob: 8ba0c69d3ae31c14b6013833d968a1db53d4f83c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var k=void 0,l=!0,m=null,n=!1,p=[],aa="object"===typeof process,ba="object"===typeof window,ca="function"===typeof importScripts,da=!ba&&!aa&&!ca;
if(aa){print=function(a){process.stdout.write(a+"\n")};printErr=function(a){process.stderr.write(a+"\n")};var ea=require("fs");read=function(a){var b=ea.readFileSync(a).toString();!b&&"/"!=a[0]&&(a=__dirname.split("/").slice(0,-1).join("/")+"/src/"+a,b=ea.readFileSync(a).toString());return b};p=process.argv.slice(2)}else if(da)this.read||(read=function(a){snarf(a)}),p=this.arguments?arguments:scriptArgs;else if(ba)print=printErr=function(a){console.log(a)},read=function(a){var b=new XMLHttpRequest;
b.open("GET",a,n);b.send(m);return b.responseText},this.arguments&&(p=arguments);else if(ca)load=importScripts;else throw"Unknown runtime environment. Where are we?";function fa(a){eval.call(m,a)}"undefined"==typeof load&&"undefined"!=typeof read&&(load=function(a){fa(read(a))});"undefined"===typeof printErr&&(printErr=function(){});"undefined"===typeof print&&(print=printErr);try{this.Module=Module}catch(ga){this.Module=Module={}}Module.arguments||(Module.arguments=p);Module.print&&(print=Module.print);
var r={T:function(){return q},S:function(a){q=a},Y:function(a,b){b=b||4;return isNumber(a)&&isNumber(b)?Math.ceil(a/b)*b:"Math.ceil(("+a+")/"+b+")*"+b},M:function(a){return a in r.C||a in r.B},N:function(a){return"*"==a[a.length-1]},P:function(a){return isPointerType(a)?n:/^\[\d+\ x\ (.*)\]/.test(a)||/<?{ [^}]* }>?/.test(a)?l:"%"==a[0]},C:{i1:0,i8:0,i16:0,i32:0,i64:0},B:{"float":0,"double":0},aa:function(a,b){return(a|0|b|0)+4294967296*(Math.round(a/4294967296)|Math.round(b/4294967296))},W:function(a,
b){return((a|0)&(b|0))+4294967296*(Math.round(a/4294967296)&Math.round(b/4294967296))},ea:function(a,b){return((a|0)^(b|0))+4294967296*(Math.round(a/4294967296)^Math.round(b/4294967296))},m:function(a){if(1==r.e)return 1;var b={"%i1":1,"%i8":1,"%i16":2,"%i32":4,"%i64":8,"%float":4,"%double":8}["%"+a];!b&&"*"==a[a.length-1]&&(b=r.e);return b},K:function(a){return Math.max(r.m(a),r.e)},H:function(a,b){var d={};return b?a.filter(function(a){return d[a[b]]?n:d[a[b]]=l}):a.filter(function(a){return d[a]?
n:d[a]=l})},set:function(){for(var a="object"===typeof arguments[0]?arguments[0]:arguments,b={},d=0;d<a.length;d++)b[a[d]]=0;return b},F:function(a){a.b=0;a.f=0;var b=[],d=-1;a.p=a.l.map(function(c){var e;if(r.M(c)||r.N(c))c=e=r.m(c);else if(r.P(c))e=Types.types[c].b,c=Types.types[c].f;else throw"Unclear type in struct: "+c+", in "+a.Q+" :: "+dump(Types.types[a.Q]);c=a.ba?1:Math.min(c,r.e);a.f=Math.max(a.f,c);c=r.i(a.b,c);a.b=c+e;0<=d&&b.push(c-d);return d=c});a.b=r.i(a.b,a.f);0==b.length?a.o=a.b:
1==r.H(b).length&&(a.o=b[0]);a.$=1!=a.o;return a.p},J:function(a,b,d){var c,e;if(b){d=d||0;c=("undefined"===typeof Types?r.da:Types.types)[b];if(!c)return m;a||(a=("undefined"===typeof Types?r:Types).ca[b.replace(/.*\./,"")]);if(!a)return m;s(c.l.length===a.length,"Number of named fields must match the type for "+b+". Perhaps due to inheritance, which is not supported yet?");e=c.p}else c={l:a.map(function(a){return a[0]})},e=r.F(c);var i={V:c.b};b?a.forEach(function(a,b){if("string"===typeof a)i[a]=
e[b]+d;else{var j,v;for(v in a)j=v;i[j]=r.J(a[j],c.l[b],e[b])}}):a.forEach(function(a,b){i[a[1]]=e[b]});return i},R:function(a){var b=q;q+=a;q=4*Math.ceil(q/4);s(q<t+u,"Ran out of stack");return b},z:function(a){var b=w;w+=a;w=4*Math.ceil(w/4);if(w>=x){printErr("Warning: Enlarging memory arrays, this is not fast! "+[w,x]);s(w>=x);for(s(4<x);x<=w;)x=Math.ceil(2*x/A)*A;var a=B,d=new ArrayBuffer(x);B=new Int8Array(d);C=new Int16Array(d);D=new Int32Array(d);H=new Uint8Array(d);ha=new Uint16Array(d);I=
new Uint32Array(d);J=new Float32Array(d);B.set(a)}return b},i:function(a,b){return Math.ceil(a/(b?b:4))*(b?b:4)},e:4,U:0},ia=[],L,ja=new ArrayBuffer(8),M=new Int32Array(ja),ka=new Float64Array(ja);function la(a){print(a+":\n"+Error().stack);throw"Assertion: "+a;}function s(a,b){a||la("Assertion failed: "+b)}
function ma(a,b,d){d=d||"i8";"*"===d[d.length-1]&&(d="i32");switch(d){case "i1":B[a]=b;break;case "i8":B[a]=b;break;case "i16":C[a>>1]=b;break;case "i32":D[a>>2]=b;break;case "i64":D[a>>2]=b[0];D[a+4>>2]=b[1];break;case "float":J[a>>2]=b;break;case "double":ka[0]=b;D[a>>2]=M[0];D[a+4>>2]=M[1];break;default:la("invalid type for setValue: "+d)}}Module.setValue=ma;
Module.getValue=function(a,b){b=b||"i8";"*"===b[b.length-1]&&(b="i32");switch(b){case "i1":return B[a];case "i8":return B[a];case "i16":return C[a>>1];case "i32":return D[a>>2];case "i64":return[I[a>>2],I[a+4>>2]];case "float":return J[a>>2];case "double":return M[0]=D[a>>2],M[1]=D[a+4>>2],ka[0];default:la("invalid type for setValue: "+b)}return m};var na=1,N=2;Module.ALLOC_NORMAL=0;Module.ALLOC_STACK=na;Module.ALLOC_STATIC=N;
function O(a,b,d){var c,e;"number"===typeof a?(c=l,e=a):(c=n,e=a.length);for(var i="string"===typeof b?b:m,d=[oa,r.R,r.z][d===k?N:d](Math.max(e,i?1:b.length)),h=0,f;h<e;){var <