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

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

UserProc::SetParamsAndReturnTypeメソッドをリファクタリング
LexicalAnalysis.hのインクルードを除去した

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