gbf_core/decompiler/ast/
new_array.rs1#![deny(missing_docs)]
2
3use gbf_macros::AstNodeTransform;
4use serde::{Deserialize, Serialize};
5
6use super::{AstKind, AstVisitable, expr::ExprKind, ptr::P, visitors::AstVisitor};
7
8#[derive(Debug, Clone, Serialize, Deserialize, Eq, AstNodeTransform)]
10#[convert_to(ExprKind::NewArray, AstKind::Expression)]
11pub struct NewArrayNode {
12 pub arg: ExprKind,
14}
15
16impl NewArrayNode {
17 pub fn new(arg: ExprKind) -> Self {
25 Self { arg }
26 }
27}
28
29impl AstVisitable for P<NewArrayNode> {
30 fn accept<V: AstVisitor>(&self, visitor: &mut V) -> V::Output {
31 visitor.visit_new_array(self)
32 }
33}
34
35impl PartialEq for NewArrayNode {
37 fn eq(&self, other: &Self) -> bool {
38 self.arg == other.arg
39 }
40}