Changeset 64 in dev for BasicCompiler_Common/Parameter.cpp
- Timestamp:
- Mar 8, 2007, 2:49:34 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/Parameter.cpp
r52 r64 58 58 } 59 59 60 ReturnTypeInfo.type= 0;61 ReturnTypeInfo.u.lpIndex= 0;60 ReturnTypeInfo.type=DEF_NON; 61 ReturnTypeInfo.u.lpIndex=-1; 62 62 } 63 63 CParameter::CParameter(const PARAMETER_INFO *pParamInfo,const int ParmNum){ … … 70 70 this->ParmsNum=ParmNum; 71 71 72 ReturnTypeInfo.type= 0;73 ReturnTypeInfo.u.lpIndex= 0;72 ReturnTypeInfo.type=DEF_NON; 73 ReturnTypeInfo.u.lpIndex=-1; 74 74 } 75 75 CParameter::~CParameter(){ … … 99 99 if(Parms[i]){ 100 100 TYPEINFO BaseType={ppi[i].type,ppi[i].u.index}; 101 type=NumOpe_GetType(Parms[i],&BaseType,&lpIndex); 101 type=NumOpe_GetType(Parms[i], 102 (overload_level==OVERLOAD_LEVEL0) ? NULL : &BaseType, 103 &lpIndex); 102 104 } 103 105 else{ … … 107 109 108 110 if(type!=ppi[i].type){ 109 if(overload_level==OVERLOAD_LEVEL1 ){111 if(overload_level==OVERLOAD_LEVEL1 || overload_level == OVERLOAD_LEVEL0){ 110 112 return 0; 111 113 } … … 121 123 } 122 124 else{ 123 if(NATURAL_TYPE(type)==DEF_OBJECT ){125 if(NATURAL_TYPE(type)==DEF_OBJECT || NATURAL_TYPE(type)==DEF_STRUCT){ 124 126 if(lpIndex!=ppi[i].u.index) return 0; 125 127 } … … 130 132 //戻り値も比較対象にする 131 133 if(ReturnTypeInfo.type==pReturnTypeInfo->type){ 132 if(NATURAL_TYPE(ReturnTypeInfo.type)==DEF_OBJECT){ 133 if(ReturnTypeInfo.u.lpIndex != pReturnTypeInfo->u.lpIndex) return 0; 134 if(NATURAL_TYPE(ReturnTypeInfo.type)==DEF_OBJECT 135 || NATURAL_TYPE(ReturnTypeInfo.type)==DEF_STRUCT ){ 136 if(ReturnTypeInfo.u.lpIndex != pReturnTypeInfo->u.lpIndex) return 0; 134 137 } 135 138 } … … 145 148 psi=0; 146 149 147 foreach( psi, subs ){ 148 149 TYPEINFO ReturnTypeInfo; 150 ReturnTypeInfo.type=psi->ReturnType; 151 ReturnTypeInfo.u.lpIndex=psi->u.ReturnIndex; 152 153 //エラーチェック 154 if(_overload_check(psi->pParmInfo,psi->ParmNum,&ReturnTypeInfo,OVERLOAD_LEVEL1)){ 155 if(sw){ 156 SetError(52,name,cp); 157 return 0; 158 } 159 sw=1; 160 break; 161 } 162 } 163 164 if(!sw){ 165 foreach( psi, subs ){ 150 for( int level=OVERLOAD_MIN_LEVEL; level<=OVERLOAD_MAX_LEVEL; level++ ){ 151 foreach( SUBINFO *temp_psi, subs ){ 166 152 167 153 TYPEINFO ReturnTypeInfo; 168 ReturnTypeInfo.type= psi->ReturnType;169 ReturnTypeInfo.u.lpIndex= psi->u.ReturnIndex;154 ReturnTypeInfo.type=temp_psi->ReturnType; 155 ReturnTypeInfo.u.lpIndex=temp_psi->u.ReturnIndex; 170 156 171 157 //エラーチェック 172 if(_overload_check( psi->pParmInfo,psi->ParmNum,&ReturnTypeInfo,OVERLOAD_LEVEL2)){158 if(_overload_check(temp_psi->pParmInfo,temp_psi->ParmNum,&ReturnTypeInfo,level)){ 173 159 if(sw){ 174 160 SetError(52,name,cp); … … 176 162 } 177 163 sw=1; 164 165 psi = temp_psi; 178 166 break; 179 167 } 180 168 } 181 } 182 183 if(!sw){ 184 foreach( psi, subs ){ 185 186 TYPEINFO ReturnTypeInfo; 187 ReturnTypeInfo.type=psi->ReturnType; 188 ReturnTypeInfo.u.lpIndex=psi->u.ReturnIndex; 189 190 //エラーチェック 191 if(_overload_check(psi->pParmInfo,psi->ParmNum,&ReturnTypeInfo,OVERLOAD_LEVEL3)){ 192 if(sw){ 193 SetError(52,name,cp); 194 return 0; 195 } 196 sw=1; 197 break; 198 } 199 } 169 170 if( sw ) break; 200 171 } 201 172 … … 212 183 psi=0; 213 184 214 foreach( psi, subs ){ 215 216 //エラーチェック 217 if(_overload_check(psi->pParmInfo,psi->ParmNum,NULL,OVERLOAD_LEVEL1)){ 218 if(sw){ 219 return OverloadSolutionWithReturnType(name,subs); 220 } 221 sw=1; 222 break; 223 } 224 } 225 226 if(!sw){ 227 foreach( psi, subs ){ 185 for( int level=OVERLOAD_MIN_LEVEL; level<=OVERLOAD_MAX_LEVEL; level++ ){ 186 187 foreach( SUBINFO *temp_psi, subs ){ 228 188 229 189 //エラーチェック 230 if(_overload_check( psi->pParmInfo,psi->ParmNum,NULL,OVERLOAD_LEVEL2)){190 if(_overload_check(temp_psi->pParmInfo,temp_psi->ParmNum,NULL,level)){ 231 191 if(sw){ 232 192 return OverloadSolutionWithReturnType(name,subs); 233 193 } 234 194 sw=1; 235 break; 236 } 237 } 238 } 239 240 if(!sw){ 241 foreach( psi, subs ){ 242 243 //エラーチェック 244 if(_overload_check(psi->pParmInfo,psi->ParmNum,NULL,OVERLOAD_LEVEL3)){ 245 if(sw){ 246 return OverloadSolutionWithReturnType(name,subs); 247 } 248 sw=1; 249 break; 250 } 251 } 195 196 psi = temp_psi; 197 } 198 } 199 200 if( sw ) break; 252 201 } 253 202
Note:
See TracChangeset
for help on using the changeset viewer.