pub struct FunctionIR {Show 13 fields
pub name: String,
pub span: SpanIR,
pub body_span: SpanIR,
pub signature_span: SpanIR,
pub is_async: bool,
pub is_generator: bool,
pub is_exported: bool,
pub is_default_export: bool,
pub type_params: Vec<TypeParamIR>,
pub params: Vec<FunctionParamIR>,
pub return_type_src: String,
pub body_src: String,
pub decorators: Vec<DecoratorIR>,
}Expand description
IR representation of a TypeScript function declaration.
Covers function, async function, function*, and exported variants.
Arrow functions and function expressions are NOT represented here: they
are expressions, not items, and have no natural place for a JSDoc decorator.
§Spans
export async function foo<T>(x: T, y: number): Promise<T> { return x; }
╰─────────────────────── span ──────────────────────────────────────────╯
╰──────────── signature_span ─────────────────────────╯
╰─ body_span ─╯span: entire declaration including leadingexport/asynckeywords through the closing}.signature_span: everything before the body’s opening{.body_span: the{ … }block (inclusive of braces).
Fields§
§name: StringThe function name.
span: SpanIRSpan of the entire declaration.
body_span: SpanIRSpan of the body { … } block (inclusive of braces).
signature_span: SpanIRSpan of everything before the opening {.
is_async: boolWhether the function is async.
is_generator: boolWhether the function is a generator (function*).
is_exported: boolWhether the function has an export keyword.
is_default_export: boolWhether the function is export default.
type_params: Vec<TypeParamIR>Generic type parameters as declared.
params: Vec<FunctionParamIR>Formal parameters.
return_type_src: StringReturn type annotation as source string (e.g., "Promise<T>").
Empty string if no explicit return type.
body_src: StringRaw source of the body (between but not including the braces).
decorators: Vec<DecoratorIR>Decorators applied to this function (JSDoc or native).
Trait Implementations§
Source§impl Clone for FunctionIR
impl Clone for FunctionIR
Source§impl Debug for FunctionIR
impl Debug for FunctionIR
Source§impl<'de> Deserialize<'de> for FunctionIR
impl<'de> Deserialize<'de> for FunctionIR
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FunctionIR
impl PartialEq for FunctionIR
Source§impl Serialize for FunctionIR
impl Serialize for FunctionIR
impl StructuralPartialEq for FunctionIR
Auto Trait Implementations§
impl Forget for FunctionIR
impl Freeze for FunctionIR
impl Move for FunctionIR
impl RefUnwindSafe for FunctionIR
impl Send for FunctionIR
impl Sync for FunctionIR
impl Unpin for FunctionIR
impl UnsafeUnpin for FunctionIR
impl UnwindSafe for FunctionIR
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more