pub struct CompilerSession<'a> { /* private fields */ }Expand description
One reusable pure-Rust compiler session backed by a script resolver.
Implementations§
Source§impl<'a> CompilerSession<'a>
impl<'a> CompilerSession<'a>
Sourcepub fn new(resolver: &'a dyn ScriptResolver) -> Self
pub fn new(resolver: &'a dyn ScriptResolver) -> Self
Creates one compiler session with default options.
Sourcepub fn with_options(
resolver: &'a dyn ScriptResolver,
options: CompilerSessionOptions,
) -> Self
pub fn with_options( resolver: &'a dyn ScriptResolver, options: CompilerSessionOptions, ) -> Self
Creates one compiler session with explicit options.
Sourcepub fn options(&self) -> &CompilerSessionOptions
pub fn options(&self) -> &CompilerSessionOptions
Returns the current immutable session options.
Sourcepub fn generate_debugger_output(&self) -> bool
pub fn generate_debugger_output(&self) -> bool
Returns whether this session emits NDB debugger output.
Sourcepub fn set_generate_debugger_output(&mut self, state: bool)
pub fn set_generate_debugger_output(&mut self, state: bool)
Toggles NDB debugger output without recreating the session.
Sourcepub fn optimization_level(&self) -> OptimizationLevel
pub fn optimization_level(&self) -> OptimizationLevel
Returns the current optimization level.
Sourcepub fn set_optimization_level(&mut self, optimization: OptimizationLevel)
pub fn set_optimization_level(&mut self, optimization: OptimizationLevel)
Updates the optimization level without recreating the session.
Sourcepub fn source_load_options(&self) -> SourceLoadOptions
pub fn source_load_options(&self) -> SourceLoadOptions
Returns the current source-load options.
Sourcepub fn set_source_load_options(&mut self, options: SourceLoadOptions)
pub fn set_source_load_options(&mut self, options: SourceLoadOptions)
Updates source-loading options and invalidates any cached langspec.
Sourcepub fn langspec_script_name(&self) -> &str
pub fn langspec_script_name(&self) -> &str
Returns the logical langspec script name.
Sourcepub fn set_langspec_script_name(&mut self, script_name: impl Into<String>)
pub fn set_langspec_script_name(&mut self, script_name: impl Into<String>)
Updates the langspec script name and invalidates any cached langspec.
Sourcepub fn compile_script_name(
&mut self,
script_name: &str,
) -> Result<CompileArtifacts, CompilerSessionError>
pub fn compile_script_name( &mut self, script_name: &str, ) -> Result<CompileArtifacts, CompilerSessionError>
Compiles one logical script name through the configured resolver.
§Errors
Returns CompilerSessionError if source loading, langspec loading,
parsing, or code generation fails.
Sourcepub fn render_graphviz_for_script_name(
&mut self,
script_name: &str,
) -> Result<String, CompilerSessionError>
pub fn render_graphviz_for_script_name( &mut self, script_name: &str, ) -> Result<String, CompilerSessionError>
Renders one logical script name to Graphviz DOT using the cached langspec and loaded source bundle.
§Errors
Returns CompilerSessionError if source loading or parsing fails.