source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/src/Procedure.cpp@ 597

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

インクルード順序を整理

File size: 2.7 KB
Line 
1#include "stdafx.h"
2
3bool UserProc::IsEqualForOverride( const Types &actualTypeParametersForThisProc, const UserProc *pUserProc ) const
4{
5 if( this->GetName() == pUserProc->GetName() // 名前空間及び名前が等しい
6 && this->Params().Equals( actualTypeParametersForThisProc, pUserProc->Params() ) ) // パラメータが等しい
7 {
8 if( this->returnType.Equals( pUserProc->returnType ) )
9 {
10 // 戻り値が等しい
11 return true;
12 }
13 else if( this->returnType.IsCovariant( pUserProc->returnType ) )
14 {
15 // 戻り値が共変
16 return true;
17 }
18 else if( this->returnType.IsTypeParameter() )
19 {
20 // 型パラメータだったとき
21
22 if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].Equals( pUserProc->returnType ) )
23 {
24 // 戻り値が等しい
25 return true;
26 }
27 else if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].IsCovariant( pUserProc->returnType ) )
28 {
29 // 戻り値が共変
30 return true;
31 }
32 }
33 }
34 return false;
35}
36
37
38std::string UserProc::GetFullName() const
39{
40 if( HasParentClass() ){
41 return GetParentClass().GetName() + "." + GetName();
42 }
43
44 return GetName();
45}
46bool UserProc::IsCastOperator() const
47{
48 if( GetName()[0] == 1 && GetName()[1] == ESC_OPERATOR && GetName()[2] == CALC_AS )
49 {
50 return true;
51 }
52 return false;
53}
54const NamespaceScopes &UserProc::GetNamespaceScopes() const
55{
56 if( HasParentClass() ){
57 return GetParentClassPtr()->GetNamespaceScopes();
58 }
59 return Symbol::GetNamespaceScopes();
60}
61const NamespaceScopesCollection &UserProc::GetImportedNamespaces() const
62{
63 if( pParentClass )
64 {
65 return pParentClass->GetImportedNamespaces();
66 }
67 return importedNamespaces;
68}
69bool UserProc::IsVirtual() const
70{
71 if( pMethod == NULL ){
72 return false;
73 }
74 return ( pMethod->IsVirtual() != 0 );
75}
76const CMethod &UserProc::GetMethod() const
77{
78 if( !HasParentClass() )
79 {
80 Jenga::Throw( "グローバル関数に対してUserProc::GetMethodメソッドが呼ばれた" );
81 }
82 return *pMethod;
83}
84
85const UserProc *UserProc::pGlobalProc = NULL;
86
87
88void UserProcs::EnumGlobalProcs( const char *simpleName, const Symbol &localSymbol, std::vector<const UserProc *> &subs )
89{
90 ///////////////////////////
91 // グローバル関数を検索
92 ///////////////////////////
93
94 // ハッシュ値を取得
95 UserProc *pUserProc = GetHashArrayElement( simpleName );
96 while(pUserProc){
97 if( pUserProc->IsGlobalProcedure() ){
98 if( pUserProc->IsEqualSymbol( localSymbol ) ){
99 subs.push_back( pUserProc );
100 }
101 }
102
103 pUserProc=pUserProc->GetChainNext();
104 }
105}
106
107void ProcPointers::Clear()
108{
109 ProcPointers &procPointers = *this;
110 BOOST_FOREACH( ProcPointer *pProcPointer, procPointers ){
111 delete pProcPointer;
112 }
113 this->clear();
114}
Note: See TracBrowser for help on using the repository browser.