* 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)
| 217 | * TODO: Use a more precise method such as tokenising using acorn. |
| 218 | */ |
| 219 | function 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 | |
| 237 | function addImplicitDeps(snippet, deps) { |
| 238 | // There are some common dependencies that we inject automatically by |
no test coverage detected