2 //=============================================================================
4 * @file discriminant_cs.cpp
6 * Visitor generating code for discriminant of the union
8 * @author Aniruddha Gokhale
10 //=============================================================================
14 be_visitor_union_discriminant_cs::be_visitor_union_discriminant_cs (
15 be_visitor_context
*ctx
17 : be_visitor_decl (ctx
)
21 be_visitor_union_discriminant_cs::~be_visitor_union_discriminant_cs ()
26 be_visitor_union_discriminant_cs::visit_enum (be_enum
*node
)
29 dynamic_cast<be_union
*> (this->ctx_
->node ());
30 be_type
*bt
= nullptr;
32 if (this->ctx_
->alias ())
34 bt
= this->ctx_
->alias ();
41 if (bt
->node_type () != AST_Decl::NT_typedef
44 // Instantiate a visitor context with a copy of our context. This info
45 // will be modified based on what type of node we are visiting.
46 be_visitor_context
ctx (*this->ctx_
);
49 // generate the typecode for the enum
50 be_visitor_enum_cs
visitor (&ctx
);
52 if (node
->accept (&visitor
) == -1)
54 ACE_ERROR_RETURN ((LM_ERROR
,
55 "(%N:%l) be_visitor_union_discriminant_cs::"