| 1 | #include "stdafx.h"
|
|---|
| 2 |
|
|---|
| 3 | #include <Compiler.h>
|
|---|
| 4 | #include <Symbol.h>
|
|---|
| 5 |
|
|---|
| 6 | Symbol::Symbol( const char *fullName )
|
|---|
| 7 | : isTargetObjectModule( true )
|
|---|
| 8 | {
|
|---|
| 9 | char areaName[VN_SIZE] = ""; //オブジェクト変数
|
|---|
| 10 | char nestName[VN_SIZE] = ""; //入れ子メンバ
|
|---|
| 11 | bool isNest = SplitMemberName( fullName, areaName, nestName );
|
|---|
| 12 |
|
|---|
| 13 | namespaceScopes = NamespaceScopes( areaName );
|
|---|
| 14 | name = nestName;
|
|---|
| 15 | }
|
|---|
| 16 | Symbol::Symbol( const string &fullName )
|
|---|
| 17 | : isTargetObjectModule( true )
|
|---|
| 18 | {
|
|---|
| 19 | char areaName[VN_SIZE] = ""; //オブジェクト変数
|
|---|
| 20 | char nestName[VN_SIZE] = ""; //入れ子メンバ
|
|---|
| 21 | bool isNest = SplitMemberName( fullName.c_str(), areaName, nestName );
|
|---|
| 22 |
|
|---|
| 23 | namespaceScopes = NamespaceScopes( areaName );
|
|---|
| 24 | name = nestName;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | std::string Symbol::GetFullName() const
|
|---|
| 28 | {
|
|---|
| 29 | if( namespaceScopes.size() )
|
|---|
| 30 | {
|
|---|
| 31 | return namespaceScopes.ToString() + "." + name;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | return name;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | bool Symbol::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
|
|---|
| 38 | {
|
|---|
| 39 | if( GetName() != name ){
|
|---|
| 40 | return false;
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | return compiler.GetNamespaceSupporter().IsSameAreaNamespace( GetNamespaceScopes(), namespaceScopes );
|
|---|
| 44 | }
|
|---|
| 45 | bool Symbol::IsEqualSymbol( const Symbol &symbol ) const
|
|---|
| 46 | {
|
|---|
| 47 | if( IsEqualSymbol( symbol.GetNamespaceScopes(), symbol.GetName() ) )
|
|---|
| 48 | {
|
|---|
| 49 | return true;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | if( symbol.GetNamespaceScopes().size() >= 1 )
|
|---|
| 53 | {
|
|---|
| 54 | // 静的メンバを考慮
|
|---|
| 55 | NamespaceScopes namespaceScopes( symbol.GetNamespaceScopes() );
|
|---|
| 56 | string name = namespaceScopes[namespaceScopes.size()-1] + "." + symbol.GetName();
|
|---|
| 57 | namespaceScopes.pop_back();
|
|---|
| 58 |
|
|---|
| 59 | return IsEqualSymbol( namespaceScopes, name );
|
|---|
| 60 | }
|
|---|
| 61 | return false;
|
|---|
| 62 | }
|
|---|
| 63 | bool Symbol::IsEqualSymbol( const char *fullName ) const
|
|---|
| 64 | {
|
|---|
| 65 | char AreaName[VN_SIZE] = ""; //オブジェクト変数
|
|---|
| 66 | char NestName[VN_SIZE] = ""; //入れ子メンバ
|
|---|
| 67 | bool isNest = SplitMemberName( fullName, AreaName, NestName );
|
|---|
| 68 |
|
|---|
| 69 | if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){
|
|---|
| 70 | return true;
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | return false;
|
|---|
| 74 | }
|
|---|