Changeset 17 in dev for BasicCompiler64/Compile_Var.cpp
- Timestamp:
- Dec 20, 2006, 2:51:56 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/Compile_Var.cpp
r11 r17 179 179 return 1; 180 180 } 181 BOOL GetMemberOffset(bool ErrorEnabled,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){181 BOOL GetMemberOffset(bool isErrorEnabled, bool isWriteAccess, CClass *pobj_c, char *member, int *pType, RELATIVE_VAR *pRelativeVar, LONG_PTR *plpNestIndex, BOOL bPrivateAccess){ 182 182 int i,offset; 183 183 … … 202 202 offset=GetSizeOfClassMember(pobj_c,VarName,&i); 203 203 if(i==pobj_c->iMemberNum){ 204 if( ErrorEnabled) SetError(103,VarName,cp);204 if(isErrorEnabled) SetError(103,VarName,cp); 205 205 return 0; 206 206 } … … 211 211 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 212 212 if(pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){ 213 if( ErrorEnabled) SetError(107,VarName,cp);213 if(isErrorEnabled) SetError(107,VarName,cp); 214 214 return 0; 215 215 } … … 218 218 if((bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)|| 219 219 pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){ 220 if( ErrorEnabled) SetError(107,VarName,cp);220 if(isErrorEnabled) SetError(107,VarName,cp); 221 221 return 0; 222 222 } 223 223 else if(bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PROTECTED){ 224 if( ErrorEnabled) SetError(108,VarName,cp);224 if(isErrorEnabled) SetError(108,VarName,cp); 225 225 return 0; 226 226 } 227 } 228 229 //Const定義の場合は書き込みアクセスを制限する 230 //※コンストラクタをコンパイル中の場合は例外的に許可する 231 if( pobj_c->ppobj_Member[i]->IsConst() && //定数メンバである 232 isWriteAccess && //書き込みアクセスを要求されている 233 pobj_c->IsCompilingConstructor() == false //コンストラクタ コンパイル中を除く 234 ){ 235 //Const定義の変数に書き込みアクセスをしようとした場合 236 SetError(61,VarName,cp); 227 237 } 228 238 … … 239 249 else{ 240 250 if(lpPtrOffset[0]){ 241 if( ErrorEnabled) SetError(16,member,cp);251 if(isErrorEnabled) SetError(16,member,cp); 242 252 return 0; 243 253 } … … 256 266 //配列オフセット 257 267 if(!GetArrayOffset(pobj_c->ppobj_Member[i]->SubScripts,array,*pType,pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex)){ 258 if( ErrorEnabled) SetError(14,member,cp);268 if(isErrorEnabled) SetError(14,member,cp); 259 269 } 260 270 } … … 268 278 if(*pType==DEF_OBJECT){ 269 279 if(RefType!=DEF_OBJECT){ 270 if( ErrorEnabled) SetError(104,member,cp);280 if(isErrorEnabled) SetError(104,member,cp); 271 281 return 0; 272 282 } … … 278 288 //pObj[n].member 279 289 if(RefType!=DEF_OBJECT){ 280 if( ErrorEnabled) SetError(104,member,cp);290 if(isErrorEnabled) SetError(104,member,cp); 281 291 return 0; 282 292 } … … 291 301 //pObj->member 292 302 if(RefType!=DEF_PTR_OBJECT){ 293 if( ErrorEnabled) SetError(104,member,cp);303 if(isErrorEnabled) SetError(104,member,cp); 294 304 return 0; 295 305 } … … 315 325 //ppObj[n]->member 316 326 if(RefType!=DEF_PTR_OBJECT){ 317 if( ErrorEnabled) SetError(104,member,cp);327 if(isErrorEnabled) SetError(104,member,cp); 318 328 return 0; 319 329 } … … 329 339 } 330 340 else{ 331 if( ErrorEnabled) SetError(104,member,cp);341 if(isErrorEnabled) SetError(104,member,cp); 332 342 return 0; 333 343 } 334 344 } 335 345 336 if(!GetMemberOffset(ErrorEnabled, 346 if(!GetMemberOffset( 347 isErrorEnabled, 348 isWriteAccess, 337 349 pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class, 338 350 NestMember, … … 371 383 SetReg_WholeVariable(DEF_PTR_VOID,&RelativeVar,reg); 372 384 } 373 BOOL GetVarOffset(bool ErrorEnabled,boolWriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){385 BOOL GetVarOffset(bool isErrorEnabled,bool isWriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){ 374 386 extern BOOL bCompilingGlobal; 375 387 int i,RefType; … … 465 477 466 478 pRelativeVar->dwKind=VAR_DIRECTMEM; 467 if(!GetMemberOffset(ErrorEnabled,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0; 479 if(!GetMemberOffset( 480 isErrorEnabled, 481 isWriteAccess, 482 pobj_CompilingClass, 483 variable, 484 pType, 485 pRelativeVar, 486 &lpIndex,1)) return 0; 468 487 if(plpIndex) *plpIndex=lpIndex; 469 488 return 1; … … 536 555 } 537 556 538 if( ErrorEnabled) SetError(3,variable,cp);557 if(isErrorEnabled) SetError(3,variable,cp); 539 558 pRelativeVar->dwKind=NON_VAR; 540 559 return 0; … … 571 590 ok: 572 591 573 if(bConst && WriteAccess){592 if(bConst && isWriteAccess){ 574 593 //Const定義の変数に書き込みアクセスをしようとした場合 575 594 SetError(61,VarName,cp); … … 605 624 return 0; 606 625 } 607 608 LONG_PTR lp2;609 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;610 if(plpIndex) *plpIndex=lp2;611 626 } 612 627 else if(*pType==DEF_PTR_OBJECT){ … … 621 636 SetRelativeOffset(pType,lpIndex,pRelativeVar,lpPtrOffset); 622 637 pRelativeVar->dwKind=VAR_DIRECTMEM; 623 624 LONG_PTR lp2;625 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;626 if(plpIndex) *plpIndex=lp2;627 638 } 628 639 else{ … … 639 650 //mov r11,qword ptr[r12] 640 651 op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE); 641 642 LONG_PTR lp2;643 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;644 if(plpIndex) *plpIndex=lp2;645 652 } 646 653 } … … 663 670 //mov r11,qword ptr[r12] 664 671 op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE); 665 666 LONG_PTR lp2;667 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;668 if(plpIndex) *plpIndex=lp2;669 672 } 670 673 else{ … … 679 682 return 0; 680 683 } 684 685 LONG_PTR lp2; 686 if(!GetMemberOffset( 687 isErrorEnabled, 688 isWriteAccess, 689 (CClass *)lpIndex, 690 member,pType,pRelativeVar,&lp2,0)) return 0; 691 if(plpIndex) *plpIndex=lp2; 692 681 693 return 1; 682 694 }
Note:
See TracChangeset
for help on using the changeset viewer.