コード例 #1
0
ファイル: be_generator.cpp プロジェクト: handsomett/ATCD
AST_UnionBranch *
be_generator::create_union_branch (UTL_LabelList *ll,
                                   AST_Type *ft,
                                   UTL_ScopedName *n)
{
  be_union_branch *retval = 0;
  ACE_NEW_RETURN (retval,
                  be_union_branch (ll,
                                   ft,
                                   n),
                  0);

  return retval;
}
コード例 #2
0
int
be_visitor_xplicit_pre_proc::visit_union_branch (
  be_union_branch *node)
{
  be_type *ft =
    be_type::narrow_from_decl (node->field_type ());

  this->ref_type_ = true;

  if (ft->accept (this) != 0)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_xplicit_pre_proc::")
                         ACE_TEXT ("visit_union_branch - code generation ")
                         ACE_TEXT ("for branch type failed\n")),
                        -1);
    }

  this->ref_type_ = false;

  AST_Type *bt =
    AST_Type::narrow_from_decl (this->type_holder_);

  UTL_ScopedName sn (node->local_name (), 0);

  // The union branch owns its label list so we have to copy it.
  UTL_LabelList *ll = node->labels ()->copy ();

  be_union_branch *added_branch = 0;
  ACE_NEW_RETURN (added_branch,
                  be_union_branch (ll, bt, &sn),
                  -1);

  // fe_add_union_branch() does necessary things besides calling
  // add_to_scope() so we need to reuse it.

  be_union *u =
    be_union::narrow_from_scope (idl_global->scopes ().top ());

  u->be_add_union_branch (added_branch);

  return 0;
}