(config: PipelineConfig)
| 230 | // The mangling prefix: file stem for path imports, else the registry key, |
| 231 | // sanitized to an identifier. |
| 232 | fn module_prefix(key: &str, source_path: Option<&Path>) -> String { |
| 233 | let raw = source_path |
| 234 | .and_then(Path::file_stem) |
| 235 | .and_then(|s| s.to_str()) |
| 236 | .unwrap_or(key); |
| 237 | raw.chars() |
| 238 | .map(|c| if c.is_ascii_alphanumeric() { c } else { '_' }) |
| 239 | .collect() |
| 240 | } |
| 241 | |
| 242 | /// Source -> tokens -> AST -> IR, with mode-specific validation. |
| 243 | #[track_caller] |
| 244 | pub fn compile(&self, source: &str) -> Result<CompilationResult, CompilationError> { |
| 245 | log::info!("Starting compilation pipeline"); |
| 246 | |
| 247 | let resolved = self |
| 248 | .resolve_modules(source) |
| 249 | .map_err(CompilationError::DiagnosticErrors)?; |
| 250 | let compiler = HllCompiler::new(CompileConfig { |
| 251 | target: self.target_mode, |
| 252 | strict: self.run_semantic_analysis, |
| 253 | string_prefix: self.string_prefix.clone(), |
| 254 | type_prelude: self.type_prelude.clone(), |
| 255 | source_prelude: resolved.prelude, |
| 256 | module_aliases: resolved.aliases, |
| 257 | module_mangle_prefix: self |
| 258 | .mangle_modules |
nothing calls this directly
no outgoing calls
no test coverage detected