| 235 | } |
| 236 | |
| 237 | function 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 | |
| 258 | function sigToArgs(sig) { |
| 259 | const args = [] |