MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / from_config

Method from_config

src/compilation_pipeline.rs:232–255  ·  view source on GitHub ↗
(config: PipelineConfig)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected