Changeset 11 in dev for BasicCompiler32/Compile_Var.cpp
- Timestamp:
- Dec 8, 2006, 3:25:27 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_Var.cpp
r8 r11 157 157 return 1; 158 158 } 159 BOOL GetMemberOffset( BOOL bError,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){159 BOOL GetMemberOffset(bool ErrorEnabled,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( bError) SetError(103,VarName,cp);177 if(ErrorEnabled) 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( bError) SetError(107,VarName,cp);185 if(ErrorEnabled) 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( bError) SetError(107,VarName,cp);192 if(ErrorEnabled) 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( bError) SetError(108,VarName,cp);196 if(ErrorEnabled) SetError(108,VarName,cp); 197 197 return 0; 198 198 } … … 211 211 else{ 212 212 if(lpPtrOffset[0]){ 213 if( bError) SetError(16,member,cp);213 if(ErrorEnabled) SetError(16,member,cp); 214 214 return 0; 215 215 } … … 227 227 //配列オフセット 228 228 if(!GetArrayOffset(pobj_c->ppobj_Member[i]->SubScripts,array,*pType,pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex)) 229 if( bError) SetError(14,member,cp);229 if(ErrorEnabled) SetError(14,member,cp); 230 230 } 231 231 else if(pobj_c->ppobj_Member[i]->SubScripts[0]!=-1){ … … 238 238 if(*pType==DEF_OBJECT){ 239 239 if(RefType!=DEF_OBJECT){ 240 if( bError) SetError(104,member,cp);240 if(ErrorEnabled) SetError(104,member,cp); 241 241 return 0; 242 242 } … … 248 248 //pObj[n].member 249 249 if(RefType!=DEF_OBJECT){ 250 if( bError) SetError(104,member,cp);250 if(ErrorEnabled) SetError(104,member,cp); 251 251 return 0; 252 252 } … … 261 261 //pObj->member 262 262 if(RefType!=DEF_PTR_OBJECT){ 263 if( bError) SetError(104,member,cp);263 if(ErrorEnabled) SetError(104,member,cp); 264 264 return 0; 265 265 } … … 287 287 //ppObj[n]->member 288 288 if(RefType!=DEF_PTR_OBJECT){ 289 if( bError) SetError(104,member,cp);289 if(ErrorEnabled) SetError(104,member,cp); 290 290 return 0; 291 291 } … … 302 302 } 303 303 else{ 304 if( bError) SetError(104,member,cp);304 if(ErrorEnabled) SetError(104,member,cp); 305 305 return 0; 306 306 } 307 307 } 308 308 309 if(!GetMemberOffset( bError,pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class,309 if(!GetMemberOffset(ErrorEnabled,pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class, 310 310 NestMember, 311 311 pType, … … 344 344 } 345 345 346 BOOL GetVarOffset( BOOL bError,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){346 BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){ 347 347 extern BOOL bCompilingGlobal; 348 348 int i,RefType; … … 360 360 LONG_PTR lpIndex; 361 361 int *pSubScripts; 362 bool bConst; 362 363 363 364 if(bCompilingGlobal==0){ … … 395 396 if(plpIndex) *plpIndex=lpIndex; 396 397 pSubScripts=LocalVar[i].SubScripts; 398 bConst = LocalVar[i].bConst; 397 399 398 400 goto ok; … … 439 441 440 442 pRelativeVar->dwKind=VAR_DIRECTMEM; 441 if(!GetMemberOffset( bError,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0;443 if(!GetMemberOffset(ErrorEnabled,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0; 442 444 if(plpIndex) *plpIndex=lpIndex; 443 445 return 1; … … 511 513 } 512 514 513 if( bError) SetError(3,variable,cp);515 if(ErrorEnabled) SetError(3,variable,cp); 514 516 pRelativeVar->dwKind=NON_VAR; 515 517 return 0; … … 540 542 if(plpIndex) *plpIndex=lpIndex; 541 543 pSubScripts=GlobalVar[i].SubScripts; 544 bConst = GlobalVar[i].bConst; 542 545 543 546 544 547 ok: 545 548 549 if(bConst && WriteAccess){ 550 //Const定義の変数に書き込みアクセスをしようとした場合 551 SetError(61,VarName,cp); 552 } 546 553 547 554 if(array[0]==0&&pSubScripts[0]!=-1){ … … 576 583 577 584 LONG_PTR lp2; 578 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;585 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 579 586 if(plpIndex) *plpIndex=lp2; 580 587 } … … 592 599 593 600 LONG_PTR lp2; 594 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;601 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 595 602 if(plpIndex) *plpIndex=lp2; 596 603 } … … 611 618 612 619 LONG_PTR lp2; 613 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;620 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 614 621 if(plpIndex) *plpIndex=lp2; 615 622 } … … 636 643 637 644 LONG_PTR lp2; 638 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;645 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 639 646 if(plpIndex) *plpIndex=lp2; 640 647 } … … 1117 1124 lstrcpy(pVar->name,VarName); 1118 1125 pVar->fRef=0; 1119 if(dwFlag & DIMFLAG_CONST) pVar->bConst = 1;1120 else pVar->bConst = 0;1126 if(dwFlag & DIMFLAG_CONST) pVar->bConst = true; 1127 else pVar->bConst = false; 1121 1128 if(SubScripts[0]==-1) pVar->bArray=0; 1122 1129 else pVar->bArray=1; … … 1132 1139 1133 1140 if(InitBuf[0]){ 1141 //初期代入時のみ、書き込みアクセスを許可する 1142 bool bConstBack = pVar->bConst; 1143 pVar->bConst = false; 1144 1134 1145 int result = InitLocalVar(-pVar->offset, 1135 1146 pVar->type, … … 1144 1155 OpcodeCalc(temporary); 1145 1156 } 1157 1158 pVar->bConst = bConstBack; 1146 1159 } 1147 1160 else{
Note:
See TracChangeset
for help on using the changeset viewer.