MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / combine

Function combine

deps/lua/src/luac.c:119–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117#define toproto(L,i) (clvalue(L->top+(i))->l.p)
118
119static const Proto* combine(lua_State* L, int n)
120{
121 if (n==1)
122 return toproto(L,-1);
123 else
124 {
125 int i,pc;
126 Proto* f=luaF_newproto(L);
127 setptvalue2s(L,L->top,f); incr_top(L);
128 f->source=luaS_newliteral(L,"=(" PROGNAME ")");
129 f->maxstacksize=1;
130 pc=2*n+1;
131 f->code=luaM_newvector(L,pc,Instruction);
132 f->sizecode=pc;
133 f->p=luaM_newvector(L,n,Proto*);
134 f->sizep=n;
135 pc=0;
136 for (i=0; i<n; i++)
137 {
138 f->p[i]=toproto(L,i-n-1);
139 f->code[pc++]=CREATE_ABx(OP_CLOSURE,0,i);
140 f->code[pc++]=CREATE_ABC(OP_CALL,0,1,1);
141 }
142 f->code[pc++]=CREATE_ABC(OP_RETURN,0,1,0);
143 return f;
144 }
145}
146
147static int writer(lua_State* L, const void* p, size_t size, void* u)
148{

Callers 1

pmainFunction · 0.85

Calls 1

luaF_newprotoFunction · 0.85

Tested by

no test coverage detected