CTD TypeCommonDerivation( // GET COMMON TYPE DERIVATION FOR TWO TYPES TYPE type1, // - type [1] (left) TYPE type2 ) // - type [2] (right) { CTD retn; // - return: CTD_... SCOPE scope1; // - scope for type[1] SCOPE scope2; // - scope for type[2] retn = CTD_NO; scope1 = TypeScope( StructType( type1 ) ); if( NULL != scope1 ) { scope2 = TypeScope( StructType( type2 ) ); if( scope1 == scope2 ) { retn = CTD_LEFT; } else if( NULL != scope2 ) { switch( ScopeDerived( scope1, scope2 ) ) { case DERIVED_YES : retn = CTD_LEFT; break; case DERIVED_YES_BUT_VIRTUAL : retn = CTD_LEFT_VIRTUAL; break; case DERIVED_YES_BUT_AMBIGUOUS : retn = CTD_LEFT_AMBIGUOUS; break; case DERIVED_YES_BUT_PRIVATE : retn = CTD_LEFT_PRIVATE; break; case DERIVED_YES_BUT_PROTECTED : retn = CTD_LEFT_PROTECTED; break; case DERIVED_NO : switch( ScopeDerived( scope2, scope1 ) ) { case DERIVED_YES : retn = CTD_RIGHT; break; case DERIVED_YES_BUT_VIRTUAL : retn = CTD_RIGHT_VIRTUAL; break; case DERIVED_YES_BUT_AMBIGUOUS : retn = CTD_RIGHT_AMBIGUOUS; break; case DERIVED_YES_BUT_PRIVATE : retn = CTD_RIGHT_PRIVATE; break; case DERIVED_YES_BUT_PROTECTED : retn = CTD_RIGHT_PROTECTED; break; case DERIVED_NO : retn = CTD_NO; break; } } } } return( retn ); }
void ScopeGenAccessSet( // SET ACCESS SCOPE FOR GENERATION TYPE cltype ) // - type for inlining { DbgVerify( tempScope == NULL, "ScopeAccessSet -- tempScope != NULL" ); tempScope = GetCurrScope(); SetCurrScope (TypeScope( cltype )); }
SYMBOL CgBackOpDelete( // GET ADDRESIBLE OPERATOR DELETE FOR A TYPE TYPE type ) // - the type { SEARCH_RESULT* result; // - lookup result SYMBOL op_del; // - operator delete result = ScopeFindNaked( TypeScope( type ), CppOperatorName( CO_DELETE ) ); op_del = ClassFunMakeAddressable( result->sym_name->name_syms ); ScopeFreeResult( result ); return op_del; }
static bool validateBase( // VALIDATE BASE CLASS OK SCOPE base_scope, // - scope for base class THROW_CNV_CTL *ctl ) // - control area { bool retb; // - true ==> generate conversion SCOPE thr_scope; // - scope for throw retb = false; thr_scope = TypeScope( ctl->src_type ); switch( ScopeDerived( thr_scope, base_scope ) ) { DbgDefault( "validateBase -- impossible derived type" ); case DERIVED_YES : case DERIVED_YES_BUT_VIRTUAL : ctl->offset = ThrowBaseOffset( thr_scope, base_scope ); retb = true; break; case DERIVED_YES_BUT_AMBIGUOUS : case DERIVED_YES_BUT_PRIVATE : case DERIVED_YES_BUT_PROTECTED : break; } return( retb ); }
static void typeSigAccess( // HANDLE ACCESS FOR TYPE-SIGNATURE TYPE_SIG_ACCESS acc, // - access type TYPE_SIG *sig, // - current signature TOKEN_LOCN* err_locn, // - error location for access errors bool *error_occurred ) // - to set error indication { ACCINFO info; // - access information if( (TSA_GEN & acc) == 0 ) { info.acc = acc; info.type = StructType( sig->type ); if( info.type != NULL ) { info.err_occurred = error_occurred; info.err_locn = err_locn; info.access_scope = GetCurrScope(); info.class_scope = TypeScope( info.type ); typeSigAccessVar( TSA_DTOR, &sig->dtor, &info ); typeSigAccessVar( TSA_DEFAULT_CTOR, &sig->default_ctor, &info ); typeSigAccessVar( TSA_COPY_CTOR, &sig->copy_ctor, &info ); SetCurrScope(info.access_scope); } } }
static SCOPE scope_for_ptr( // GET SCOPE FOR CLASS POINTED AT TYPE type ) // - pointer type { return( TypeScope( type_pointed_to( type ) ) ); }