Changeset 334 in dev for trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
- Timestamp:
- Sep 28, 2007, 12:05:10 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
r331 r334 301 301 } 302 302 303 bool GetMemberTermType( const Type &leftType, const Type &baseType, Type &resultType, const char *termFull, const char *termLeft, const char *member ) 304 { 305 //////////////////////////////// 306 // インデクサ(getアクセサ) 307 //////////////////////////////// 308 309 char VarName[VN_SIZE],ArrayElements[VN_SIZE]; 310 GetArrayElement(member,VarName,ArrayElements); 311 if(ArrayElements[0]){ 312 Type classType; 313 GetMemberType( leftType, VarName, classType, 0, false ); 314 if( classType.IsObject() ){ 315 if( !GetReturnTypeOfIndexerGetterProc( classType, resultType ) ){ 316 SetError(1,NULL,cp); 317 return false; 318 } 319 320 return true; 321 } 322 } 323 324 325 /////////////////////////////////////////////////////////////////// 326 // メンバを検索 327 /////////////////////////////////////////////////////////////////// 328 if( GetMemberType( leftType, member, resultType, 0, false ) ){ 329 // メンバが見つかったとき 330 return true; 331 } 332 333 334 /////////////////////////////////////////////////////////////////// 335 // 動的メソッドを検索 336 /////////////////////////////////////////////////////////////////// 337 char methodName[VN_SIZE] ,lpPtrOffset[VN_SIZE], dummy[1]; 338 char parameter[VN_SIZE]; 339 ReferenceKind refType; 340 lstrcpy( methodName, member ); 341 GetVarFormatString(methodName,parameter,lpPtrOffset,dummy,refType); 342 343 vector<const UserProc *> userProcs; 344 leftType.GetClass().GetMethods().Enum( methodName, userProcs ); 345 if(userProcs.size()){ 346 //オーバーロードを解決 347 const UserProc *pUserProc = OverloadSolutionWithStrParam(termFull,userProcs,parameter,termLeft); 348 349 if( pUserProc ){ 350 resultType = pUserProc->ReturnType(); 351 352 // 型パラメータを解決 353 ResolveFormalGenericTypeParameter( resultType, leftType, pUserProc ); 354 355 return true; 356 } 357 } 358 359 return false; 360 } 361 303 362 bool GetTermType( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, bool *pIsClassName ) 304 363 { … … 359 418 } 360 419 361 362 /////////////////////////////////////////////////////////////////// 363 // メンバを検索 364 /////////////////////////////////////////////////////////////////// 365 if( GetMemberType( leftType, member, resultType, 0, false ) ){ 366 // メンバが見つかったとき 367 return true; 368 } 369 370 371 /////////////////////////////////////////////////////////////////// 372 // 動的メソッドを検索 373 /////////////////////////////////////////////////////////////////// 374 char methodName[VN_SIZE] ,lpPtrOffset[VN_SIZE]; 375 lstrcpy( methodName, member ); 376 GetVarFormatString(methodName,parameter,lpPtrOffset,member,refType); 377 378 vector<const UserProc *> userProcs; 379 leftType.GetClass().GetMethods().Enum( methodName, userProcs ); 380 if(userProcs.size()){ 381 //オーバーロードを解決 382 const UserProc *pUserProc = OverloadSolutionWithStrParam(termFull,userProcs,parameter,termLeft); 383 384 if( pUserProc ){ 385 resultType = pUserProc->ReturnType(); 386 387 // 型パラメータを解決 388 ResolveFormalGenericTypeParameter( resultType, leftType, pUserProc ); 389 390 return true; 391 } 392 } 393 394 return false; 420 return GetMemberTermType( leftType, baseType, resultType, termFull, termLeft, member ); 395 421 } 396 422 … … 711 737 else if(IsVariableTopChar(term[0])|| 712 738 term[0]=='*'|| 713 (term[0]=='.'&&IsVariableTopChar(term[1]))){ 739 (term[0]=='.'&&IsVariableTopChar(term[1]))) 740 { 714 741 ////////////////// 715 742 // 何らかの識別子
Note:
See TracChangeset
for help on using the changeset viewer.