[206] | 1 | #include "stdafx.h"
|
---|
| 2 |
|
---|
[382] | 3 | bool UserProc::IsEqualForOverride( const Types &actualTypeParametersForThisProc, const UserProc *pUserProc ) const
|
---|
| 4 | {
|
---|
| 5 | if( this->GetName() == pUserProc->GetName() // 名前空間及び名前が等しい
|
---|
[383] | 6 | && this->Params().Equals( actualTypeParametersForThisProc, pUserProc->Params() ) ) // パラメータが等しい
|
---|
[382] | 7 | {
|
---|
| 8 | if( this->returnType.Equals( pUserProc->returnType ) )
|
---|
| 9 | {
|
---|
| 10 | // 戻り値が等しい
|
---|
| 11 | return true;
|
---|
| 12 | }
|
---|
[447] | 13 | else if( this->returnType.IsCovariant( pUserProc->returnType ) )
|
---|
[382] | 14 | {
|
---|
[447] | 15 | // 戻り値が共変
|
---|
| 16 | return true;
|
---|
| 17 | }
|
---|
| 18 | else if( this->returnType.IsTypeParameter() )
|
---|
| 19 | {
|
---|
[382] | 20 | // 型パラメータだったとき
|
---|
[447] | 21 |
|
---|
[382] | 22 | if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].Equals( pUserProc->returnType ) )
|
---|
| 23 | {
|
---|
| 24 | // 戻り値が等しい
|
---|
| 25 | return true;
|
---|
| 26 | }
|
---|
[447] | 27 | else if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].IsCovariant( pUserProc->returnType ) )
|
---|
| 28 | {
|
---|
| 29 | // 戻り値が共変
|
---|
| 30 | return true;
|
---|
| 31 | }
|
---|
[382] | 32 | }
|
---|
| 33 | }
|
---|
| 34 | return false;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 |
|
---|
[206] | 38 | std::string UserProc::GetFullName() const
|
---|
| 39 | {
|
---|
| 40 | if( HasParentClass() ){
|
---|
| 41 | return GetParentClass().GetName() + "." + GetName();
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | return GetName();
|
---|
| 45 | }
|
---|
[350] | 46 | bool UserProc::IsCastOperator() const
|
---|
| 47 | {
|
---|
| 48 | if( GetName()[0] == 1 && GetName()[1] == ESC_OPERATOR && GetName()[2] == CALC_AS )
|
---|
| 49 | {
|
---|
| 50 | return true;
|
---|
| 51 | }
|
---|
| 52 | return false;
|
---|
| 53 | }
|
---|
[206] | 54 | const NamespaceScopes &UserProc::GetNamespaceScopes() const
|
---|
| 55 | {
|
---|
| 56 | if( HasParentClass() ){
|
---|
| 57 | return GetParentClassPtr()->GetNamespaceScopes();
|
---|
| 58 | }
|
---|
[208] | 59 | return Symbol::GetNamespaceScopes();
|
---|
[206] | 60 | }
|
---|
| 61 | const NamespaceScopesCollection &UserProc::GetImportedNamespaces() const
|
---|
| 62 | {
|
---|
[306] | 63 | if( pParentClass )
|
---|
| 64 | {
|
---|
| 65 | return pParentClass->GetImportedNamespaces();
|
---|
| 66 | }
|
---|
[206] | 67 | return importedNamespaces;
|
---|
| 68 | }
|
---|
| 69 | bool UserProc::IsVirtual() const
|
---|
| 70 | {
|
---|
| 71 | if( pMethod == NULL ){
|
---|
| 72 | return false;
|
---|
| 73 | }
|
---|
| 74 | return ( pMethod->IsVirtual() != 0 );
|
---|
| 75 | }
|
---|
[336] | 76 | const CMethod &UserProc::GetMethod() const
|
---|
| 77 | {
|
---|
| 78 | if( !HasParentClass() )
|
---|
| 79 | {
|
---|
| 80 | Jenga::Throw( "グローバル関数に対してUserProc::GetMethodメソッドが呼ばれた" );
|
---|
| 81 | }
|
---|
| 82 | return *pMethod;
|
---|
| 83 | }
|
---|
[206] | 84 |
|
---|
[364] | 85 | const UserProc *UserProc::pGlobalProc = NULL;
|
---|
[206] | 86 |
|
---|
| 87 |
|
---|
[576] | 88 | void UserProcs::EnumGlobalProcs( const char *simpleName, const Symbol &localSymbol, std::vector<const UserProc *> &subs )
|
---|
[184] | 89 | {
|
---|
[206] | 90 | ///////////////////////////
|
---|
| 91 | // グローバル関数を検索
|
---|
| 92 | ///////////////////////////
|
---|
[184] | 93 |
|
---|
[206] | 94 | // ハッシュ値を取得
|
---|
| 95 | UserProc *pUserProc = GetHashArrayElement( simpleName );
|
---|
| 96 | while(pUserProc){
|
---|
[208] | 97 | if( pUserProc->IsGlobalProcedure() ){
|
---|
[576] | 98 | if( pUserProc->IsEqualSymbol( localSymbol ) ){
|
---|
[206] | 99 | subs.push_back( pUserProc );
|
---|
| 100 | }
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | pUserProc=pUserProc->GetChainNext();
|
---|
| 104 | }
|
---|
[184] | 105 | }
|
---|
| 106 |
|
---|
[206] | 107 | void ProcPointers::Clear()
|
---|
[184] | 108 | {
|
---|
[206] | 109 | ProcPointers &procPointers = *this;
|
---|
[184] | 110 | BOOST_FOREACH( ProcPointer *pProcPointer, procPointers ){
|
---|
| 111 | delete pProcPointer;
|
---|
| 112 | }
|
---|
| 113 | this->clear();
|
---|
| 114 | }
|
---|