Struct Function

Source
pub struct Function {
    pub is_template: bool,
    pub function_generics: Vec<Type>,
    pub type_generics: Vec<Type>,
    /* private fields */
}

Fields§

§is_template: bool§function_generics: Vec<Type>§type_generics: Vec<Type>

Implementations§

Source§

impl Function

Source

pub fn new( name: String, return_type: Type, args: Vec<VariableDeclaration>, body: Vec<StmtNode>, is_extern: bool, ) -> Self

Source

pub fn name(&self) -> String

Source

pub fn body(&self) -> &Vec<StmtNode>

Source

pub fn mut_body(&mut self) -> &mut Vec<StmtNode>

Source

pub fn args(&self) -> &Vec<VariableDeclaration>

Source

pub fn args_mut(&mut self) -> &mut Vec<VariableDeclaration>

Source

pub fn return_type(&self) -> &Type

Source

pub fn with_function_generics(self, list: Vec<Type>) -> Self

Source

pub fn with_vararg(self, is_vararg: bool) -> Self

Source

pub fn is_vararg(&self) -> bool

Source

pub fn set_vararg(&mut self, is_vararg: bool)

Source

pub fn set_closure(&mut self, is_closure: bool)

Source

pub fn with_extern(self, is_extern: bool) -> Self

Source

pub fn with_template(self, is_template: bool) -> Self

Source

pub fn add_function_generic(&mut self, g: Type)

Source

pub fn args_count(&self) -> usize

Source

pub fn has_binding(&self) -> bool

Source

pub fn get_binding(&self) -> String

Source

pub fn insert_arg(&mut self, index: usize, vd: VariableDeclaration)

Source

pub fn set_binding_type(&mut self, binding_struct: impl Into<String>)

Source

pub fn set_name(&mut self, name: String)

Source

pub fn set_body(&mut self, body: Vec<StmtNode>)

Source

pub fn with_return_type(self, return_type: Type) -> Self

Source

pub fn set_return_type(&mut self, return_type: Type)

Source

pub fn with_name(self, name: String) -> Self

Source

pub fn with_args(self, args: Vec<VariableDeclaration>) -> Self

Source

pub fn get_param_type(&self, index: usize) -> Option<Type>

Source

pub fn get_type(&self) -> Type

Source

pub fn set_template(&mut self, is_template: bool)

Source

pub fn set_type_generics(&mut self, type_generics: Vec<Type>)

Source

pub fn self_type(&self) -> &SelfType

获取方法的self参数类型

Source

pub fn set_self_type(&mut self, self_type: SelfType)

设置方法的self参数类型

Source

pub fn with_self_type(self, self_type: SelfType) -> Self

链式设置方法的self参数类型

Source

pub fn has_self(&self) -> bool

检查方法是否有self参数

Trait Implementations§

Source§

impl Clone for Function

Source§

fn clone(&self) -> Function

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Function

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Function

Source§

fn default() -> Self

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

impl NodeTrait for Function

Source§

fn get_id(&self) -> &str

Source§

fn get_data(&self, key: &str) -> Option<Data>

Source§

fn set_data(&mut self, key: &str, value: Data)

Source§

fn get_children(&self) -> Vec<&dyn NodeTrait>

Source§

fn get_mut_children(&mut self) -> Vec<&mut dyn NodeTrait>

Source§

fn get_extra(&self) -> &HashMap<String, Box<dyn Any>>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.