Ignore:
Timestamp:
May 3, 2008, 6:32:50 PM (16 years ago)
Author:
dai_9181
Message:

Compiler::pCompilingClassメンバをprivateにし、setter/getterにあたるメソッドを用意した。

File:
1 edited

Legend:

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

    r533 r536  
    145145
    146146    // 型パラメータ
    147     if( this->pCompilingClass )
     147    if( this->IsCompilingClass() )
    148148    {
    149149        // クラスに属するメソッドをコンパイルしているとき
    150         int formalTypeIndex = this->pCompilingClass->GetFormalGenericTypeParameterIndex( typeName );
     150        int formalTypeIndex = this->GetCompilingClass().GetFormalGenericTypeParameterIndex( typeName );
    151151        if( formalTypeIndex != -1 )
    152152        {
    153153            // コンパイル中クラスにおけるジェネリクス用の型パラメータのとき
    154154            type.SetBasicType( DEF_TYPE_PARAMETER );
    155             type.SetClassPtr( &this->pCompilingClass->GetFormalGenericTypes()[formalTypeIndex].GetType().GetClass() );
     155            type.SetClassPtr( &this->GetCompilingClass().GetFormalGenericTypes()[formalTypeIndex].GetType().GetClass() );
    156156            type.SetFormalTypeName( typeName );
    157157            type.SetFormalTypeIndex( formalTypeIndex );
     
    211211}
    212212
     213void Compiler::ClearCompilingUserProcAndClass()
     214{
     215    this->pCompilingUserProc = NULL;
     216    this->pCompilingClass = NULL;
     217}
     218
     219void Compiler::SetCompilingClass( const CClass *pClass )
     220{
     221    this->pCompilingClass = pClass;
     222}
     223
    213224void Compiler::StartProcedureCompile( const UserProc *pUserProc )
    214225{
     226    //コンパイル中の関数
     227    this->pCompilingUserProc = pUserProc;
     228
    215229    //コンパイル中の関数が属するクラス
    216     this->pCompilingClass = pUserProc->GetParentClassPtr();
     230    this->SetCompilingClass( pUserProc->GetParentClassPtr() );
    217231
    218232    //コンパイルスタートをクラス管理クラスに追加
     
    233247void Compiler::FinishProcedureCompile()
    234248{
    235 }
     249    this->pCompilingUserProc = NULL;
     250    this->pCompilingClass = NULL;
     251}
     252
     253bool Compiler::IsGlobalAreaCompiling()
     254{
     255    return ( pCompilingUserProc == NULL );
     256}
     257const UserProc &Compiler::GetCompilingUserProc()
     258{
     259    if( !this->IsGlobalAreaCompiling() )
     260    {
     261        return *pCompilingUserProc;
     262    }
     263
     264    throw;
     265}
     266
     267bool Compiler::IsCompilingClass()
     268{
     269    return ( pCompilingClass != NULL );
     270}
     271const CClass &Compiler::GetCompilingClass()
     272{
     273    if( this->IsCompilingClass() )
     274    {
     275        return *pCompilingClass;
     276    }
     277
     278    throw;
     279}
Note: See TracChangeset for help on using the changeset viewer.