Skip to main content

luaur_ast/records/
cst_node.rs

1//! Faithful port of Luau `CstNode` — the base of every concrete-syntax-tree
2//! node (`Ast/include/Luau/Cst.h`).
3//!
4//! The CST mirror of `AstNode`: `{ const int classIndex }` plus the
5//! `is<T>()`/`as<T>()` RTTI helpers (here keyed on `CstClassIndex()`). Unlike
6//! `AstNode` it carries no `Location` (trivia/offsets live in the concrete
7//! nodes). `#[repr(C)]` with `base` first on each `CstX : CstNode` keeps the
8//! base at offset 0 so the downcast in [`crate::rtti`] is a pointer cast.
9
10#[repr(C)]
11#[derive(Debug, Clone)]
12pub struct CstNode {
13    pub class_index: i32,
14}