source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/src/Symbol.cpp@ 467

Last change on this file since 467 was 461, checked in by dai_9181, 16 years ago

smoothieプロジェクトが不要になったため、破棄。

File size: 1.9 KB
Line 
1#include "stdafx.h"
2
3#include <Compiler.h>
4#include <Symbol.h>
5
6Symbol::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}
16Symbol::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
27std::string Symbol::GetFullName() const
28{
29 if( namespaceScopes.size() )
30 {
31 return namespaceScopes.ToString() + "." + name;
32 }
33
34 return name;
35}
36
37bool 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}
45bool 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}
63bool 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}
Note: See TracBrowser for help on using the repository browser.