pub struct FileModel {
pub source_set: SourceSet,
pub source_lines: u32,
pub functions: Vec<Function>,
pub tokens: Vec<Token>,
pub flagged_lines: Vec<FlaggedLine>,
pub hazard_lines: Vec<HazardLine>,
pub runtime_imports: Vec<ImportEdge>,
pub program_start: bool,
pub is_tooling_file: bool,
pub diagnostics: Vec<FileDiagnostic>,
pub scope_artifact: Option<Vec<u8>>,
}Expand description
The Code model of one source file.
Fields§
§source_set: SourceSetThe Source set of the file, chosen by the rules of the Language plugin.
source_lines: u32The lines that hold code, so not a blank line or a line with only comments.
functions: Vec<Function>Every function of the file, in the order their first lines appear.
tokens: Vec<Token>Every token of the file, in source order.
flagged_lines: Vec<FlaggedLine>Each Flagged line with the rule it matched; a line that matches two rules appears once per rule.
hazard_lines: Vec<HazardLine>Each Hazard line with the rule it matched; a line that matches two rules appears once per rule.
Empty when has-hazard-rules returns false.
runtime_imports: Vec<ImportEdge>The imports that run when the file runs, such as ./greet.
A Language plugin can normalize specifiers and group imported names from the same module.
Type-only imports are left out.
program_start: boolWhether the file starts a program as shown by its source text, such as a Go package main file.
False unless the Language plugin sets it.
is_tooling_file: boolWhether the file is a language-specific Tooling file, such as a config or build script. False unless the Language plugin sets it.
diagnostics: Vec<FileDiagnostic>Non-fatal per-file diagnostics collected while lowering this file.
scope_artifact: Option<Vec<u8>>Optional opaque bytes passed back into analyze-scope for cross-file analysis.
none unless has-scope-analysis returns true.