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

Function addImplicitDeps

src/jsifier.mjs:237–256  ·  view source on GitHub ↗
(snippet, deps)

Source from the content-addressed store, hash-verified

235}
236
237function addImplicitDeps(snippet, deps) {
238 // There are some common dependencies that we inject automatically by
239 // conservatively scanning the input functions for their usage.
240 // Specifically, these are dependencies that are very common and would be
241 // burdensome to add manually to all functions.
242 // The first four are deps that are automatically/conditionally added
243 // by the {{{ makeDynCall }}}, and {{{ runtimeKeepalivePush/Pop }}} macros.
244 const autoDeps = [
245 'getDynCaller',
246 'getWasmTableEntry',
247 'runtimeKeepalivePush',
248 'runtimeKeepalivePop',
249 'UTF8ToString',
250 ];
251 for (const dep of autoDeps) {
252 if (snippet.includes(dep + '(')) {
253 deps.push('$' + dep);
254 }
255 }
256}
257
258function sigToArgs(sig) {
259 const args = []

Callers 1

addFromLibraryFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected