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

Last change on this file since 277 was 271, 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 : isTargetObjectModule( true )
11{
12 char areaName[VN_SIZE] = ""; //オブジェクト変数
13 char nestName[VN_SIZE] = ""; //入れ子メンバ
14 bool isNest = SplitMemberName( fullName, areaName, nestName );
15
16 namespaceScopes = NamespaceScopes( areaName );
17 name = nestName;
18}
19Symbol::Symbol( const string &fullName )
20 : isTargetObjectModule( true )
21{
22 char areaName[VN_SIZE] = ""; //オブジェクト変数
23 char nestName[VN_SIZE] = ""; //入れ子メンバ
24 bool isNest = SplitMemberName( fullName.c_str(), areaName, nestName );
25
26 namespaceScopes = NamespaceScopes( areaName );
27 name = nestName;
28}
29
30bool Symbol::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
31{
32 if( GetName() != name ){
33 return false;
34 }
35
36 return compiler.GetNamespaceSupporter().IsSameAreaNamespace( GetNamespaceScopes(), namespaceScopes );
37}
38bool Symbol::IsEqualSymbol( const Symbol &symbol ) const
39{
40 if( IsEqualSymbol( symbol.GetNamespaceScopes(), symbol.GetName() ) )
41 {
42 return true;
43 }
44
45 if( symbol.GetNamespaceScopes().size() >= 1 )
46 {
47 // 静的メンバを考慮
48 NamespaceScopes namespaceScopes( symbol.GetNamespaceScopes() );
49 string name = namespaceScopes[namespaceScopes.size()-1] + "." + symbol.GetName();
50 namespaceScopes.pop_back();
51
52 return IsEqualSymbol( namespaceScopes, name );
53 }
54 return false;
55}
56bool Symbol::IsEqualSymbol( const char *fullName ) const
57{
58 char AreaName[VN_SIZE] = ""; //オブジェクト変数
59 char NestName[VN_SIZE] = ""; //入れ子メンバ
60 bool isNest = SplitMemberName( fullName, AreaName, NestName );
61
62 if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){
63 return true;
64 }
65
66 return false;
67}
Note: See TracBrowser for help on using the repository browser.