source: dev/trunk/abdev/BasicCompiler_Common/src/Symbol.cpp@ 206

Last change on this file since 206 was 206, checked in by dai_9181, 17 years ago

コード全体のリファクタリングを実施

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