gbf_core/decompiler/ast/
vbranch.rs1#![deny(missing_docs)]
2
3use gbf_macros::AstNodeTransform;
4use serde::{Deserialize, Serialize};
5
6use crate::decompiler::structure_analysis::region::RegionId;
7
8use super::{AstKind, AstVisitable, ptr::P, statement::StatementKind, visitors::AstVisitor};
9
10#[derive(Debug, Clone, Serialize, Deserialize, Eq, AstNodeTransform)]
12#[convert_to(StatementKind::VirtualBranch, AstKind::Statement)]
13pub struct VirtualBranchNode {
14 pub branch: RegionId,
16}
17
18impl VirtualBranchNode {
19 pub fn new(branch: RegionId) -> Self {
21 Self { branch }
22 }
23
24 pub fn branch(&self) -> RegionId {
26 self.branch
27 }
28}
29
30impl AstVisitable for P<VirtualBranchNode> {
31 fn accept<V: AstVisitor>(&self, visitor: &mut V) -> V::Output {
32 visitor.visit_virtual_branch(self)
33 }
34}
35
36impl PartialEq for VirtualBranchNode {
38 fn eq(&self, other: &Self) -> bool {
39 self.branch == other.branch
40 }
41}