gbf_core/decompiler/ast/
range.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::Range, AstKind::Expression)]
11pub struct RangeNode {
12 pub start: ExprKind,
14 pub end: ExprKind,
16}
17
18impl RangeNode {
19 pub fn new(start: ExprKind, end: ExprKind) -> Self {
28 Self { start, end }
29 }
30}
31
32impl AstVisitable for P<RangeNode> {
33 fn accept<V: AstVisitor>(&self, visitor: &mut V) -> V::Output {
34 visitor.visit_range(self)
35 }
36}
37
38impl PartialEq for RangeNode {
40 fn eq(&self, other: &Self) -> bool {
41 self.start == other.start && self.end == other.end
42 }
43}