Changeset 140 in dev for BasicCompiler32/Compile_Var.cpp
- Timestamp:
- Jun 15, 2007, 4:00:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_Var.cpp
r138 r140 158 158 } 159 159 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const CClass &objClass, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess){ 160 int i;161 162 160 163 161 ////////////////////////////////////// … … 178 176 //////////////////////////// 179 177 180 int offset = objClass.GetMemberOffset( VarName, &i ); 181 if(i==objClass.iMemberNum){ 178 int memberIndex; 179 int offset = objClass.GetMemberOffset( VarName, &memberIndex ); 180 if(memberIndex==objClass.GetDynamicMembers().size()){ 182 181 if(isErrorEnabled) SetError(103,VarName,cp); 183 182 return false; 184 183 } 185 184 186 CMember *pMember=objClass. ppobj_Member[i];185 CMember *pMember=objClass.GetDynamicMembers()[memberIndex]; 187 186 188 187 … … 351 350 352 351 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType,int *pss){ 353 int i;354 352 char variable[VN_SIZE]; 355 353 … … 387 385 ////////////////// 388 386 389 const Variable *pVar = UserProc::CompilingUserProc().localVars.BackSearch( VarName);387 const Variable *pVar = UserProc::CompilingUserProc().localVars.BackSearch( Symbol( VarName ) ); 390 388 if( pVar ){ 391 389 //ポインタ変数の場合 … … 444 442 //クラス内メンバを参照するとき(通常) 445 443 446 for(i=0;i<pobj_CompilingClass->iMemberNum;i++){ 447 if( pobj_CompilingClass->ppobj_Member[i]->GetName() == VarName ){ 444 bool isFound = false; 445 BOOST_FOREACH( CMember *pMember, pobj_CompilingClass->GetDynamicMembers() ){ 446 if( pMember->GetName() == VarName ){ 447 isFound = true; 448 448 break; 449 449 } 450 450 } 451 if( i==pobj_CompilingClass->iMemberNum) goto NonClassMember;451 if( !isFound ) goto NonClassMember; 452 452 } 453 453 … … 494 494 GetNowStaticVarFullName(VarName,temporary); 495 495 496 pVar = globalVars.Find( temporary);496 pVar = globalVars.Find( Symbol( temporary ) ); 497 497 if( pVar ){ 498 498 goto GlobalOk; … … 525 525 char temp2[VN_SIZE]; 526 526 sprintf(temp2,"%s.%s",VarName,temporary); 527 pVar = globalVars.Find( temp2);527 pVar = globalVars.Find( Symbol( temp2 ) ); 528 528 if( pVar ){ 529 529 lstrcpy(member,tempMember); … … 537 537 char temp2[VN_SIZE]; 538 538 sprintf(temp2,"%s.%s",pobj_CompilingClass->GetName().c_str(),VarName); 539 pVar = globalVars.Find( temp2);539 pVar = globalVars.Find( Symbol( temp2 ) ); 540 540 if( pVar ){ 541 541 goto GlobalOk; … … 547 547 ///////////////////// 548 548 549 pVar = globalVars.BackSearch( VarName);549 pVar = globalVars.BackSearch( Symbol( VarName ) ); 550 550 if( pVar ){ 551 551 goto GlobalOk; … … 716 716 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,const char *lpszInitBuf){ 717 717 extern BYTE *initGlobalBuf; 718 int i ,i2,i3;718 int i2,i3; 719 719 char temporary[VN_SIZE]; 720 720 char InitBuf[VN_SIZE]; … … 729 729 if(SubScripts[0]!=-1){ 730 730 typeSize*=JumpSubScripts(SubScripts+1); 731 i =0;731 int i=0; 732 732 i2=0; 733 733 while(1){ … … 751 751 const CClass &objClass = type.GetClass(); 752 752 753 for(i=0,i2=0;i2<objClass.iMemberNum;i2++){ 753 int i = 0; 754 BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){ 755 if(InitBuf[i]=='\0'){ 756 SetError(41,0,cp); 757 return false; 758 } 759 754 760 i=GetOneParameter(InitBuf,i,temporary); 755 761 756 i3=objClass.GetMemberOffset( objClass.ppobj_Member[i2]->GetName().c_str(), NULL );762 i3=objClass.GetMemberOffset( pMember->GetName().c_str(), NULL ); 757 763 758 764 if(!SetInitGlobalData(offset+i3, 759 objClass.ppobj_Member[i2]->GetType(),760 objClass.ppobj_Member[i2]->SubScripts,765 pMember->GetType(), 766 pMember->SubScripts, 761 767 temporary)) return false; 762 763 if(InitBuf[i]=='\0') break;764 }765 if(i2+1!=objClass.iMemberNum){766 SetError(41,0,cp);767 return false;768 768 } 769 769 return true; … … 889 889 const CClass &objClass = type.GetClass(); 890 890 891 for(i=0,i2=0;i2<objClass.iMemberNum;i2++){ 891 int i = 0; 892 BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){ 893 if(InitBuf[i]=='\0'){ 894 SetError(41,0,cp); 895 return false; 896 } 897 892 898 i=GetOneParameter(InitBuf,i,temporary); 893 899 894 i3=objClass.GetMemberOffset( objClass.ppobj_Member[i2]->GetName().c_str(), NULL );900 i3=objClass.GetMemberOffset( pMember->GetName().c_str(), NULL ); 895 901 896 902 if(!InitLocalVar(offset+i3, 897 objClass.ppobj_Member[i2]->GetType(),898 objClass.ppobj_Member[i2]->SubScripts,903 pMember->GetType(), 904 pMember->SubScripts, 899 905 temporary)) return false; 900 906 901 907 if(InitBuf[i]=='\0') break; 902 }903 if(i2+1!=objClass.iMemberNum){904 SetError(41,0,cp);905 return 0;906 908 } 907 909 return true; … … 1078 1080 ///////////////// 1079 1081 1080 if( UserProc::CompilingUserProc().localVars.DuplicateCheck( VarName) ){1082 if( UserProc::CompilingUserProc().localVars.DuplicateCheck( Symbol( VarName ) ) ){ 1081 1083 //2重定義のエラー 1082 1084 SetError(15,VarName,cp);
Note:
See TracChangeset
for help on using the changeset viewer.