Struct CodeGen

Source
pub struct CodeGen<'a> { /* private fields */ }
Expand description

CodeGen implements the code generation logic.

Implementations§

Source§

impl<'a> CodeGen<'a>

Source

pub fn new( vmo: &'a mut VMObjects, asto: &'a AstObjects, tco: &'a TCObjects, dummy_gcv: &'a mut GcoVec, ti: &'a TypeInfo, type_cache: &'a mut HashMap<TypeKey, GosMetadata>, mapping: &'a mut IfaceMapping, pkg_indices: &'a HashMap<TCPackageKey, OpIndex>, pkgs: &'a Vec<PackageKey>, pkg: PackageKey, bk: IdentKey, ) -> CodeGen<'a>

Source

pub fn pkg_util(&mut self) -> &mut PkgUtil<'a>

Source

pub fn gen_with_files( &mut self, files: &Vec<File>, tcpkg: TCPackageKey, index: OpIndex, )

Trait Implementations§

Source§

impl<'a> ExprVisitor for CodeGen<'a>

Source§

fn visit_expr_func_lit(&mut self, this: &Expr, flit: &FuncLit)

Add function as a const and then generate a closure of it

Source§

type Result = ()

Source§

fn visit_expr(&mut self, expr: &Expr)

Source§

fn visit_expr_ident(&mut self, expr: &Expr, ident: &IdentKey)

Source§

fn visit_expr_ellipsis(&mut self, _: &Expr, _els: &Option<Expr>)

Source§

fn visit_expr_basic_lit(&mut self, this: &Expr, blit: &BasicLit)

Source§

fn visit_expr_composit_lit(&mut self, _: &Expr, clit: &CompositeLit)

Source§

fn visit_expr_paren(&mut self, _: &Expr, expr: &Expr)

Source§

fn visit_expr_selector(&mut self, this: &Expr, expr: &Expr, ident: &IdentKey)

Source§

fn visit_expr_index(&mut self, _: &Expr, expr: &Expr, index: &Expr)

Source§

fn visit_expr_slice( &mut self, _: &Expr, expr: &Expr, low: &Option<Expr>, high: &Option<Expr>, max: &Option<Expr>, ) -> Self::Result

Source§

fn visit_expr_type_assert( &mut self, _: &Expr, _expr: &Expr, _typ: &Option<Expr>, )

Source§

fn visit_expr_call( &mut self, _: &Expr, func_expr: &Expr, params: &Vec<Expr>, ellipsis: bool, )

Source§

fn visit_expr_star(&mut self, _: &Expr, expr: &Expr)

Source§

fn visit_expr_unary(&mut self, this: &Expr, expr: &Expr, op: &Token)

Source§

fn visit_expr_binary(&mut self, _: &Expr, left: &Expr, op: &Token, right: &Expr)

Source§

fn visit_expr_key_value(&mut self, e: &Expr, _key: &Expr, _val: &Expr)

Source§

fn visit_expr_array_type(&mut self, this: &Expr, _: &Option<Expr>, _: &Expr)

codegen needs the unwraped expr
Source§

fn visit_expr_struct_type(&mut self, this: &Expr, _s: &StructType)

Source§

fn visit_expr_func_type(&mut self, this: &Expr, _s: &FuncTypeKey)

Source§

fn visit_expr_interface_type(&mut self, this: &Expr, _s: &InterfaceType)

Source§

fn visit_map_type(&mut self, this: &Expr, _: &Expr, _: &Expr, _map: &Expr)

codegen needs the unwraped expr
Source§

fn visit_chan_type(&mut self, this: &Expr, _chan: &Expr, _dir: &ChanDir)

Source§

fn visit_bad_expr(&mut self, _: &Expr, _e: &BadExpr)

Source§

impl<'a> StmtVisitor for CodeGen<'a>

Source§

type Result = ()

Source§

fn visit_stmt(&mut self, stmt: &Stmt)

Source§

fn visit_decl(&mut self, decl: &Decl)

Source§

fn visit_stmt_decl_gen(&mut self, gdecl: &GenDecl)

Source§

fn visit_stmt_decl_func(&mut self, fdecl: &FuncDeclKey) -> Self::Result

Source§

fn visit_stmt_labeled(&mut self, lstmt: &LabeledStmtKey)

Source§

fn visit_stmt_send(&mut self, sstmt: &SendStmt)

Source§

fn visit_stmt_incdec(&mut self, idcstmt: &IncDecStmt)

Source§

fn visit_stmt_assign(&mut self, astmt: &AssignStmtKey)

Source§

fn visit_stmt_go(&mut self, gostmt: &GoStmt)

Source§

fn visit_stmt_defer(&mut self, dstmt: &DeferStmt)

Source§

fn visit_stmt_return(&mut self, rstmt: &ReturnStmt)

Source§

fn visit_stmt_branch(&mut self, bstmt: &BranchStmt)

Source§

fn visit_stmt_block(&mut self, bstmt: &BlockStmt)

Source§

fn visit_stmt_if(&mut self, ifstmt: &IfStmt)

Source§

fn visit_stmt_case(&mut self, _cclause: &CaseClause)

Source§

fn visit_stmt_switch(&mut self, sstmt: &SwitchStmt)

Source§

fn visit_stmt_type_switch(&mut self, tstmt: &TypeSwitchStmt)

Source§

fn visit_stmt_comm(&mut self, _cclause: &CommClause)

Source§

fn visit_stmt_select(&mut self, sstmt: &SelectStmt)

Source§

fn visit_stmt_for(&mut self, fstmt: &ForStmt)

Source§

fn visit_stmt_range(&mut self, rstmt: &RangeStmt)

Source§

fn visit_empty_stmt(&mut self, _e: &EmptyStmt)

Source§

fn visit_bad_stmt(&mut self, _b: &BadStmt)

Source§

fn visit_bad_decl(&mut self, _b: &BadDecl)

Auto Trait Implementations§

§

impl<'a> Freeze for CodeGen<'a>

§

impl<'a> !RefUnwindSafe for CodeGen<'a>

§

impl<'a> !Send for CodeGen<'a>

§

impl<'a> !Sync for CodeGen<'a>

§

impl<'a> Unpin for CodeGen<'a>

§

impl<'a> !UnwindSafe for CodeGen<'a>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V