pub struct Function {
pub name: Option<Ident>,
pub params: Vec<Pattern>,
pub body: FunctionBody,
pub is_async: bool,
pub is_generator: bool,
pub strict: bool,
pub is_arrow: bool,
pub span: Span,
pub params_span: Span,
}Expand description
A function in any of its forms (declaration, expression, arrow, method).
Fields§
§name: Option<Ident>Name: required for declarations, optional for expressions and arrows.
params: Vec<Pattern>Parameters, in source order; a rest parameter is [Pattern::Rest].
body: FunctionBodyBody.
is_async: boolasync
is_generator: boolfunction* / *method / async function*
strict: boolWhether the body is strict: either an enclosing strict context or the
function’s own "use strict" directive.
Recorded per function because strictness is not a property of the source but of
the enclosing context: a "use strict" inside one function body leaves the code
after it sloppy, so the compiler cannot infer a body’s mode from the program’s.
is_arrow: bool=>
span: SpanSource range.
params_span: SpanRange of the parameter list, for error messages and length.
Trait Implementations§
impl StructuralPartialEq for Function
Auto Trait Implementations§
impl Forget for Function
impl Freeze for Function
impl Move for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnsafeUnpin for Function
impl UnwindSafe for Function
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more