Skip to main content

luaur_analysis/methods/
node_node.rs

1//! Faithful port of `Luau::detail::Node::Node`
2//! (`Analysis/src/TopoSortStatements.cpp:83-87`).
3//!
4//! ```cpp
5//! Node(const std::optional<Identifier>& name, AstStat* el)
6//!     : name(name)
7//!     , element(el)
8//! {
9//! }
10//! ```
11//!
12//! The constructor only member-initializes `name` and `element`; the inherited
13//! `Arcs` sets (`provides` / `depends`) are value-initialized empty. This
14//! in-place initializer assigns those two members; the empty sets are produced
15//! by [`Node::new`](crate::records::node::Node::new) at allocation. Construction
16//! in `toposort` goes through `Node::new`, which mirrors this body exactly.
17use crate::records::identifier::Identifier;
18use crate::records::node::Node;
19use luaur_ast::records::ast_stat::AstStat;
20
21impl Node {
22    pub fn node(&mut self, name: Option<Identifier>, el: *mut AstStat) {
23        self.name = name;
24        self.element = el;
25    }
26}