Changeset 17 in dev for BasicCompiler32/Compile_Var.cpp
- Timestamp:
- Dec 20, 2006, 2:51:56 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_Var.cpp
r11 r17 157 157 return 1; 158 158 } 159 BOOL GetMemberOffset(bool ErrorEnabled,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){159 BOOL GetMemberOffset(bool isErrorEnabled, bool isWriteAccess, CClass *pobj_c, char *member, int *pType, RELATIVE_VAR *pRelativeVar, LONG_PTR *plpNestIndex, BOOL bPrivateAccess){ 160 160 int i,offset; 161 161 … … 175 175 offset=GetSizeOfClassMember(pobj_c,VarName,&i); 176 176 if(i==pobj_c->iMemberNum){ 177 if( ErrorEnabled) SetError(103,VarName,cp);177 if(isErrorEnabled) SetError(103,VarName,cp); 178 178 return 0; 179 179 } … … 183 183 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 184 184 if(pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){ 185 if( ErrorEnabled) SetError(107,VarName,cp);185 if(isErrorEnabled) SetError(107,VarName,cp); 186 186 return 0; 187 187 } … … 190 190 if((bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)|| 191 191 pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){ 192 if( ErrorEnabled) SetError(107,VarName,cp);192 if(isErrorEnabled) SetError(107,VarName,cp); 193 193 return 0; 194 194 } 195 195 else if(bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PROTECTED){ 196 if( ErrorEnabled) SetError(108,VarName,cp);196 if(isErrorEnabled) SetError(108,VarName,cp); 197 197 return 0; 198 198 } 199 } 200 201 //Const定義の場合は書き込みアクセスを制限する 202 //※コンストラクタをコンパイル中の場合は例外的に許可する 203 if( pobj_c->ppobj_Member[i]->IsConst() && //定数メンバである 204 isWriteAccess && //書き込みアクセスを要求されている 205 pobj_c->IsCompilingConstructor() == false //コンストラクタ コンパイル中を除く 206 ){ 207 //Const定義の変数に書き込みアクセスをしようとした場合 208 SetError(61,VarName,cp); 199 209 } 200 210 … … 211 221 else{ 212 222 if(lpPtrOffset[0]){ 213 if( ErrorEnabled) SetError(16,member,cp);223 if(isErrorEnabled) SetError(16,member,cp); 214 224 return 0; 215 225 } … … 227 237 //配列オフセット 228 238 if(!GetArrayOffset(pobj_c->ppobj_Member[i]->SubScripts,array,*pType,pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex)) 229 if( ErrorEnabled) SetError(14,member,cp);239 if(isErrorEnabled) SetError(14,member,cp); 230 240 } 231 241 else if(pobj_c->ppobj_Member[i]->SubScripts[0]!=-1){ … … 238 248 if(*pType==DEF_OBJECT){ 239 249 if(RefType!=DEF_OBJECT){ 240 if( ErrorEnabled) SetError(104,member,cp);250 if(isErrorEnabled) SetError(104,member,cp); 241 251 return 0; 242 252 } … … 248 258 //pObj[n].member 249 259 if(RefType!=DEF_OBJECT){ 250 if( ErrorEnabled) SetError(104,member,cp);260 if(isErrorEnabled) SetError(104,member,cp); 251 261 return 0; 252 262 } … … 261 271 //pObj->member 262 272 if(RefType!=DEF_PTR_OBJECT){ 263 if( ErrorEnabled) SetError(104,member,cp);273 if(isErrorEnabled) SetError(104,member,cp); 264 274 return 0; 265 275 } … … 287 297 //ppObj[n]->member 288 298 if(RefType!=DEF_PTR_OBJECT){ 289 if( ErrorEnabled) SetError(104,member,cp);299 if(isErrorEnabled) SetError(104,member,cp); 290 300 return 0; 291 301 } … … 302 312 } 303 313 else{ 304 if( ErrorEnabled) SetError(104,member,cp);314 if(isErrorEnabled) SetError(104,member,cp); 305 315 return 0; 306 316 } 307 317 } 308 318 309 if(!GetMemberOffset(ErrorEnabled,pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class, 319 if(!GetMemberOffset( 320 isErrorEnabled, 321 isWriteAccess, 322 pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class, 310 323 NestMember, 311 324 pType, … … 344 357 } 345 358 346 BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){359 BOOL GetVarOffset(bool isErrorEnabled, bool isWriteAccess, char *NameBuffer, int *pType, RELATIVE_VAR *pRelativeVar, LONG_PTR *plpIndex, int *pss){ 347 360 extern BOOL bCompilingGlobal; 348 361 int i,RefType; … … 441 454 442 455 pRelativeVar->dwKind=VAR_DIRECTMEM; 443 if(!GetMemberOffset(ErrorEnabled,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0; 456 if(!GetMemberOffset( 457 isErrorEnabled, 458 isWriteAccess, 459 pobj_CompilingClass, 460 variable, 461 pType, 462 pRelativeVar, 463 &lpIndex,1)) return 0; 444 464 if(plpIndex) *plpIndex=lpIndex; 445 465 return 1; … … 513 533 } 514 534 515 if( ErrorEnabled) SetError(3,variable,cp);535 if(isErrorEnabled) SetError(3,variable,cp); 516 536 pRelativeVar->dwKind=NON_VAR; 517 537 return 0; … … 547 567 ok: 548 568 549 if(bConst && WriteAccess){569 if(bConst && isWriteAccess){ 550 570 //Const定義の変数に書き込みアクセスをしようとした場合 551 571 SetError(61,VarName,cp); … … 581 601 return 0; 582 602 } 583 584 LONG_PTR lp2;585 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;586 if(plpIndex) *plpIndex=lp2;587 603 } 588 604 else if(*pType==DEF_PTR_OBJECT){ … … 597 613 SetRelativeOffset(pType,lpIndex,pRelativeVar,lpPtrOffset); 598 614 pRelativeVar->dwKind=VAR_DIRECTMEM; 599 600 LONG_PTR lp2;601 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;602 if(plpIndex) *plpIndex=lp2;603 615 } 604 616 else{ … … 616 628 OpBuffer[obp++]=(char)0x8B; 617 629 OpBuffer[obp++]=(char)0x08; 618 619 LONG_PTR lp2;620 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;621 if(plpIndex) *plpIndex=lp2;622 630 } 623 631 } … … 641 649 OpBuffer[obp++]=(char)0x8B; 642 650 OpBuffer[obp++]=(char)0x08; 643 644 LONG_PTR lp2;645 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;646 if(plpIndex) *plpIndex=lp2;647 651 } 648 652 else{ … … 657 661 return 0; 658 662 } 663 664 LONG_PTR lp2; 665 if(!GetMemberOffset( 666 isErrorEnabled, 667 isWriteAccess, 668 (CClass *)lpIndex, 669 member,pType,pRelativeVar,&lp2,0)) return 0; 670 if(plpIndex) *plpIndex=lp2; 671 659 672 return 1; 660 673 }
Note:
See TracChangeset
for help on using the changeset viewer.