(sub: Subscriber)
| 322 | } |
| 323 | |
| 324 | function cleanupDeps(sub: Subscriber) { |
| 325 | // Cleanup unused deps |
| 326 | let head |
| 327 | let tail = sub.depsTail |
| 328 | let link = tail |
| 329 | while (link) { |
| 330 | const prev = link.prevDep |
| 331 | if (link.version === -1) { |
| 332 | if (link === tail) tail = prev |
| 333 | // unused - remove it from the dep's subscribing effect list |
| 334 | removeSub(link) |
| 335 | // also remove it from this effect's dep list |
| 336 | removeDep(link) |
| 337 | } else { |
| 338 | // The new head is the last node seen which wasn't removed |
| 339 | // from the doubly-linked list |
| 340 | head = link |
| 341 | } |
| 342 | |
| 343 | // restore previous active link if any |
| 344 | link.dep.activeLink = link.prevActiveLink |
| 345 | link.prevActiveLink = undefined |
| 346 | link = prev |
| 347 | } |
| 348 | // set the new head & tail |
| 349 | sub.deps = head |
| 350 | sub.depsTail = tail |
| 351 | } |
| 352 | |
| 353 | function isDirty(sub: Subscriber): boolean { |
| 354 | for (let link = sub.deps; link; link = link.nextDep) { |
no test coverage detected