MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / findMatchingPosition

Function findMatchingPosition

lib/web/tern/tern.js:406–416  ·  view source on GitHub ↗
(line, file, near)

Source from the content-addressed store, hash-verified

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) {}

Callers 1

resolveFileFunction · 0.85

Calls 3

indexOfMethod · 0.80
maxMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected