Skip to main content

luaur_ast/records/
ast_expr_function.rs

1//! Faithful port of Luau `AstExprFunction : AstExpr` (`Ast/include/Luau/Ast.h`).
2//!
3//! Hand-ported (false-blocked via the bare-name `AstAttr::Type` resolution).
4//! `AstLocal* self` -> `self_` (Rust keyword). `std::optional<Location>` ->
5//! `Option<Location>`. The two constructors and the
6//! `has_native_attribute`/`has_attribute`/`get_attribute`/`visit` methods are
7//! separate items.
8
9use crate::records::ast_array::AstArray;
10use crate::records::ast_attr::AstAttr;
11use crate::records::ast_expr::AstExpr;
12use crate::records::ast_generic_type::AstGenericType;
13use crate::records::ast_generic_type_pack::AstGenericTypePack;
14use crate::records::ast_local::AstLocal;
15use crate::records::ast_name::AstName;
16use crate::records::ast_stat_block::AstStatBlock;
17use crate::records::ast_type_pack::AstTypePack;
18use crate::records::location::Location;
19
20#[repr(C)]
21#[derive(Debug, Clone)]
22pub struct AstExprFunction {
23    pub base: AstExpr,
24    pub attributes: AstArray<*mut AstAttr>,
25    pub generics: AstArray<*mut AstGenericType>,
26    pub generic_packs: AstArray<*mut AstGenericTypePack>,
27    pub self_: *mut AstLocal,
28    pub args: AstArray<*mut AstLocal>,
29    pub return_annotation: *mut AstTypePack,
30    pub vararg: bool,
31    pub vararg_location: Location,
32    pub vararg_annotation: *mut AstTypePack,
33    pub body: *mut AstStatBlock,
34    pub function_depth: usize,
35    pub debugname: AstName,
36    pub arg_location: Option<Location>,
37}
38
39impl crate::rtti::AstNodeClass for AstExprFunction {
40    const CLASS_INDEX: i32 = crate::rtti::ast_rtti_index("AstExprFunction");
41}