unsigned long be_sequence::isRecursive () { UTL_Scope * scope = 0; be_Type * btype = 0; AST_Decl * adecl = (AST_Decl *)this->narrow((long) & AST_Decl::type_id); assert(adecl); be_Type * base = (be_Type *)base_type()->narrow((long) & be_Type::type_id); assert(base); unsigned long offset = 1; for ( offset = 1; adecl && (scope = adecl->defined_in()) && (btype = (be_Type *)scope->narrow((long) & be_Type::type_id)); ++offset ) { adecl = (AST_Decl *)scope->narrow((long) & AST_Decl::type_id); if (btype->TypeCodeTypeName() == base->TypeCodeTypeName()) { break; } } if (scope && btype) { return offset; } return 0; }
DDS_StdString be_Type::EnclosingScopeString(AST_Decl * decl) { DDS_StdString ret; assert(decl); if (decl) { UTL_Scope * enclosingScope = decl->defined_in(); AST_Decl * enclosingDecl; if (enclosingScope) { if ((enclosingDecl = (AST_Decl*)enclosingScope->narrow((long) & AST_Decl::type_id))) { ret = NameToString(enclosingDecl->name(), 0); } else { DDSError((DDS_StdString)"Can't narrow enclosing scope for " + NameToString(decl->name(), 0)); } } } return ret; }