pub struct CodeGenerator<'ast> { /* private fields */ }Implementations§
Source§impl<'ast> CodeGenerator<'ast>
impl<'ast> CodeGenerator<'ast>
pub fn new(registry: SignatureRegistry, target: CompilationTarget) -> Self
Sourcepub fn set_global_struct_field_types(
&mut self,
field_types: HashMap<String, HashMap<String, Type>>,
)
pub fn set_global_struct_field_types( &mut self, field_types: HashMap<String, HashMap<String, Type>>, )
Pre-populate struct field types from cross-module definitions. This enables type inference for fields on imported structs, preventing unnecessary .clone() on Copy-type fields.
Sourcepub fn set_copy_types_registry(&mut self, registry: HashSet<String>)
pub fn set_copy_types_registry(&mut self, registry: HashSet<String>)
Set Copy types registry from the global compiler state. This enables is_copy_type to recognize user-defined types with @derive(Copy) (e.g., VoxelType, FaceDirection) in addition to primitive Copy types.
Sourcepub fn set_analyzed_trait_methods(
&mut self,
methods: HashMap<String, HashMap<String, AnalyzedFunction<'ast>>>,
)
pub fn set_analyzed_trait_methods( &mut self, methods: HashMap<String, HashMap<String, AnalyzedFunction<'ast>>>, )
Set analyzed trait methods (used for trait signature inference from impls)
Sourcepub fn set_workspace_root(&mut self, path: PathBuf)
pub fn set_workspace_root(&mut self, path: PathBuf)
Set the workspace root for relative paths in source maps
Sourcepub fn set_inferred_bounds(&mut self, bounds: HashMap<String, InferredBounds>)
pub fn set_inferred_bounds(&mut self, bounds: HashMap<String, InferredBounds>)
Set inferred trait bounds for functions
pub fn new_for_module( registry: SignatureRegistry, target: CompilationTarget, ) -> Self
Sourcepub fn set_output_file(&mut self, path: impl Into<PathBuf>)
pub fn set_output_file(&mut self, path: impl Into<PathBuf>)
Set the output file path for source mapping
Sourcepub fn set_is_module(&mut self, is_module: bool)
pub fn set_is_module(&mut self, is_module: bool)
Set whether this generator is producing module code (vs entry point)
Sourcepub fn set_source_file(&mut self, path: impl Into<PathBuf>)
pub fn set_source_file(&mut self, path: impl Into<PathBuf>)
Set the Windjammer source file path for source mapping
Sourcepub fn get_source_map(&self) -> &SourceMap
pub fn get_source_map(&self) -> &SourceMap
Get the source map (for saving after code generation)
pub fn generate_program( &mut self, program: &Program<'ast>, analyzed: &[AnalyzedFunction<'ast>], ) -> String
Auto Trait Implementations§
impl<'ast> Freeze for CodeGenerator<'ast>
impl<'ast> RefUnwindSafe for CodeGenerator<'ast>
impl<'ast> Send for CodeGenerator<'ast>
impl<'ast> Sync for CodeGenerator<'ast>
impl<'ast> Unpin for CodeGenerator<'ast>
impl<'ast> UnsafeUnpin for CodeGenerator<'ast>
impl<'ast> UnwindSafe for CodeGenerator<'ast>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more