MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / checkDependencies

Function checkDependencies

src/jsifier.mjs:219–235  ·  view source on GitHub ↗

* Hacky attempt to find unused `__deps` entries. This is not enabled by default * but can be enabled by setting CHECK_DEPS above. * TODO: Use a more precise method such as tokenising using acorn.

(symbol, snippet, deps, postset)

Source from the content-addressed store, hash-verified

217 * TODO: Use a more precise method such as tokenising using acorn.
218 */
219function checkDependencies(symbol, snippet, deps, postset) {
220 if (checkDependenciesSkip.has(symbol)) {
221 return;
222 }
223 for (const dep of deps) {
224 if (typeof dep === 'function') {
225 continue;
226 }
227 if (checkDependenciesIgnore.has(dep)) {
228 continue;
229 }
230 const mangled = mangleCSymbolName(dep);
231 if (!snippet.includes(mangled) && !postset?.includes(mangled)) {
232 error(`${symbol}: unused dependency: ${dep}`);
233 }
234 }
235}
236
237function addImplicitDeps(snippet, deps) {
238 // There are some common dependencies that we inject automatically by

Callers 1

addFromLibraryFunction · 0.85

Calls 3

errorFunction · 0.90
mangleCSymbolNameFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected