Skip to content

Commit e27d7fe

Browse files
authored
Cleanup helper functions in libwebgl.js. NFC (#25447)
1 parent 7b36fc8 commit e27d7fe

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/lib/libwebgl.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4317,9 +4317,7 @@ var glPassthroughFuncs = [
43174317
];
43184318

43194319
function createGLPassthroughFunctions(lib, funcs) {
4320-
funcs.forEach((data) => {
4321-
const num = data[0];
4322-
const names = data[1];
4320+
for (const [num, names] of funcs) {
43234321
const args = range(num).map((i) => 'x' + i ).join(', ');
43244322
const stub = `(${args}) => GLctx.NAME(${args})`;
43254323
const sigEnd = range(num).map(() => 'i').join('');
@@ -4341,7 +4339,7 @@ function createGLPassthroughFunctions(lib, funcs) {
43414339
lib[cName] = eval(stub.replace('NAME', name));
43424340
assert(lib[cName + '__sig'] || LibraryManager.library[cName + '__sig'], 'missing sig for ' + cName);
43434341
});
4344-
});
4342+
}
43454343
}
43464344

43474345
createGLPassthroughFunctions(LibraryGL, glPassthroughFuncs);
@@ -4352,15 +4350,16 @@ function recordGLProcAddressGet(lib) {
43524350
// GL proc address retrieval - allow access through glX and emscripten_glX, to
43534351
// allow name collisions with user-implemented things having the same name
43544352
// (see gl.c)
4355-
Object.keys(lib).forEach((x) => {
4356-
if (x.startsWith('gl') && !isDecorator(x)) {
4357-
lib['emscripten_' + x] = x;
4358-
var sig = LibraryManager.library[x + '__sig'];
4353+
for (const sym of Object.keys(lib)) {
4354+
if (sym.startsWith('gl') && !isDecorator(sym)) {
4355+
const alias = 'emscripten_' + sym;
4356+
lib[alias] = sym;
4357+
var sig = LibraryManager.library[sym + '__sig'];
43594358
if (sig) {
4360-
lib['emscripten_' + x + '__sig'] = sig;
4359+
lib[alias + '__sig'] = sig;
43614360
}
43624361
}
4363-
});
4362+
}
43644363
}
43654364

43664365
recordGLProcAddressGet(LibraryGL);

0 commit comments

Comments
 (0)