Ignore:
Timestamp:
May 5, 2008, 10:41:25 AM (16 years ago)
Author:
dai_9181
Message:

Overrideメソッド内で発生したエラーのエラーメッセージ表示処理は呼び出し元で行うようにした。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Method.cpp

    r523 r558  
    44
    55
    6 bool DynamicMethod::Override( const UserProc *pUserProc, Prototype::Accessibility accessibility, bool isOverrideModifier )
     6DynamicMethod::OverrideResult::EnumType DynamicMethod::Override( const UserProc *pUserProc, Prototype::Accessibility accessibility, bool isOverrideModifier )
    77{
    8     if( this->IsVirtual()
    9         && !this->IsAbstract()
    10         && isOverrideModifier == false )
    11     {
    12         // Override修飾子が無い状況で基底クラスの実体メソッドをオーバーライドしようとした
    13         compiler.errorMessenger.Output(127,NULL,cp);
    14     }
     8    bool isAbstractBefore = this->IsAbstract();
    159
    1610    //メンバ関数を上書き
     
    1812    this->SetAbstractMark( false );
    1913
    20     if( !this->IsVirtual() )
     14    if( this->IsVirtual() )
    2115    {
    22         // オーバーライドミス
    23         compiler.errorMessenger.Output(136, pUserProc->GetName(), cp);
     16        if( !isAbstractBefore && isOverrideModifier == false )
     17        {
     18            return OverrideResult::NotUseOverrideModifier;
     19        }
    2420    }
    25     if(this->GetAccessibility() != accessibility )
     21    else
    2622    {
    27         compiler.errorMessenger.Output(128,NULL,cp);
     23        return OverrideResult::NotVirtual;
    2824    }
    2925
    30     return true;
     26    if( this->GetAccessibility() != accessibility )
     27    {
     28        return OverrideResult::DifferentAccesibility;
     29    }
     30
     31    return OverrideResult::Successful;
    3132}
    3233
     
    7172}
    7273
    73 CMethod *Methods::FindForOverride( const Types &actualTypeParametersForThisMethods, const UserProc *pUserProc )
     74DynamicMethod *Methods::FindForOverride( const Types &actualTypeParametersForThisMethods, const UserProc *pUserProc )
    7475{
    7576    //メソッドのオーバーライド
     
    7980        if( !pMethod->IsNotUse() && pMethod->GetUserProc().IsEqualForOverride( actualTypeParametersForThisMethods, pUserProc ) )
    8081        {
    81             return pMethod;
     82            return dynamic_cast<DynamicMethod *>(pMethod);
    8283        }
    8384    }
Note: See TracChangeset for help on using the changeset viewer.