SourceLineLabeler

Reads source text for instruction-level CodeConstructViews and stores it as tooltip metadata at the instruction's file:line location. The IR node label stays IR-specific (instruction-N: opcode) so multiple IR operations mapped to the same source line remain distinguishable.

The labeler is a post-load pass: the loader stamps each com.stigway.metamodels.highway.CodeInstruction with a synthetic com.stigway.references.StigRepoFile carrying the absolute file path the analyzer reported, plus the line number. This object then reads each referenced file once (cached per call), looks up the 1-indexed line, trims whitespace, truncates to maxChars, and stores the result as view.sourceLineText.

Files that don't exist on disk (the analyzer's compile-time path may live inside a bazel cache that's been cleaned), or lines that fall outside the file, are left as-is: the renderer still shows the IR label.

Functions

Link copied to clipboard
fun label(graph: Vista, maxChars: Int = DEFAULT_MAX_CHARS): Vista

Returns a copy of graph with each instruction view's sourceLineText set to the trimmed source-code line at its file/line location. Function and other-kind constructs are left alone.

Generated with STIG