pub struct Function {
pub is_py_type: bool,
pub name: StringName,
pub self_mutable: Option<bool>,
pub pure: bool,
pub arguments: Vec<FunctionArg>,
pub raises: Name,
pub in_class: Option<StringName>,
pub ret_ty: Name,
}
Expand description
A Function, which may either be top-level, or optionally within a class.
May return any Name within ret_ty. May raise any Name within raises.
Fields§
§is_py_type: bool
§name: StringName
§self_mutable: Option<bool>
§pure: bool
§arguments: Vec<FunctionArg>
§raises: Name
§in_class: Option<StringName>
§ret_ty: Name
Implementations§
source§impl Function
impl Function
pub fn args_compatible(
&self,
args: &[Name],
ctx: &Context,
pos: Position
) -> TypeResult<()>
pub fn simple_fun(
name: &StringName,
self_arg: &Name,
ret_ty: &Name,
pos: Position
) -> TypeResult<Function>
Trait Implementations§
source§impl GetFun<Function> for Class
impl GetFun<Function> for Class
source§fn fun(
&self,
name: &StringName,
ctx: &Context,
pos: Position
) -> TypeResult<Function>
fn fun(
&self,
name: &StringName,
ctx: &Context,
pos: Position
) -> TypeResult<Function>
Get function of class.
If class does not implement function, traverse parents until function found.
source§impl LookupFunction<&StringName, Function> for Context
impl LookupFunction<&StringName, Function> for Context
source§fn function(&self, function: &StringName, pos: Position) -> TypeResult<Function>
fn function(&self, function: &StringName, pos: Position) -> TypeResult<Function>
Look up a function and substitutes generics to yield a Function.
If function does not exist, treat function as constructor and see if there exists a class with the same true_name.