Changeset 566 in dev


Ignore:
Timestamp:
May 6, 2008, 1:41:03 PM (16 years ago)
Author:
dai_9181
Message:

・Classes::Find→Classes::FindExにリネームして、TypeDefサポートを排除した。
・Meta::FindClassSupportedTypeDefメソッドを実装。従来のClasses::Findの実装内容を受け継ぐ。

Location:
trunk/ab5.0/abdev
Files:
11 edited

Legend:

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

    r536 r566  
    3535        (*p)+=lstrlen(buffer+(*p))+1;
    3636
    37         type.SetClassPtr( compiler.GetObjectModule().meta.GetClasses().Find(szClassName) );
     37        type.SetClassPtr( compiler.GetObjectModule().meta.GetClasses().FindEx(szClassName) );
    3838    }
    3939    else{
  • trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp

    r537 r566  
    466466    //////////////////////////////////////////////
    467467
    468     if( pIsClassName ){
    469         if( compiler.GetObjectModule().meta.GetClasses().Find( termFull ) ){
     468    if( pIsClassName )
     469    {
     470        if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( termFull ) )
     471        {
    470472            *pIsClassName = true;
    471473            return true;
  • trunk/ab5.0/abdev/BasicCompiler_Common/hash.cpp

    r536 r566  
    8282            if( !pobj_c )
    8383            {
    84                 pobj_c=compiler.GetObjectModule().meta.GetClasses().Find(ObjName);
     84                pobj_c=compiler.GetObjectModule().meta.FindClassSupportedTypeDef(ObjName);
    8585                if( pobj_c ){
    8686                    isStatic = true;
     
    160160
    161161const UserProc *GetClassMethod( const char *className, const char *methodName ){
    162     const CClass *pClass = compiler.GetObjectModule().meta.GetClasses().Find( className );
     162    const CClass *pClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( className );
    163163    if( pClass ){
    164164        std::vector<const UserProc *> userProcs;
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Class.h

    r565 r566  
    497497    CClass *Add( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name,int nowLine);
    498498
    499     const CClass *Find( const NamespaceScopes &namespaceScopes, const std::string &name ) const;
    500     const CClass *Find( const std::string &fullName ) const;
     499    const CClass *FindEx( const NamespaceScopes &namespaceScopes, const std::string &name ) const;
     500    const CClass *FindEx( const std::string &fullName ) const;
    501501
    502502
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Meta.h

    r562 r566  
    155155
    156156    const ::Delegate &ToDelegate( const CClass &_class );
     157
     158    const CClass *FindClassSupportedTypeDef( const NamespaceScopes &namespaceScopes, const std::string &name );
     159    const CClass *FindClassSupportedTypeDef( const std::string &fullName );
    157160};
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Class.cpp

    r565 r566  
    648648}
    649649
    650 const CClass *Classes::Find( const NamespaceScopes &namespaceScopes, const std::string &name ) const
    651 {
    652     if( namespaceScopes.size() == 0 && name == "Object" ){
     650const CClass *Classes::FindEx( const NamespaceScopes &namespaceScopes, const std::string &name ) const
     651{
     652    if( namespaceScopes.size() == 0 && name == "Object" )
     653    {
    653654        return GetObjectClassPtr();
    654655    }
    655     else if( namespaceScopes.size() == 0 && name == "String" ){
     656    else if( namespaceScopes.size() == 0 && name == "String" )
     657    {
    656658        return GetStringClassPtr();
    657659    }
     
    683685    }
    684686
    685     // TypeDefも見る
    686     int index = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( namespaceScopes, name );
    687     if( index != -1 ){
    688         Type type = compiler.GetObjectModule().meta.GetTypeDefs()[index].GetBaseType();
    689         if( type.IsObject() ){
    690             return &type.GetClass();
    691         }
    692     }
    693 
    694687    return NULL;
    695688}
    696 const CClass *Classes::Find( const std::string &fullName ) const
     689const CClass *Classes::FindEx( const std::string &fullName ) const
    697690{
    698691    char AreaName[VN_SIZE] = "";        //オブジェクト変数
     
    700693    bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
    701694
    702     return Find( NamespaceScopes( AreaName ), NestName );
     695    return FindEx( NamespaceScopes( AreaName ), NestName );
    703696}
    704697
     
    707700    if( !pStringClass ){
    708701        // キャッシュしておく
    709         pStringClass = this->Find( NamespaceScopes( "System" ), "String" );
     702        pStringClass = this->FindEx( NamespaceScopes( "System" ), "String" );
    710703
    711704        if( !pStringClass )
     
    723716    if( !pObjectClass ){
    724717        // キャッシュしておく
    725         pObjectClass = this->Find( NamespaceScopes( "System" ), "Object" );
     718        pObjectClass = this->FindEx( NamespaceScopes( "System" ), "Object" );
    726719
    727720        if( !pObjectClass )
     
    739732    if( !pInterfaceInfo ){
    740733        // キャッシュしておく
    741         pInterfaceInfo = this->Find( "ActiveBasic.Core.InterfaceInfo" );
     734        pInterfaceInfo = this->FindEx( "ActiveBasic.Core.InterfaceInfo" );
    742735
    743736        if( !pInterfaceInfo )
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp

    r540 r566  
    3030
    3131        // ジェネリクスクラスを取得
    32         const CClass *pGenericClass = this->GetObjectModule().meta.GetClasses().Find( className );
     32        const CClass *pGenericClass = this->GetObjectModule().meta.FindClassSupportedTypeDef( className );
    3333
    3434        if( !pGenericClass )
     
    128128
    129129    //クラス
    130     const CClass *pobj_c = this->GetObjectModule().meta.GetClasses().Find( typeName );
     130    const CClass *pobj_c = this->GetObjectModule().meta.GetClasses().FindEx( typeName );
    131131    if(pobj_c){
    132132        if( pobj_c->IsStructure() ){
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Class.cpp

    r564 r566  
    472472
    473473        //継承元クラスを取得
    474         const CClass *pInheritsClass = compiler.GetObjectModule().meta.GetClasses().Find(className);
     474        const CClass *pInheritsClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(className);
    475475        if( !pInheritsClass ){
    476476            compiler.errorMessenger.Output(106,className,nowLine);
     
    628628
    629629        //継承元クラスを取得
    630         const CClass *pInterfaceClass = compiler.GetObjectModule().meta.GetClasses().Find( className );
     630        const CClass *pInterfaceClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( className );
    631631        if( !pInterfaceClass ){
    632632            compiler.errorMessenger.Output(106,paramStr.c_str(),nowLine);
     
    756756            SplitGenericClassInstance( temporary, className, typeParameters, true, &typeParameterBaseClassNames );
    757757
    758             CClass *pobj_c = const_cast<CClass *>( classes.Find(namespaceScopes, className) );
     758            CClass *pobj_c = const_cast<CClass *>( classes.FindEx(namespaceScopes, className) );
    759759            if(!pobj_c) continue;
    760760
     
    823823
    824824                //継承元クラスを取得
    825                 const CClass *pInheritsClass = classes.Find(temporary);
     825                const CClass *pInheritsClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( temporary );
    826826                if( !pInheritsClass ){
    827827                    compiler.errorMessenger.Output(106,temporary,i);
     
    980980            SplitGenericClassInstance( temporary, className, typeParameters, true, &typeParameterBaseClassNames );
    981981
    982             CClass *pobj_c =  const_cast<CClass *>( classes.Find(namespaceScopes, className) );
     982            CClass *pobj_c =  const_cast<CClass *>( classes.FindEx(namespaceScopes, className) );
    983983            if(!pobj_c) continue;
    984984
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Meta.cpp

    r562 r566  
    178178    throw;
    179179}
     180
     181const CClass *Meta::FindClassSupportedTypeDef( const NamespaceScopes &namespaceScopes, const std::string &name )
     182{
     183    const CClass *pClass = this->GetClasses().FindEx( namespaceScopes, name );
     184    if( pClass )
     185    {
     186        return pClass;
     187    }
     188
     189    // TypeDefも見る
     190    int index = this->GetTypeDefs().GetIndex( namespaceScopes, name );
     191    if( index != -1 ){
     192        Type type = this->GetTypeDefs()[index].GetBaseType();
     193        if( type.IsObject() ){
     194            return &type.GetClass();
     195        }
     196    }
     197
     198    return NULL;
     199}
     200const CClass *Meta::FindClassSupportedTypeDef( const std::string &fullName )
     201{
     202    char AreaName[VN_SIZE] = "";        //オブジェクト変数
     203    char NestName[VN_SIZE] = "";        //入れ子メンバ
     204    bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
     205
     206    return FindClassSupportedTypeDef( NamespaceScopes( AreaName ), NestName );
     207}
  • trunk/ab5.0/abdev/compiler_x86/Compile_CallProc.cpp

    r536 r566  
    132132                if( !pobj_c )
    133133                {
    134                     pobj_c=compiler.GetObjectModule().meta.GetClasses().Find(ObjectName);
     134                    pobj_c = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( ObjectName );
    135135                    if( pobj_c ){
    136136                        isStatic = true;
  • trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp

    r536 r566  
    415415
    416416    if( pIsClassName ){
    417         if( compiler.GetObjectModule().meta.GetClasses().Find( termFull ) ){
     417        if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( termFull ) ){
    418418            *pIsClassName = true;
    419419            return true;
Note: See TracChangeset for help on using the changeset viewer.