Changeset 11 in dev for BasicCompiler64/Compile_Var.cpp
- Timestamp:
- Dec 8, 2006, 3:25:27 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/Compile_Var.cpp
r9 r11 179 179 return 1; 180 180 } 181 BOOL GetMemberOffset( BOOL bError,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){181 BOOL GetMemberOffset(bool ErrorEnabled,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( bError) SetError(103,VarName,cp);204 if(ErrorEnabled) 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( bError) SetError(107,VarName,cp);213 if(ErrorEnabled) 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( bError) SetError(107,VarName,cp);220 if(ErrorEnabled) 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( bError) SetError(108,VarName,cp);224 if(ErrorEnabled) SetError(108,VarName,cp); 225 225 return 0; 226 226 } … … 239 239 else{ 240 240 if(lpPtrOffset[0]){ 241 if( bError) SetError(16,member,cp);241 if(ErrorEnabled) SetError(16,member,cp); 242 242 return 0; 243 243 } … … 256 256 //配列オフセット 257 257 if(!GetArrayOffset(pobj_c->ppobj_Member[i]->SubScripts,array,*pType,pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex)){ 258 if( bError) SetError(14,member,cp);258 if(ErrorEnabled) SetError(14,member,cp); 259 259 } 260 260 } … … 268 268 if(*pType==DEF_OBJECT){ 269 269 if(RefType!=DEF_OBJECT){ 270 if( bError) SetError(104,member,cp);270 if(ErrorEnabled) SetError(104,member,cp); 271 271 return 0; 272 272 } … … 278 278 //pObj[n].member 279 279 if(RefType!=DEF_OBJECT){ 280 if( bError) SetError(104,member,cp);280 if(ErrorEnabled) SetError(104,member,cp); 281 281 return 0; 282 282 } … … 291 291 //pObj->member 292 292 if(RefType!=DEF_PTR_OBJECT){ 293 if( bError) SetError(104,member,cp);293 if(ErrorEnabled) SetError(104,member,cp); 294 294 return 0; 295 295 } … … 315 315 //ppObj[n]->member 316 316 if(RefType!=DEF_PTR_OBJECT){ 317 if( bError) SetError(104,member,cp);317 if(ErrorEnabled) SetError(104,member,cp); 318 318 return 0; 319 319 } … … 329 329 } 330 330 else{ 331 if( bError) SetError(104,member,cp);331 if(ErrorEnabled) SetError(104,member,cp); 332 332 return 0; 333 333 } 334 334 } 335 335 336 if(!GetMemberOffset( bError,336 if(!GetMemberOffset(ErrorEnabled, 337 337 pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class, 338 338 NestMember, … … 371 371 SetReg_WholeVariable(DEF_PTR_VOID,&RelativeVar,reg); 372 372 } 373 BOOL GetVarOffset( BOOL bError,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){373 BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){ 374 374 extern BOOL bCompilingGlobal; 375 375 int i,RefType; … … 387 387 LONG_PTR lpIndex; 388 388 int *pSubScripts; 389 bool bConst = false; 389 390 390 391 … … 423 424 if(plpIndex) *plpIndex=lpIndex; 424 425 pSubScripts=LocalVar[i].SubScripts; 426 bConst = LocalVar[i].bConst; 425 427 426 428 goto ok; … … 463 465 464 466 pRelativeVar->dwKind=VAR_DIRECTMEM; 465 if(!GetMemberOffset( bError,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0;467 if(!GetMemberOffset(ErrorEnabled,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0; 466 468 if(plpIndex) *plpIndex=lpIndex; 467 469 return 1; … … 534 536 } 535 537 536 if( bError) SetError(3,variable,cp);538 if(ErrorEnabled) SetError(3,variable,cp); 537 539 pRelativeVar->dwKind=NON_VAR; 538 540 return 0; … … 563 565 if(plpIndex) *plpIndex=lpIndex; 564 566 pSubScripts=GlobalVar[i].SubScripts; 567 bConst = GlobalVar[i].bConst; 565 568 566 569 … … 568 571 ok: 569 572 573 if(bConst && WriteAccess){ 574 //Const定義の変数に書き込みアクセスをしようとした場合 575 SetError(61,VarName,cp); 576 } 570 577 571 578 if(array[0]==0&&pSubScripts[0]!=-1){ … … 600 607 601 608 LONG_PTR lp2; 602 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;609 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 603 610 if(plpIndex) *plpIndex=lp2; 604 611 } … … 616 623 617 624 LONG_PTR lp2; 618 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;625 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 619 626 if(plpIndex) *plpIndex=lp2; 620 627 } … … 634 641 635 642 LONG_PTR lp2; 636 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;643 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 637 644 if(plpIndex) *plpIndex=lp2; 638 645 } … … 658 665 659 666 LONG_PTR lp2; 660 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;667 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 661 668 if(plpIndex) *plpIndex=lp2; 662 669 } … … 1109 1116 lstrcpy(pVar->name,VarName); 1110 1117 pVar->fRef=0; 1111 if(dwFlag & DIMFLAG_CONST) pVar->bConst = 1;1112 else pVar->bConst = 0;1118 if(dwFlag & DIMFLAG_CONST) pVar->bConst = true; 1119 else pVar->bConst = false; 1113 1120 if(SubScripts[0]==-1) pVar->bArray=0; 1114 1121 else pVar->bArray=1; … … 1124 1131 1125 1132 if(InitBuf[0]){ 1133 //初期代入時のみ、書き込みアクセスを許可する 1134 bool bConstBack = pVar->bConst; 1135 pVar->bConst = false; 1136 1126 1137 int result = InitLocalVar(-pVar->offset, 1127 1138 pVar->type, … … 1136 1147 OpcodeCalc(temporary); 1137 1148 } 1149 1150 pVar->bConst = bConstBack; 1138 1151 } 1139 1152 else{
Note:
See TracChangeset
for help on using the changeset viewer.