Changeset 103 in dev for BasicCompiler_Common/Variable.cpp


Ignore:
Timestamp:
May 2, 2007, 4:08:58 AM (17 years ago)
Author:
dai_9181
Message:

名前空間機能をグローバル変数、定数と列挙型に適用。
一部、クラスの静的メンバと名前空間の相性が悪いコードが潜んでいるため、要改修

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Variable.cpp

    r75 r103  
     1#include "common.h"
     2
     3bool Variable::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
     4{
     5    if( GetName() != name ){
     6        return false;
     7    }
     8    return NamespaceScopes::IsSameArea( this->namespaceScopes, namespaceScopes );
     9}
     10bool Variable::IsEqualSymbol( const string &fullName ) const
     11{
     12    char AreaName[VN_SIZE] = "";        //オブジェクト変数
     13    char NestName[VN_SIZE] = "";        //入れ子メンバ
     14    bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
     15
     16    if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){
     17        return true;
     18    }
     19
     20    if( isNest ){
     21        // 静的メンバを考慮
     22
     23        char AreaName2[VN_SIZE] = "";       //オブジェクト変数
     24        char NestName2[VN_SIZE] = "";       //入れ子メンバ
     25        bool isNest = SplitMemberName( AreaName, AreaName2, NestName2 );
     26        lstrcat( NestName2, "." );
     27        lstrcat( NestName2, NestName );
     28
     29        return IsEqualSymbol( NamespaceScopes( AreaName2 ), NestName2 );
     30    }
     31
     32    return false;
     33}
Note: See TracChangeset for help on using the changeset viewer.