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

SplitMemberNameの依存関係を排除。

Location:
trunk/ab5.0/abdev/BasicCompiler_Common/src
Files:
5 edited

Legend:

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

    r597 r598  
    635635}
    636636
    637 const CClass *Classes::FindEx( const NamespaceScopes &namespaceScopes, const std::string &name ) const
    638 {
    639     if( namespaceScopes.size() == 0 && name == "Object" )
     637const CClass *Classes::FindEx( const Symbol &symbol ) const
     638{
     639    if( symbol.GetNamespaceScopes().size() == 0 && symbol.GetName() == "Object" )
    640640    {
    641641        return GetObjectClassPtr();
    642642    }
    643     else if( namespaceScopes.size() == 0 && name == "String" )
     643    else if( symbol.GetNamespaceScopes().size() == 0 && symbol.GetName() == "String" )
    644644    {
    645645        return GetStringClassPtr();
     
    647647
    648648    std::vector<const CClass *> classes;
    649     const CClass *pClass = GetHashArrayElement( name.c_str() );
     649    const CClass *pClass = GetHashArrayElement( symbol.GetName().c_str() );
    650650    while( pClass )
    651651    {
    652         if( pClass->IsEqualSymbol( namespaceScopes, name ) ){
     652        if( pClass->IsEqualSymbol( symbol.GetNamespaceScopes(), symbol.GetName() ) ){
    653653            //名前空間とクラス名が一致した
    654654            classes.push_back( pClass );
     
    674674    return NULL;
    675675}
    676 const CClass *Classes::FindEx( const std::string &fullName ) const
    677 {
    678     char AreaName[VN_SIZE] = "";        //オブジェクト変数
    679     char NestName[VN_SIZE] = "";        //入れ子メンバ
    680     bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
    681 
    682     return FindEx( NamespaceScopes( AreaName ), NestName );
    683 }
    684676
    685677const CClass *Classes::GetStringClassPtr() const
     
    688680    {
    689681        // キャッシュしておく
    690         pStringClass = this->FindEx( NamespaceScopes( "System" ), "String" );
     682        pStringClass = this->FindEx( Symbol( NamespaceScopes( "System" ), "String" ) );
    691683    }
    692684    return pStringClass;
     
    697689    {
    698690        // キャッシュしておく
    699         pObjectClass = this->FindEx( NamespaceScopes( "System" ), "Object" );
     691        pObjectClass = this->FindEx( Symbol( NamespaceScopes( "System" ), "Object" ) );
    700692    }
    701693    return pObjectClass;
     
    706698    {
    707699        // キャッシュしておく
    708         pInterfaceInfo = this->FindEx( "ActiveBasic.Core.InterfaceInfo" );
     700        pInterfaceInfo = this->FindEx( Symbol( NamespaceScopes( "ActiveBasic.Core" ), "InterfaceInfo" ) );
    709701    }
    710702    return pInterfaceInfo;
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp

    r575 r598  
    33#include <Compiler.h>
    44#include <Type.h>
     5
     6using namespace ActiveBasic::Compiler;
    57
    68Compiler compiler;
     
    3032
    3133        // ジェネリクスクラスを取得
    32         const CClass *pGenericClass = this->GetObjectModule().meta.FindClassSupportedTypeDef( className );
     34        const CClass *pGenericClass = this->GetObjectModule().meta.FindClassSupportedTypeDef(
     35            LexicalAnalyzer::FullNameToSymbol( className )
     36        );
    3337
    3438        if( !pGenericClass )
     
    140144    // TypeDefされた型
    141145    ////////////////////
    142     int i=this->GetObjectModule().meta.GetTypeDefs().GetIndex( typeName );
     146    int i=this->GetObjectModule().meta.GetTypeDefs().GetIndex( LexicalAnalyzer::FullNameToSymbol( typeName ) );
    143147    if(i!=-1){
    144148        type = this->GetObjectModule().meta.GetTypeDefs()[i].GetBaseType();
     
    147151
    148152    //クラス
    149     const CClass *pobj_c = this->GetObjectModule().meta.GetClasses().FindEx( typeName );
     153    const CClass *pobj_c = this->GetObjectModule().meta.GetClasses().FindEx( LexicalAnalyzer::FullNameToSymbol( typeName ) );
    150154    if(pobj_c){
    151155        if( pobj_c->IsStructure() ){
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Class.cpp

    r574 r598  
    472472
    473473        //継承元クラスを取得
    474         const CClass *pInheritsClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(className);
     474        const CClass *pInheritsClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(
     475            LexicalAnalyzer::FullNameToSymbol( className )
     476        );
    475477        if( !pInheritsClass ){
    476478            compiler.errorMessenger.Output(106,className,nowLine);
     
    640642
    641643        //継承元クラスを取得
    642         const CClass *pInterfaceClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( className );
     644        const CClass *pInterfaceClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(
     645            LexicalAnalyzer::FullNameToSymbol( className )
     646        );
    643647        if( !pInterfaceClass ){
    644648            compiler.errorMessenger.Output(106,paramStr.c_str(),nowLine);
     
    768772            SplitGenericClassInstance( temporary, className, typeParameters, true, &typeParameterBaseClassNames );
    769773
    770             CClass *pobj_c = const_cast<CClass *>( classes.FindEx(namespaceScopes, className) );
     774            CClass *pobj_c = const_cast<CClass *>( classes.FindEx( Symbol( namespaceScopes, className ) ) );
    771775            if(!pobj_c) continue;
    772776
     
    835839
    836840                //継承元クラスを取得
    837                 const CClass *pInheritsClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( temporary );
     841                const CClass *pInheritsClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(
     842                    LexicalAnalyzer::FullNameToSymbol( temporary )
     843                );
    838844                if( !pInheritsClass ){
    839845                    compiler.errorMessenger.Output(106,temporary,i);
     
    10031009            SplitGenericClassInstance( temporary, className, typeParameters, true, &typeParameterBaseClassNames );
    10041010
    1005             CClass *pobj_c =  const_cast<CClass *>( classes.FindEx(namespaceScopes, className) );
     1011            CClass *pobj_c =  const_cast<CClass *>( classes.FindEx( Symbol( namespaceScopes, className ) ) );
    10061012            if(!pobj_c) continue;
    10071013
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Meta.cpp

    r597 r598  
    177177}
    178178
    179 const CClass *Meta::FindClassSupportedTypeDef( const NamespaceScopes &namespaceScopes, const std::string &name )
     179const CClass *Meta::FindClassSupportedTypeDef( const Symbol &symbol )
    180180{
    181     const CClass *pClass = this->GetClasses().FindEx( namespaceScopes, name );
     181    const CClass *pClass = this->GetClasses().FindEx( symbol );
    182182    if( pClass )
    183183    {
     
    186186
    187187    // TypeDefも見る
    188     int index = this->GetTypeDefs().GetIndex( namespaceScopes, name );
     188    int index = this->GetTypeDefs().GetIndex( symbol );
    189189    if( index != -1 ){
    190190        Type type = this->GetTypeDefs()[index].GetBaseType();
     
    196196    return NULL;
    197197}
    198 const CClass *Meta::FindClassSupportedTypeDef( const std::string &fullName )
    199 {
    200     char AreaName[VN_SIZE] = "";        //オブジェクト変数
    201     char NestName[VN_SIZE] = "";        //入れ子メンバ
    202     bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
    203 
    204     return FindClassSupportedTypeDef( NamespaceScopes( AreaName ), NestName );
    205 }
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/TypeDef.cpp

    r597 r598  
    1717}
    1818
    19 int TypeDefCollection::GetIndex( const NamespaceScopes &namespaceScopes, const std::string &name ) const{
     19int TypeDefCollection::GetIndex( const Symbol &symbol ) const{
    2020    int max = (int)(*this).size();
    2121    for( int i=0; i<max; i++ ){
    22         if( (*this)[i].IsEqualSymbol( namespaceScopes, name ) ){
     22        if( (*this)[i].IsEqualSymbol( symbol ) ){
    2323            return i;
    2424        }
     
    2626    return -1;
    2727}
    28 int TypeDefCollection::GetIndex( const std::string &fullName ) const{
    29     char AreaName[VN_SIZE] = "";        //オブジェクト変数
    30     char NestName[VN_SIZE] = "";        //入れ子メンバ
    31     bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
    32 
    33     return GetIndex( NamespaceScopes( AreaName ), NestName );
    34 }
Note: See TracChangeset for help on using the changeset viewer.