source: dev/trunk/ab5.0/abdev/ab_common/src/Lexical/Parameter.cpp@ 612

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

ObjectModuleに関連するクラス一式をab_commonプロジェクトに移動した。

File size: 1.7 KB
Line 
1#include "stdafx.h"
2
3bool Parameter::Equals( const Parameter &param, bool isContravariant ) const
4{
5 if( Type::Equals( param ) )
6 {
7 return true;
8 }
9 else
10 {
11 if( this->isRef && this->GetBasicType() == DEF_ANY &&
12 param.isRef == false && param.IsPointer()
13 ||
14 this->isRef == false && this->IsPointer() &&
15 param.isRef && param.GetBasicType() == DEF_ANY )
16 {
17 /* ByRef var As Any
18
19 var As VoidPtr
20 は同等
21 */
22 return true;
23 }
24 }
25
26 if( isContravariant )
27 {
28 // 反変引数を許可する
29 if( this->IsContravariant( param ) )
30 {
31 // 反変引数だったとき
32 return true;
33 }
34 }
35
36 return false;
37}
38bool Parameter::Equals( const Types &actualTypeParametersForThisProc, const Parameter &param, bool isContravariant ) const
39{
40 if( Equals( param, isContravariant ) )
41 {
42 return true;
43 }
44
45 if( this->IsTypeParameter() )
46 {
47 // 型パラメータだったとき
48 if( actualTypeParametersForThisProc[this->GetFormalTypeIndex()].Equals( param ) )
49 {
50 // 戻り値が等しい
51 return true;
52 }
53 }
54
55 return false;
56}
57
58bool Parameters::Equals( const Parameters &params, bool isContravariant ) const
59{
60 if( this->size() != params.size() ){
61 return false;
62 }
63
64 int max = (int)this->size();
65 for( int i=0; i<max; i++ ){
66 if( !(*this)[i]->Equals( *params[i], isContravariant ) ){
67 return false;
68 }
69 }
70
71 return true;
72}
73bool Parameters::Equals( const Types &actualTypeParametersForThisProc, const Parameters &params, bool isContravariant ) const
74{
75 if( this->size() != params.size() ){
76 return false;
77 }
78
79 int max = (int)this->size();
80 for( int i=0; i<max; i++ ){
81 if( !(*this)[i]->Equals( actualTypeParametersForThisProc, *params[i], isContravariant ) ){
82 return false;
83 }
84 }
85
86 return true;
87}
Note: See TracBrowser for help on using the repository browser.