Ignore:
Timestamp:
May 8, 2008, 3:52:48 PM (16 years ago)
Author:
dai_9181
Message:

DelegateクラスのLexicalAnalyzerクラスへの依存性をなくした。

Location:
trunk/ab5.0/abdev/BasicCompiler_Common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Delegate.h

    r525 r581  
    3939    }
    4040
     41    const NamespaceScopesCollection &GetImportedNamespaces() const
     42    {
     43        return importedNamespaces;
     44    }
     45
    4146    const std::string &GetParamStr() const
    4247    {
     
    4752        return returnTypeName;
    4853    }
     54    void SetReturnType( const Type &returnType )
     55    {
     56        this->returnType = returnType;
     57    }
    4958
    50     void RefleshParameterAndReturnType();
     59    void SetSourceIndex( int sourceIndex )
     60    {
     61        this->sourceIndex = sourceIndex;
     62    }
    5163
    5264    virtual const std::string &GetKeyName() const
     
    5668
    5769    const Parameters &GetDynamicParams() const
     70    {
     71        return dynamicParams;
     72    }
     73    Parameters &GetDynamicParams()
    5874    {
    5975        return dynamicParams;
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/LexicalAnalyzer.h

    r578 r581  
    6666    static void CollectDelegates( const char *source, Delegates &delegates );
    6767    static std::string GenerateDelegatesSourceCode( const Delegates &delegates );
     68    static void RefleshDelegateParameterAndReturnType( Delegate &dg );
    6869    static void RefleshDelegatesParameterAndReturnType( Delegates &delegates );
    6970};
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Delegate.cpp

    r572 r581  
    22
    33#include <Delegate.h>
    4 
    5 void Delegate::RefleshParameterAndReturnType()
    6 {
    7     compiler.GetNamespaceSupporter().SetImportedNamespaces( this->importedNamespaces );
    8     compiler.GetNamespaceSupporter().SetLivingNamespaceScopes( this->GetNamespaceScopes() );
    9 
    10     // パラメータを解析
    11     Jenga::Common::Strings parameterStrings;
    12     SplitParameter( paramStr, parameterStrings );
    13     ActiveBasic::Compiler::LexicalAnalyzer::AnalyzeParameter( this->GetParameters(), parameterStrings, sourceIndex );
    14 
    15     // 動的パラメータを作る
    16     dynamicParams = this->GetParameters();
    17     dynamicParams.insert( dynamicParams.begin(), new Parameter( "_System_LocalThis", Type( DEF_PTR_VOID ) ) );
    18 
    19     if( IsFunction() )
    20     {
    21         // 戻り値を取得
    22         if( !compiler.StringToType( returnTypeName, returnType ) )
    23         {
    24             compiler.errorMessenger.Output(3,returnTypeName,sourceIndex);
    25         }
    26     }
    27 }
    284
    295bool Delegate::IsSimilar( const Delegate &dgt ) const
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Delegate.cpp

    r552 r581  
    213213}
    214214
     215void LexicalAnalyzer::RefleshDelegateParameterAndReturnType( Delegate &dg )
     216{
     217    compiler.GetNamespaceSupporter().SetImportedNamespaces( dg.GetImportedNamespaces() );
     218    compiler.GetNamespaceSupporter().SetLivingNamespaceScopes( dg.GetNamespaceScopes() );
     219
     220    // パラメータを解析
     221    Jenga::Common::Strings parameterStrings;
     222    SplitParameter( dg.GetParamStr(), parameterStrings );
     223    int sourceIndex;
     224    ActiveBasic::Compiler::LexicalAnalyzer::AnalyzeParameter( dg.GetParameters(), parameterStrings, sourceIndex );
     225    dg.SetSourceIndex( sourceIndex );
     226
     227    // 動的パラメータを作る
     228    dg.GetDynamicParams() = dg.GetParameters();
     229    dg.GetDynamicParams().insert( dg.GetDynamicParams().begin(), new Parameter( "_System_LocalThis", Type( DEF_PTR_VOID ) ) );
     230
     231    if( dg.IsFunction() )
     232    {
     233        // 戻り値を取得
     234        Type returnType;
     235        if( !compiler.StringToType( dg.GetReturnTypeName(), returnType ) )
     236        {
     237            compiler.errorMessenger.Output(3,dg.GetReturnTypeName(),sourceIndex);
     238        }
     239        else
     240        {
     241            dg.SetReturnType( returnType );
     242        }
     243    }
     244}
     245
    215246void LexicalAnalyzer::RefleshDelegatesParameterAndReturnType( Delegates &delegates )
    216247{
     
    219250    {
    220251        Delegate &dg = *delegates.Iterator_GetNext();
    221         dg.RefleshParameterAndReturnType();
    222     }
    223 }
     252        RefleshDelegateParameterAndReturnType( dg );
     253    }
     254}
Note: See TracChangeset for help on using the changeset viewer.