Skip to content

extractCSharpControlFlow

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/libs/parser-core/src/parsers/backend/csharp-control-flow.ts

Read the guards and catches out of a span of C# source.

startLine/endLine bound the scan to one class without changing the coordinate space: the line numbers reported are always the file's own, so an entity spanning lines 40–300 reports a guard at line 57 and not at line 17.

Only an if whose branch is a single throw or return counts as a guard. A condition wrapping a block of real work is control flow but not a refusal, and calling it one would put a sentence on the page that misdescribes the code — PAMS has if (typeId <= 0) { await logic.LogException(…); return BadRequest(); }, which logs before it refuses and so is deliberately not reported as a bare refusal.

Signature

ts
function extractCSharpControlFlow(source: string, startLine: number, endLine: number): ControlFlow

Parameters

NameType
sourcestring
startLinenumber
endLinenumber

Returns: ControlFlow

Was this page helpful?

Download as PDF