pub struct DartBackend { /* private fields */ }Expand description
Dart code generation backend.
Implementations§
Source§impl DartBackend
impl DartBackend
pub fn new() -> Self
Sourcepub fn mangle_name(&mut self, name: &str) -> String
pub fn mangle_name(&mut self, name: &str) -> String
Mangle an OxiLean identifier to a valid Dart identifier.
Sourcepub fn emit_module(&mut self, module: &DartModule) -> String
pub fn emit_module(&mut self, module: &DartModule) -> String
Emit a complete Dart module (file) as a String.
Sourcepub fn emit_import(&self, import: &DartImport) -> String
pub fn emit_import(&self, import: &DartImport) -> String
Emit a DartImport.
Sourcepub fn emit_class(&self, class: &DartClass, depth: usize) -> String
pub fn emit_class(&self, class: &DartClass, depth: usize) -> String
Emit a Dart class declaration.
Sourcepub fn emit_constructor(
&self,
ctor: &DartFunction,
class_name: &str,
depth: usize,
) -> String
pub fn emit_constructor( &self, ctor: &DartFunction, class_name: &str, depth: usize, ) -> String
Emit a Dart constructor (uses class name, not return type).
Sourcepub fn emit_function(&self, func: &DartFunction, depth: usize) -> String
pub fn emit_function(&self, func: &DartFunction, depth: usize) -> String
Emit a Dart function or method.
Sourcepub fn emit_getter(&self, func: &DartFunction, depth: usize) -> String
pub fn emit_getter(&self, func: &DartFunction, depth: usize) -> String
Emit a Dart getter (a function with get keyword, no params).
Sourcepub fn emit_params(&self, params: &[DartParam]) -> String
pub fn emit_params(&self, params: &[DartParam]) -> String
Emit a parameter list.
Sourcepub fn emit_stmt(&self, stmt: &DartStmt, depth: usize) -> String
pub fn emit_stmt(&self, stmt: &DartStmt, depth: usize) -> String
Emit a Dart statement with proper indentation.
Sourcepub fn compile_lcnf_function(
&mut self,
func: &LcnfFunDecl,
) -> Result<DartFunction, String>
pub fn compile_lcnf_function( &mut self, func: &LcnfFunDecl, ) -> Result<DartFunction, String>
Compile an LCNF function to a DartFunction.
Sourcepub fn compile_lcnf_module(
&mut self,
module: &LcnfModule,
) -> Result<DartModule, String>
pub fn compile_lcnf_module( &mut self, module: &LcnfModule, ) -> Result<DartModule, String>
Compile an LCNF module to a DartModule.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DartBackend
impl RefUnwindSafe for DartBackend
impl Send for DartBackend
impl Sync for DartBackend
impl Unpin for DartBackend
impl UnsafeUnpin for DartBackend
impl UnwindSafe for DartBackend
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
Mutably borrows from an owned value. Read more