| Line |  | 
|---|
| 1 | #include "Type.h" | 
|---|
| 2 |  | 
|---|
| 3 | #ifndef _ACTIVEBASIC_COMPILER_PARAMETER_H | 
|---|
| 4 | #define _ACTIVEBASIC_COMPILER_PARAMETER_H | 
|---|
| 5 |  | 
|---|
| 6 | class Parameter; | 
|---|
| 7 | typedef vector<Parameter> Parameters; | 
|---|
| 8 |  | 
|---|
| 9 | class Parameter : public Type | 
|---|
| 10 | { | 
|---|
| 11 | string varName; | 
|---|
| 12 | bool isRef; | 
|---|
| 13 | bool isArray; | 
|---|
| 14 | int subScripts[MAX_ARRAYDIM]; | 
|---|
| 15 |  | 
|---|
| 16 | public: | 
|---|
| 17 | Parameter( const string &varName, const Type &type, bool isRef = false ): | 
|---|
| 18 | Type( type ) | 
|---|
| 19 | { | 
|---|
| 20 | this->varName = varName; | 
|---|
| 21 | this->isRef = isRef; | 
|---|
| 22 | isArray = false; | 
|---|
| 23 | } | 
|---|
| 24 | ~Parameter(){} | 
|---|
| 25 |  | 
|---|
| 26 | void SetArray( const int *pSubScripts ){ | 
|---|
| 27 | isArray = true; | 
|---|
| 28 | memcpy( this->subScripts, pSubScripts, sizeof(int) * MAX_ARRAYDIM ); | 
|---|
| 29 | } | 
|---|
| 30 |  | 
|---|
| 31 | bool IsRef(){ | 
|---|
| 32 | return isRef; | 
|---|
| 33 | } | 
|---|
| 34 | bool IsArray(){ | 
|---|
| 35 | return isArray; | 
|---|
| 36 | } | 
|---|
| 37 | int *GetSubScriptsPtr(){ | 
|---|
| 38 | return subScripts; | 
|---|
| 39 | } | 
|---|
| 40 |  | 
|---|
| 41 | bool Equals( const Parameter ¶m ) const | 
|---|
| 42 | { | 
|---|
| 43 | if( Type::Equals( param ) ){ | 
|---|
| 44 | return true; | 
|---|
| 45 | } | 
|---|
| 46 | else{ | 
|---|
| 47 |  | 
|---|
| 48 | if( this->isRef && this->BasicType() == DEF_ANY && | 
|---|
| 49 | param.isRef == false && param.IsPointer() | 
|---|
| 50 | || | 
|---|
| 51 | this->isRef == false && this->IsPointer() && | 
|---|
| 52 | param.isRef && param.BasicType() == DEF_ANY ){ | 
|---|
| 53 | /* ByRef var As Any | 
|---|
| 54 | と | 
|---|
| 55 | var As VoidPtr | 
|---|
| 56 | は同等 | 
|---|
| 57 | */ | 
|---|
| 58 | return true; | 
|---|
| 59 | } | 
|---|
| 60 | } | 
|---|
| 61 |  | 
|---|
| 62 | return false; | 
|---|
| 63 | } | 
|---|
| 64 |  | 
|---|
| 65 |  | 
|---|
| 66 | static bool Equals( const Parameters ¶msA, const Parameters paramsB ){ | 
|---|
| 67 | if( paramsA.size() != paramsB.size() ){ | 
|---|
| 68 | return false; | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | int max = (int)paramsA.size(); | 
|---|
| 72 | for( int i=0; i<max; i++ ){ | 
|---|
| 73 | if( !paramsA[i].Equals( paramsB[i] ) ){ | 
|---|
| 74 | return false; | 
|---|
| 75 | } | 
|---|
| 76 | } | 
|---|
| 77 |  | 
|---|
| 78 | return true; | 
|---|
| 79 | } | 
|---|
| 80 | }; | 
|---|
| 81 |  | 
|---|
| 82 | #endif //_ACTIVEBASIC_COMPILER_PARAMETER_H | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.