Documentation
¶
Overview ¶
Package workspace is an in-memory cross-routine index of M source: every routine's labels (declarations) and outbound call sites (references). It is the substrate the cross-routine lint rules need (M-XINDX-007 call-to-undefined -routine, 008 call-to-undefined-label, 049 label-never-referenced) — the single-file linter has no other way to resolve LABEL^ROUTINE across files. Faithful port of the Python tool's m_cli.workspace.WorkspaceIndex.
Routine identity comes from the file base name (upper-cased), matching ydb's resolution — not the first-label-equals-routine convention, which not every codebase follows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UsesRuntimeLabelLookup ¶
UsesRuntimeLabelLookup is a coarse, conservative check: if any marker is present, the routine's label graph may be dynamic, so M-XINDX-049 skips it.
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index holds labels keyed by routine and references keyed by target.
func (*Index) AddFile ¶
AddFile indexes one parsed file's labels + references. routine is the file base name (without extension); it is upper-cased internally.
func (*Index) HasRoutine ¶
HasRoutine reports whether any label is indexed for routine (case-insensitive).
func (*Index) Lookup ¶
Lookup reports whether LABEL^ROUTINE resolves. label "" means the routine entry (resolves iff the routine has any label, per M semantics).
func (*Index) ReferencesTo ¶
ReferencesTo counts indexed call sites whose target matches (routine, label).
type Label ¶
type Label struct {
Routine string // upper-case routine name
Name string // original-case label
Line int // 1-based
}
Label is one labeled entry point.
type Reference ¶
type Reference struct {
TargetRoutine string // upper
TargetLabel string // upper, "" when only ^ROUTINE was written
Line int // 1-based
Col int // 0-based
EndCol int // 0-based exclusive
}
Reference is one outbound call site. TargetLabel is "" for `^ROUTINE` / `$$^ROUTINE` forms that name no label. Positions are 0-based columns.