AST_Array * be_generator::create_array (UTL_ScopedName *n, ACE_CDR::ULong ndims, UTL_ExprList *dims, bool is_local, bool is_abstract) { be_array *retval = 0; ACE_NEW_RETURN (retval, be_array (n, ndims, dims, is_local, is_abstract), 0); return retval; }
int be_visitor_xplicit_pre_proc::visit_array (be_array *node) { be_type *bt = be_type::narrow_from_decl (node->base_type ()); bool tmp = this->ref_type_; this->ref_type_ = true; if (bt->accept (this) != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("be_visitor_xplicit_pre_proc::") ACE_TEXT ("visit_array - code generation ") ACE_TEXT ("for base type failed\n")), -1); } this->ref_type_ = tmp; AST_Expression *v = 0; UTL_ExprList *v_list = 0; for (ACE_CDR::ULong i = 0; i < node->n_dims (); ++i) { ACE_NEW_RETURN (v, AST_Expression (node->dims ()[i], AST_Expression::EV_ulong), -1); UTL_ExprList *el = 0; ACE_NEW_RETURN (el, UTL_ExprList (v, 0), -1); if (v_list == 0) { v_list = el; } else { v_list->nconc (el); } } UTL_ScopedName sn (node->local_name (), 0); be_array *added_array = 0; ACE_NEW_RETURN (added_array, be_array (&sn, node->n_dims (), v_list, false, false), -1); // No need to add this new node to any scope - it's anonymous // and owned by the node that references it. if (v_list != 0) { v_list->destroy (); delete v_list; v_list = 0; } AST_Type *base_type = AST_Type::narrow_from_decl (this->type_holder_); added_array->set_base_type (base_type); this->type_holder_ = added_array; return 0; }