MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / add

Method add

src/extraction/languages/cpp-brace-scopes.ts:38–48  ·  view source on GitHub ↗

* Adds the interval `(open, close)`. One that opens before the last one * added, or crosses one that holds it, is refused (false).

(open: number, close: number, value: T)

Source from the content-addressed store, hash-verified

36 * added, or crosses one that holds it, is refused (false).
37 */
38 add(open: number, close: number, value: T): boolean {
39 const count = this.opens.length;
40 if (close <= open || (count > 0 && open <= this.opens[count - 1]!)) return false;
41 const parent = this.innermost(open);
42 if (parent >= 0 && close >= this.closes[parent]!) return false;
43 this.opens.push(open);
44 this.closes.push(close);
45 this.parents.push(parent);
46 this.values.push(value);
47 return true;
48 }
49
50 /** The values of the intervals holding `offset` (open < offset < close), outermost first. */
51 at(offset: number): T[] {

Callers 15

scanCppBraceScopesFunction · 0.95
index.tsFile · 0.45
readGitignorePatternsFunction · 0.45
buildDefaultIgnoreFunction · 0.45
defaultsOnlyIgnoreFunction · 0.45
loadExcludeMatcherFunction · 0.45
loadIncludeMatcherFunction · 0.45
includeStaticRootsFunction · 0.45
considerFunction · 0.45
walkFunction · 0.45
collectGitFilesFunction · 0.45

Calls 2

innermostMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected