(line, file, near)
| 404 | } |
| 405 | |
| 406 | function findMatchingPosition(line, file, near) { |
| 407 | var pos = Math.max(0, near - 500), closest = null; |
| 408 | if (!/^\s*$/.test(line)) for (;;) { |
| 409 | var found = file.indexOf(line, pos); |
| 410 | if (found < 0 || found > near + 500) break; |
| 411 | if (closest == null || Math.abs(closest - near) > Math.abs(found - near)) |
| 412 | closest = found; |
| 413 | pos = found + line.length; |
| 414 | } |
| 415 | return closest; |
| 416 | } |
| 417 | |
| 418 | function scopeDepth(s) { |
| 419 | for (var i = 0; s; ++i, s = s.prev) {} |
no test coverage detected