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

Function condition

src/resolution/cpp-macro-visibility.ts:309–318  ·  view source on GitHub ↗
(expression: string)

Source from the content-addressed store, hash-verified

307 let budget = WALK_EVENT_BUDGET;
308 let cutoff = Infinity;
309 const condition = (expression: string): Truth => {
310 const text = expression.trim();
311 if (/^(?:0x[\da-f]+|\d+)[uUlL]*$/i.test(text)) return Number(text.replace(/[uUlL]+$/, '')) !== 0;
312 const def = text.match(/^(!)?\s*defined\s*(?:\(\s*(\w+)\s*\)|(\w+))$/);
313 if (def) {
314 const known = definitions.get(def[2] ?? def[3]!)?.defined;
315 return def[1] ? not(known) : known;
316 }
317 return /^\w+$/.test(text) ? definitions.get(text)?.value : undefined;
318 };
319 const scan = (file: string, inherited: Truth, includeLine?: number): void => {
320 if (inherited === false || once.get(file) === true || cutoff !== Infinity) return;
321 if (scanning.has(file)) {

Callers 4

scanFunction · 0.85
guardsBeforeFunction · 0.85
tickFunction · 0.85
checkFunction · 0.85

Calls 3

NumberInterface · 0.85
notFunction · 0.70
getMethod · 0.65

Tested by 2

tickFunction · 0.68
checkFunction · 0.68