Skip to main content

CodegenCtx

Struct CodegenCtx 

Source
pub struct CodegenCtx<'a> {
Show 18 fields pub writer: &'a mut ClassFileWriter, pub catalog: ClassCatalog, pub class_name: Ustr, pub super_name: Ustr, pub return_ty: Ty, pub next_local: u16, pub locals: HashMap<Ustr, u16>, pub local_types: HashMap<Ustr, Ty>, pub fields: HashMap<Ustr, FieldInfo>, pub methods: HashMap<Ustr, MethodSig>, pub outer_this: Option<OuterThisInfo>, pub outer_fields: HashMap<Ustr, CapturedField>, pub enclosing_static_owner: Option<Ustr>, pub break_labels: Vec<ControlTarget>, pub continue_labels: Vec<ControlTarget>, pub labeled_break_labels: Vec<(Ustr, ControlTarget)>, pub labeled_continue_labels: Vec<(Ustr, ControlTarget)>, pub cleanup_scopes: Vec<CleanupScope>, /* private fields */
}

Fields§

§writer: &'a mut ClassFileWriter§catalog: ClassCatalog§class_name: Ustr§super_name: Ustr§return_ty: Ty§next_local: u16§locals: HashMap<Ustr, u16>§local_types: HashMap<Ustr, Ty>§fields: HashMap<Ustr, FieldInfo>§methods: HashMap<Ustr, MethodSig>§outer_this: Option<OuterThisInfo>§outer_fields: HashMap<Ustr, CapturedField>§enclosing_static_owner: Option<Ustr>§break_labels: Vec<ControlTarget>§continue_labels: Vec<ControlTarget>§labeled_break_labels: Vec<(Ustr, ControlTarget)>§labeled_continue_labels: Vec<(Ustr, ControlTarget)>§cleanup_scopes: Vec<CleanupScope>

Implementations§

Source§

impl<'a> CodegenCtx<'a>

Source

pub fn new( writer: &'a mut ClassFileWriter, class_name: Ustr, catalog: &ClassCatalog, ) -> Self

Source

pub fn set_super_name(&mut self, super_name: Ustr)

Source

pub fn set_fields(&mut self, fields: &[FieldDecl])

Source

pub fn set_methods(&mut self, methods: &[MethodDecl])

Source

pub fn set_anonymous_info(&mut self, info: Option<&AnonymousClassInfo>)

Source

pub fn begin_method(&mut self, method: &MethodDecl)

Source

pub fn alloc_local(&mut self, name: Ustr, ty: Ty) -> u16

Source

pub fn alloc_temp(&mut self, ty: &Ty) -> u16

Source

pub fn get_local(&self, name: Ustr) -> Option<u16>

Source

pub fn local_ty(&self, name: Ustr) -> Option<Ty>

Source

pub fn field_ty(&self, name: Ustr) -> Option<Ty>

Source

pub fn field_is_static(&self, name: Ustr) -> bool

Source

pub fn method_sig(&self, name: Ustr) -> Option<MethodSig>

Source

pub fn control_target(&self, label: Label) -> ControlTarget

Source

pub fn push_labeled_loop( &mut self, label: Ustr, break_label: ControlTarget, continue_label: ControlTarget, )

Source

pub fn pop_labeled_loop(&mut self)

Source

pub fn find_break_target(&self, label: Option<Ustr>) -> Option<ControlTarget>

Source

pub fn find_continue_target(&self, label: Option<Ustr>) -> Option<ControlTarget>

Trait Implementations§

Source§

impl TypeEnvironment for CodegenCtx<'_>

Source§

fn local_ty(&self, name: Ustr) -> Option<Ty>

Source§

fn field_ty(&self, name: Ustr) -> Option<Ty>

Source§

fn resolve_static_field(&self, owner: &str, name: &str) -> Option<Ty>

Source§

fn resolve_instance_method( &self, receiver: &Ty, name: &str, args: &[Ty], ) -> Option<Ty>

Source§

fn resolve_static_method( &self, owner: &str, name: &str, args: &[Ty], ) -> Option<Ty>

Source§

fn resolve_current_method(&self, name: Ustr, _args: &[Ty]) -> Option<Ty>

Source§

fn this_ty(&self) -> Ty

Source§

fn super_ty(&self) -> Ty

Auto Trait Implementations§

§

impl<'a> Freeze for CodegenCtx<'a>

§

impl<'a> RefUnwindSafe for CodegenCtx<'a>

§

impl<'a> Send for CodegenCtx<'a>

§

impl<'a> Sync for CodegenCtx<'a>

§

impl<'a> Unpin for CodegenCtx<'a>

§

impl<'a> UnsafeUnpin for CodegenCtx<'a>

§

impl<'a> !UnwindSafe for CodegenCtx<'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.