(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans)
| 142425 | } |
| 142426 | ts.createPatternMatcher = createPatternMatcher; |
| 142427 | function getFullMatch(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans) { |
| 142428 | // First, check that the last part of the dot separated pattern matches the name of the |
| 142429 | // candidate. If not, then there's no point in proceeding and doing the more |
| 142430 | // expensive work. |
| 142431 | var candidateMatch = matchSegment(candidate, ts.last(dotSeparatedSegments), stringToWordSpans); |
| 142432 | if (!candidateMatch) { |
| 142433 | return undefined; |
| 142434 | } |
| 142435 | // -1 because the last part was checked against the name, and only the rest |
| 142436 | // of the parts are checked against the container. |
| 142437 | if (dotSeparatedSegments.length - 1 > candidateContainers.length) { |
| 142438 | // There weren't enough container parts to match against the pattern parts. |
| 142439 | // So this definitely doesn't match. |
| 142440 | return undefined; |
| 142441 | } |
| 142442 | var bestMatch; |
| 142443 | for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i -= 1, j -= 1) { |
| 142444 | bestMatch = betterMatch(bestMatch, matchSegment(candidateContainers[j], dotSeparatedSegments[i], stringToWordSpans)); |
| 142445 | } |
| 142446 | return bestMatch; |
| 142447 | } |
| 142448 | function getWordSpans(word, stringToWordSpans) { |
| 142449 | var spans = stringToWordSpans.get(word); |
| 142450 | if (!spans) { |
no test coverage detected
searching dependent graphs…