Changeset 383 in dev for trunk/abdev/BasicCompiler_Common


Ignore:
Timestamp:
Jan 2, 2008, 1:21:43 AM (16 years ago)
Author:
dai_9181
Message:

ジェネリクスインターフェイス実装時のオーバーロード解決ロジックを改良。(型パラメータを引数に持つメソッドのオーバーロードをミスしてしまうバグを修正)

Location:
trunk/abdev/BasicCompiler_Common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/include/Parameter.h

    r325 r383  
    8585    }
    8686
    87     bool Equals( const Parameter &param ) const
    88     {
    89         if( Type::Equals( param ) ){
    90             return true;
    91         }
    92         else{
    93 
    94             if( this->isRef && this->GetBasicType() == DEF_ANY &&
    95                 param.isRef == false && param.IsPointer()
    96                 ||
    97                 this->isRef == false && this->IsPointer() &&
    98                 param.isRef && param.GetBasicType() == DEF_ANY ){
    99                     /* ByRef var As Any
    100                             と
    101                         var As VoidPtr
    102                         は同等
    103                     */
    104                     return true;
    105             }
    106         }
    107 
    108         return false;
    109     }
     87    bool Equals( const Parameter &param ) const;
     88    bool Equals( const Types &actualTypeParametersForThisProc, const Parameter &param ) const;
    11089};
    11190
     
    124103public:
    125104
    126     bool Equals( const Parameters &params ) const
    127     {
    128         if( this->size() != params.size() ){
    129             return false;
    130         }
    131 
    132         int max = (int)this->size();
    133         for( int i=0; i<max; i++ ){
    134             if( !(*this)[i]->Equals( *params[i] ) ){
    135                 return false;
    136             }
    137         }
    138 
    139         return true;
    140     }
     105    bool Equals( const Parameters &params ) const;
     106    bool Equals( const Types &actualTypeParametersForThisProc, const Parameters &params ) const;
    141107
    142108    int GetMemorySize() const
  • trunk/abdev/BasicCompiler_Common/include/ver.h

    r380 r383  
    66// バージョン付加文字列
    77#ifdef _AMD64_
    8 #define VER_INFO        "(x64) (rev.396)"
     8#define VER_INFO        "(x64) (rev.397)"
    99#else
    10 #define VER_INFO        "(rev.396)"
     10#define VER_INFO        "(rev.397)"
    1111#endif
  • trunk/abdev/BasicCompiler_Common/src/Parameter.cpp

    r325 r383  
    11#include "stdafx.h"
    22
     3
     4bool Parameter::Equals( const Parameter &param ) const
     5{
     6    if( Type::Equals( param ) )
     7    {
     8        return true;
     9    }
     10    else
     11    {
     12        if( this->isRef && this->GetBasicType() == DEF_ANY &&
     13            param.isRef == false && param.IsPointer()
     14            ||
     15            this->isRef == false && this->IsPointer() &&
     16            param.isRef && param.GetBasicType() == DEF_ANY )
     17        {
     18            /* ByRef var As Any
     19                    と
     20                var As VoidPtr
     21                は同等
     22            */
     23            return true;
     24        }
     25    }
     26
     27    return false;
     28}
     29bool Parameter::Equals( const Types &actualTypeParametersForThisProc, const Parameter &param ) const
     30{
     31    if( Equals( param ) )
     32    {
     33        return true;
     34    }
     35   
     36    if( this->IsTypeParameter() )
     37    {
     38        // 型パラメータだったとき
     39        if( actualTypeParametersForThisProc[this->GetFormalTypeIndex()].Equals( param ) )
     40        {
     41            // 戻り値が等しい
     42            return true;
     43        }
     44    }
     45
     46    return false;
     47}
     48
     49bool Parameters::Equals( const Parameters &params ) const
     50{
     51    if( this->size() != params.size() ){
     52        return false;
     53    }
     54
     55    int max = (int)this->size();
     56    for( int i=0; i<max; i++ ){
     57        if( !(*this)[i]->Equals( *params[i] ) ){
     58            return false;
     59        }
     60    }
     61
     62    return true;
     63}
     64bool Parameters::Equals( const Types &actualTypeParametersForThisProc, const Parameters &params ) const
     65{
     66    if( this->size() != params.size() ){
     67        return false;
     68    }
     69
     70    int max = (int)this->size();
     71    for( int i=0; i<max; i++ ){
     72        if( !(*this)[i]->Equals( actualTypeParametersForThisProc, *params[i] ) ){
     73            return false;
     74        }
     75    }
     76
     77    return true;
     78}
    379
    480bool Parameters::Analyze( const char *sourceOfParams, int nowLine )
  • trunk/abdev/BasicCompiler_Common/src/Procedure.cpp

    r382 r383  
    2020{
    2121    if( this->GetName() == pUserProc->GetName()                     // 名前空間及び名前が等しい
    22         && this->Params().Equals( pUserProc->Params() ) )           // パラメータが等しい
     22        && this->Params().Equals( actualTypeParametersForThisProc, pUserProc->Params() ) )          // パラメータが等しい
    2323    {
    2424        if( this->returnType.Equals( pUserProc->returnType ) )
Note: See TracChangeset for help on using the changeset viewer.