Changeset 140 in dev for BasicCompiler64/Compile_Var.cpp
- Timestamp:
- Jun 15, 2007, 4:00:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/Compile_Var.cpp
r138 r140 187 187 } 188 188 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const CClass &objClass, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess){ 189 int i;190 191 189 192 190 ////////////////////////////////////// … … 207 205 //////////////////////////// 208 206 209 int offset = objClass.GetMemberOffset( VarName, &i ); 210 if(i==objClass.iMemberNum){ 207 int memberIndex; 208 int offset = objClass.GetMemberOffset( VarName, &memberIndex ); 209 if( memberIndex == objClass.GetDynamicMembers().size() ){ 211 210 if(isErrorEnabled) SetError(103,VarName,cp); 212 211 return false; 213 212 } 214 213 215 CMember *pMember =objClass.ppobj_Member[i];214 CMember *pMember = objClass.GetDynamicMembers()[memberIndex]; 216 215 217 216 … … 379 378 } 380 379 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType,int *pss){ 381 int i;382 380 char variable[VN_SIZE]; 383 381 … … 471 469 //クラス内メンバを参照するとき(通常) 472 470 473 for(i=0;i<pobj_CompilingClass->iMemberNum;i++){ 474 if( pobj_CompilingClass->ppobj_Member[i]->GetName() == VarName ){ 471 bool isFound = false; 472 BOOST_FOREACH( CMember *pMember, pobj_CompilingClass->GetDynamicMembers() ){ 473 if( pMember->GetName() == VarName ){ 474 isFound = true; 475 475 break; 476 476 } 477 477 } 478 if( i==pobj_CompilingClass->iMemberNum) goto NonClassMember;478 if( !isFound ) goto NonClassMember; 479 479 } 480 480 … … 773 773 const CClass &objClass = type.GetClass(); 774 774 775 for(i=0,i2=0;i2<objClass.iMemberNum;i2++){ 775 int i = 0; 776 BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){ 777 if(InitBuf[i]=='\0'){ 778 SetError(41,0,cp); 779 return false; 780 } 781 776 782 i=GetOneParameter(InitBuf,i,temporary); 777 783 778 i3=objClass.GetMemberOffset( objClass.ppobj_Member[i2]->GetName().c_str(), NULL );784 i3=objClass.GetMemberOffset( pMember->GetName().c_str(), NULL ); 779 785 780 786 if(!SetInitGlobalData(offset+i3, 781 objClass.ppobj_Member[i2]->GetType(),782 objClass.ppobj_Member[i2]->SubScripts,787 pMember->GetType(), 788 pMember->SubScripts, 783 789 temporary)) return false; 784 785 if(InitBuf[i]=='\0') break;786 }787 if(i2+1!=objClass.iMemberNum){788 SetError(41,0,cp);789 return false;790 790 } 791 791 return true; … … 911 911 const CClass &objClass = type.GetClass(); 912 912 913 for(i=0,i2=0;i2<objClass.iMemberNum;i2++){ 913 int i = 0; 914 BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){ 915 if(InitBuf[i]=='\0'){ 916 SetError(41,0,cp); 917 return false; 918 } 919 914 920 i=GetOneParameter(InitBuf,i,temporary); 915 921 916 i3=objClass.GetMemberOffset( objClass.ppobj_Member[i2]->GetName().c_str(), NULL );922 i3=objClass.GetMemberOffset( pMember->GetName().c_str(), NULL ); 917 923 918 924 if(!InitLocalVar(offset+i3, 919 objClass.ppobj_Member[i2]->GetType(),920 objClass.ppobj_Member[i2]->SubScripts,925 pMember->GetType(), 926 pMember->SubScripts, 921 927 temporary)) return false; 922 928 923 929 if(InitBuf[i]=='\0') break; 924 }925 if(i2+1!=objClass.iMemberNum){926 SetError(41,0,cp);927 return 0;928 930 } 929 931 return true;
Note:
See TracChangeset
for help on using the changeset viewer.