Changeset 598 in dev for trunk


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

SplitMemberNameの依存関係を排除。

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

Legend:

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

    r587 r598  
    1616#define MDLFILE_VER 0x70000003
    1717
     18using namespace ActiveBasic::Compiler;
     19
    1820
    1921void SetLpIndex_DebugFile(char *buffer,int *p,const Type &type){
     
    3537        (*p)+=lstrlen(buffer+(*p))+1;
    3638
    37         type.SetClassPtr( compiler.GetObjectModule().meta.GetClasses().FindEx(szClassName) );
     39        type.SetClassPtr(
     40            compiler.GetObjectModule().meta.GetClasses().FindEx( LexicalAnalyzer::FullNameToSymbol( szClassName ) )
     41        );
    3842    }
    3943    else{
  • trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp

    r579 r598  
    55#include "common.h"
    66
     7using namespace ActiveBasic::Compiler;
    78
    89int MakeWholeType(int size,int bSigned){
     
    468469    if( pIsClassName )
    469470    {
    470         if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( termFull ) )
     471        if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( LexicalAnalyzer::FullNameToSymbol( termFull ) ) )
    471472        {
    472473            *pIsClassName = true;
  • trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp

    r579 r598  
    639639        }
    640640
    641         int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( VarName );
     641        int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    642642        if( typeDefIndex != -1 ){
    643643            // TypeDef後の型名だったとき
  • trunk/ab5.0/abdev/BasicCompiler_Common/calculation.cpp

    r579 r598  
    10511051
    10521052        if(((unsigned _int64)*pi64)<=UCHAR_MAX){
    1053             //符号無し8ビット整数のリテラル値
     1053            // 符号無し8ビット整数のリテラル値
    10541054            return DEF_BYTE;
    10551055        }
    10561056        else if(((unsigned _int64)*pi64)<=USHRT_MAX){
    1057             //符号無し16ビット整数のリテラル値
     1057            // 符号無し16ビット整数のリテラル値
    10581058            return DEF_WORD;
    10591059        }
    10601060        else if(((unsigned _int64)*pi64)<=UINT_MAX){
    1061             //符号無し32ビット整数のリテラル値
     1061            // 符号無し32ビット整数のリテラル値
    10621062            return DEF_DWORD;
    10631063        }
    10641064        else{
    1065             //符号無し64ビット整数のリテラル値
     1065            // 符号無し64ビット整数のリテラル値
    10661066            return DEF_QWORD;
    10671067        }
  • trunk/ab5.0/abdev/BasicCompiler_Common/hash.cpp

    r576 r598  
    8282            if( !pobj_c )
    8383            {
    84                 pobj_c=compiler.GetObjectModule().meta.FindClassSupportedTypeDef(ObjName);
     84                pobj_c = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(
     85                    LexicalAnalyzer::FullNameToSymbol( ObjName )
     86                );
    8587                if( pobj_c ){
    8688                    isStatic = true;
     
    160162
    161163const UserProc *GetClassMethod( const char *className, const char *methodName ){
    162     const CClass *pClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( className );
     164    const CClass *pClass = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(
     165        LexicalAnalyzer::FullNameToSymbol( className )
     166    );
    163167    if( pClass ){
    164168        std::vector<const UserProc *> userProcs;
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Class.h

    r593 r598  
    496496    CClass *Add( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name,int nowLine);
    497497
    498     const CClass *FindEx( const NamespaceScopes &namespaceScopes, const std::string &name ) const;
    499     const CClass *FindEx( const std::string &fullName ) const;
     498    const CClass *FindEx( const Symbol &symbol ) const;
    500499
    501500
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Meta.h

    r566 r598  
    156156    const ::Delegate &ToDelegate( const CClass &_class );
    157157
    158     const CClass *FindClassSupportedTypeDef( const NamespaceScopes &namespaceScopes, const std::string &name );
    159     const CClass *FindClassSupportedTypeDef( const std::string &fullName );
     158    const CClass *FindClassSupportedTypeDef( const Symbol &symbol );
    160159};
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/TypeDef.h

    r542 r598  
    5959
    6060    void Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine );
    61     int GetIndex( const NamespaceScopes &namespaceScopes, const std::string &name ) const;
    62     int GetIndex( const std::string &fullName ) const;
     61    int GetIndex( const Symbol &symbol ) const;
    6362};
  • 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 }
  • trunk/ab5.0/abdev/compiler_x64/Compile_CallProc.cpp

    r584 r598  
    140140                if( !pobj_c )
    141141                {
    142                     pobj_c = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( ObjectName );
     142                    pobj_c = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(
     143                        LexicalAnalyzer::FullNameToSymbol( ObjectName )
     144                    );
    143145                    if( pobj_c ){
    144146                        isStatic = true;
  • trunk/ab5.0/abdev/compiler_x64/Compile_Var.cpp

    r592 r598  
    564564            }
    565565
    566             int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( VarName );
     566            int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex(
     567                LexicalAnalyzer::FullNameToSymbol( VarName )
     568            );
    567569            if( typeDefIndex != -1 ){
    568570                // TypeDef後の型名だったとき
  • trunk/ab5.0/abdev/compiler_x64/NumOpe.cpp

    r592 r598  
    55#include "../BasicCompiler_Common/common.h"
    66#include "Opcode.h"
     7
     8using namespace ActiveBasic::Compiler;
    79
    810void NewStringObject(int reg, const char *str){
     
    426428
    427429    if( pIsClassName ){
    428         if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( termFull ) ){
     430        if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( LexicalAnalyzer::FullNameToSymbol( termFull ) ) ){
    429431            *pIsClassName = true;
    430432            return true;
  • trunk/ab5.0/abdev/compiler_x86/Compile_CallProc.cpp

    r566 r598  
    132132                if( !pobj_c )
    133133                {
    134                     pobj_c = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( ObjectName );
     134                    pobj_c = compiler.GetObjectModule().meta.FindClassSupportedTypeDef(
     135                        LexicalAnalyzer::FullNameToSymbol( ObjectName )
     136                    );
    135137                    if( pobj_c ){
    136138                        isStatic = true;
  • trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp

    r591 r598  
    546546            }
    547547
    548             int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( VarName );
     548            int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex(
     549                LexicalAnalyzer::FullNameToSymbol( VarName )
     550            );
    549551            if( typeDefIndex != -1 ){
    550552                // TypeDef後の型名だったとき
  • trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp

    r591 r598  
    55#include "../BasicCompiler_Common/common.h"
    66#include "Opcode.h"
     7
     8using namespace ActiveBasic::Compiler;
    79
    810void PushReturnValue(int type){
     
    415417
    416418    if( pIsClassName ){
    417         if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( termFull ) ){
     419        if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( LexicalAnalyzer::FullNameToSymbol( termFull ) ) ){
    418420            *pIsClassName = true;
    419421            return true;
Note: See TracChangeset for help on using the changeset viewer.