#include "stdafx.h" bool UserProc::IsEqualForOverride( const Types &actualTypeParametersForThisProc, const UserProc *pUserProc ) const { if( this->GetName() == pUserProc->GetName() // 名前空間及び名前が等しい && this->Params().Equals( actualTypeParametersForThisProc, pUserProc->Params() ) ) // パラメータが等しい { if( this->returnType.Equals( pUserProc->returnType ) ) { // 戻り値が等しい return true; } else if( this->returnType.IsCovariant( pUserProc->returnType ) ) { // 戻り値が共変 return true; } else if( this->returnType.IsTypeParameter() ) { // 型パラメータだったとき if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].Equals( pUserProc->returnType ) ) { // 戻り値が等しい return true; } else if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].IsCovariant( pUserProc->returnType ) ) { // 戻り値が共変 return true; } } } return false; } std::string UserProc::GetFullName() const { if( HasParentClass() ){ return GetParentClass().GetName() + "." + GetName(); } return GetName(); } bool UserProc::IsCastOperator() const { if( GetName()[0] == 1 && GetName()[1] == ESC_OPERATOR && GetName()[2] == CALC_AS ) { return true; } return false; } const NamespaceScopes &UserProc::GetNamespaceScopes() const { if( HasParentClass() ){ return GetParentClassPtr()->GetNamespaceScopes(); } return Symbol::GetNamespaceScopes(); } const NamespaceScopesCollection &UserProc::GetImportedNamespaces() const { if( pParentClass ) { return pParentClass->GetImportedNamespaces(); } return importedNamespaces; } bool UserProc::IsVirtual() const { if( pMethod == NULL ){ return false; } return ( pMethod->IsVirtual() != 0 ); } const CMethod &UserProc::GetMethod() const { if( !HasParentClass() ) { Jenga::Throw( "グローバル関数に対してUserProc::GetMethodメソッドが呼ばれた" ); } return *pMethod; } const UserProc *UserProc::pGlobalProc = NULL; void UserProcs::EnumGlobalProcs( const char *simpleName, const Symbol &localSymbol, std::vector &subs ) { /////////////////////////// // グローバル関数を検索 /////////////////////////// // ハッシュ値を取得 UserProc *pUserProc = GetHashArrayElement( simpleName ); while(pUserProc){ if( pUserProc->IsGlobalProcedure() ){ if( pUserProc->IsEqualSymbol( localSymbol ) ){ subs.push_back( pUserProc ); } } pUserProc=pUserProc->GetChainNext(); } } void ProcPointers::Clear() { ProcPointers &procPointers = *this; BOOST_FOREACH( ProcPointer *pProcPointer, procPointers ){ delete pProcPointer; } this->clear(); }