Skip to main content

luaur_ast/records/
ast_attr.rs

1//! Faithful port of Luau `AstAttr : AstNode` (`Ast/include/Luau/Ast.h`).
2//!
3//! Hand-ported (the scheduler false-blocks it: its nested `Type` enum resolves
4//! by bare name to an unrelated `Type` in `Lexer.h`). The nested
5//! `enum Type { Checked, Native, Deprecated, DebugNoinline, Unknown }` is
6//! inlined here as `AstAttrType` (matching how the other nested AST enums live
7//! in their owner's record file). `DeprecatedInfo` is its own already-translated
8//! record; the `deprecatedInfo()`/`visit`/`as_attr` methods are separate items.
9
10use crate::records::ast_array::AstArray;
11use crate::records::ast_expr::AstExpr;
12use crate::records::ast_name::AstName;
13use crate::records::ast_node::AstNode;
14
15/// C++ `AstAttr::Type`.
16#[repr(i32)]
17#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
18pub enum AstAttrType {
19    Checked,
20    Native,
21    Deprecated,
22    DebugNoinline,
23    Unknown,
24}
25
26#[repr(C)]
27#[derive(Debug, Clone)]
28pub struct AstAttr {
29    pub base: AstNode,
30    pub r#type: AstAttrType,
31    pub args: AstArray<*mut AstExpr>,
32    pub name: AstName,
33}
34
35impl crate::rtti::AstNodeClass for AstAttr {
36    const CLASS_INDEX: i32 = crate::rtti::ast_rtti_index("AstAttr");
37}