Skip to main content

DartBackend

Struct DartBackend 

Source
pub struct DartBackend { /* private fields */ }
Expand description

Dart code generation backend.

Implementations§

Source§

impl DartBackend

Source

pub fn new() -> Self

Source

pub fn fresh_var(&mut self) -> String

Generate a fresh local variable name.

Source

pub fn mangle_name(&mut self, name: &str) -> String

Mangle an OxiLean identifier to a valid Dart identifier.

Source

pub fn emit_module(&mut self, module: &DartModule) -> String

Emit a complete Dart module (file) as a String.

Source

pub fn emit_import(&self, import: &DartImport) -> String

Emit a DartImport.

Source

pub fn emit_class(&self, class: &DartClass, depth: usize) -> String

Emit a Dart class declaration.

Source

pub fn emit_constructor( &self, ctor: &DartFunction, class_name: &str, depth: usize, ) -> String

Emit a Dart constructor (uses class name, not return type).

Source

pub fn emit_function(&self, func: &DartFunction, depth: usize) -> String

Emit a Dart function or method.

Source

pub fn emit_getter(&self, func: &DartFunction, depth: usize) -> String

Emit a Dart getter (a function with get keyword, no params).

Source

pub fn emit_params(&self, params: &[DartParam]) -> String

Emit a parameter list.

Source

pub fn emit_stmt(&self, stmt: &DartStmt, depth: usize) -> String

Emit a Dart statement with proper indentation.

Source

pub fn compile_lcnf_function( &mut self, func: &LcnfFunDecl, ) -> Result<DartFunction, String>

Compile an LCNF function to a DartFunction.

Source

pub fn compile_lcnf_module( &mut self, module: &LcnfModule, ) -> Result<DartModule, String>

Compile an LCNF module to a DartModule.

Trait Implementations§

Source§

impl Default for DartBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.