Changeset 137 in dev for BasicCompiler_Common/Class.cpp
- Timestamp:
- Jun 8, 2007, 3:11:47 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/Class.cpp
r135 r137 165 165 ppobj_Member[iMemberNum]=new CMember( *inheritsClass.ppobj_Member[i3] ); 166 166 167 //dwAccess 168 if(inheritsClass.ppobj_Member[i3]->dwAccess==ACCESS_PRIVATE) 169 ppobj_Member[iMemberNum]->dwAccess=ACCESS_NON; 170 else ppobj_Member[iMemberNum]->dwAccess=inheritsClass.ppobj_Member[i3]->dwAccess; 167 // アクセシビリティ 168 if( inheritsClass.ppobj_Member[i3]->IsPrivate() ){ 169 ppobj_Member[iMemberNum]->SetAccessibility( Prototype::None ); 170 } 171 else{ 172 ppobj_Member[iMemberNum]->SetAccessibility( inheritsClass.ppobj_Member[i3]->GetAccessibility() ); 173 } 171 174 172 175 iMemberNum++; … … 177 180 CMethod *pMethod = new DynamicMethod( *pBaseMethod ); 178 181 179 //dwAccess 180 if(pBaseMethod->dwAccess==ACCESS_PRIVATE) 181 pMethod->dwAccess=ACCESS_NON; 182 else pMethod->dwAccess=pBaseMethod->dwAccess; 182 // アクセシビリティ 183 if(pBaseMethod->GetAccessibility() == Prototype::Private){ 184 pMethod->SetAccessibility( Prototype::None ); 185 } 186 else{ 187 pMethod->SetAccessibility( pBaseMethod->GetAccessibility() ); 188 } 183 189 184 190 //pobj_Inherits … … 221 227 CMethod *pMethod = new DynamicMethod( *pBaseMethod ); 222 228 223 //dwAccess 224 if(pBaseMethod->dwAccess==ACCESS_PRIVATE) 225 pMethod->dwAccess=ACCESS_NON; 226 else pMethod->dwAccess=pBaseMethod->dwAccess; 229 // アクセシビリティ 230 if(pBaseMethod->GetAccessibility() == Prototype::Private){ 231 pMethod->SetAccessibility( Prototype::None ); 232 } 233 else{ 234 pMethod->SetAccessibility( pBaseMethod->GetAccessibility() ); 235 } 227 236 228 237 //pobj_Inherits … … 245 254 return true; 246 255 } 247 void CClass::AddMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer ){256 void CClass::AddMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer ){ 248 257 ppobj_Member = (CMember **)HeapReAlloc( hHeap, 0, ppobj_Member, ( iMemberNum + 1 ) * sizeof(CMember *) ); 249 ppobj_Member[iMemberNum] = new CMember( this, dwAccess, isConst, isRef, buffer );258 ppobj_Member[iMemberNum] = new CMember( this, accessibility, isConst, isRef, buffer ); 250 259 iMemberNum++; 251 260 } 252 void CClass::AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int nowLine ){253 CMember *member = new CMember( this, dwAccess, isConst, isRef, buffer, nowLine );261 void CClass::AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ){ 262 CMember *member = new CMember( this, accessibility, isConst, isRef, buffer, nowLine ); 254 263 staticMembers.push_back( member ); 255 264 } … … 326 335 CMember *pMember = ppobj_Member[i]; 327 336 328 i2 = pMember->Get Size();337 i2 = pMember->GetType().GetSize(); 329 338 330 339 //アラインメントを算出 331 340 int member_size; 332 if( pMember-> IsStruct() ){341 if( pMember->GetType().IsStruct() ){ 333 342 //メンバクラスのアラインメントを取得 334 member_size=pMember->Get Class().GetAlignment();343 member_size=pMember->GetType().GetClass().GetAlignment(); 335 344 } 336 345 else{ … … 393 402 CMember *pMember = ppobj_Member[i]; 394 403 395 if(pMember-> IsStruct()){404 if(pMember->GetType().IsStruct()){ 396 405 //メンバクラスのアラインメントを取得 397 member_size=pMember->Get Class().GetAlignment();406 member_size=pMember->GetType().GetClass().GetAlignment(); 398 407 } 399 408 else{ 400 409 //メンバサイズを取得 401 member_size = pMember->Get Size();410 member_size = pMember->GetType().GetSize(); 402 411 } 403 412 … … 837 846 838 847 839 void CDBClass::AddMethod(CClass *pobj_c, DWORD dwAccess, BOOL bStatic, bool isConst, bool isAbstract,848 void CDBClass::AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract, 840 849 bool isVirtual, bool isOverride, char *buffer, int nowLine){ 841 850 int i,i2; … … 932 941 SetError(127,NULL,nowLine); 933 942 } 934 if(pMethod-> dwAccess!=dwAccess){943 if(pMethod->GetAccessibility() != accessibility ){ 935 944 SetError(128,NULL,nowLine); 936 945 } … … 952 961 953 962 if(bStatic){ 954 pobj_c->staticMethods.AddStatic( pUserProc,dwAccess);963 pobj_c->staticMethods.AddStatic( pUserProc, accessibility ); 955 964 } 956 965 else{ 957 pobj_c->methods.Add(pUserProc, dwAccess, isConst, isAbstract, isVirtual);966 pobj_c->methods.Add(pUserProc, accessibility, isConst, isAbstract, isVirtual); 958 967 } 959 968 } … … 963 972 for(i=0;i<objClass.iMemberNum;i++){ 964 973 const CMember *pMember = objClass.ppobj_Member[i]; 965 if(pMember-> IsStruct()){974 if(pMember->GetType().IsStruct()){ 966 975 //循環参照でないかをチェック 967 if(pobj_LoopRefCheck->check(pMember->Get Class())){976 if(pobj_LoopRefCheck->check(pMember->GetType().GetClass())){ 968 977 extern int cp; 969 SetError(124,pMember->Get Class().GetName(),cp);978 SetError(124,pMember->GetType().GetClass().GetName(),cp); 970 979 return 0; 971 980 } … … 973 982 pobj_LoopRefCheck->add(objClass.GetName().c_str()); 974 983 975 i2=MemberVar_LoopRefCheck(pMember->Get Class());984 i2=MemberVar_LoopRefCheck(pMember->GetType().GetClass()); 976 985 if(bRet==1) bRet=i2; 977 986 … … 986 995 extern char *basbuf; 987 996 int i,i2,i3,sub_address,top_pos; 988 DWORD dwAccess;989 997 char temporary[8192]; 990 998 … … 1140 1148 //メンバ関数を追加 1141 1149 AddMethod(pobj_c, 1142 ACCESS_PUBLIC,//Publicアクセス権1150 Prototype::Public, //Publicアクセス権 1143 1151 0, //Static指定なし 1144 1152 false, //Constではない … … 1212 1220 1213 1221 //アクセス制限の初期値をセット 1214 if(dwClassType==ESC_CLASS) dwAccess=ACCESS_PRIVATE; 1215 else dwAccess=ACCESS_PUBLIC; 1222 Prototype::Accessibility accessibility; 1223 if(dwClassType==ESC_CLASS){ 1224 accessibility = Prototype::Private; 1225 } 1226 else{ 1227 accessibility = Prototype::Public; 1228 } 1216 1229 1217 1230 if( pobj_c->GetName() == "Object" || dwClassType == ESC_TYPE ){ … … 1342 1355 //アクセスを変更 1343 1356 if(lstrcmpi(temporary,"Private")==0){ 1344 dwAccess=ACCESS_PRIVATE;1357 accessibility = Prototype::Private; 1345 1358 continue; 1346 1359 } 1347 1360 if(lstrcmpi(temporary,"Public")==0){ 1348 dwAccess=ACCESS_PUBLIC;1361 accessibility = Prototype::Public; 1349 1362 continue; 1350 1363 } 1351 1364 if(lstrcmpi(temporary,"Protected")==0){ 1352 dwAccess=ACCESS_PROTECTED;1365 accessibility = Prototype::Protected; 1353 1366 continue; 1354 1367 } … … 1359 1372 //静的メンバを追加 1360 1373 cp=i; //エラー用 1361 pobj_c->AddStaticMember( dwAccess, isConst, false, temporary, i);1374 pobj_c->AddStaticMember( accessibility, isConst, false, temporary, i); 1362 1375 } 1363 1376 else{ 1364 1377 //メンバを追加 1365 1378 cp=i; //エラー用 1366 pobj_c->AddMember( dwAccess, isConst, false, temporary );1367 1368 1369 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]-> IsStruct()){1370 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->Get Class().ppobj_Member==0){1379 pobj_c->AddMember( accessibility, isConst, false, temporary ); 1380 1381 1382 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().IsStruct()){ 1383 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass().ppobj_Member==0){ 1371 1384 //参照先が読み取られていないとき 1372 GetClass_recur(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->Get Class().GetName().c_str());1385 GetClass_recur(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass().GetName().c_str()); 1373 1386 } 1374 1387 } 1375 1388 1376 1389 1377 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]-> IsStruct()){1390 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().IsStruct()){ 1378 1391 //循環参照のチェック 1379 1392 pobj_LoopRefCheck->add(pobj_c->GetName().c_str()); 1380 if(!MemberVar_LoopRefCheck(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->Get Class())){1393 if(!MemberVar_LoopRefCheck(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass())){ 1381 1394 //エラー回避 1382 pobj_c->ppobj_Member[pobj_c->iMemberNum-1]-> SetBasicType( DEF_PTR_VOID );1395 pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().SetBasicType( DEF_PTR_VOID ); 1383 1396 } 1384 1397 pobj_LoopRefCheck->del(pobj_c->GetName().c_str()); … … 1390 1403 cp=i; //エラー用 1391 1404 AddMethod(pobj_c, 1392 dwAccess,1405 accessibility, 1393 1406 bStatic, 1394 1407 isConst, … … 1466 1479 CMember &member = *objClass.ppobj_Member[i]; 1467 1480 1468 if( member. IsObject() || member.IsPointer() ){1481 if( member.GetType().IsObject() || member.GetType().IsPointer() ){ 1469 1482 if( referenceOffsetsBuffer[0] ){ 1470 1483 lstrcat( referenceOffsetsBuffer, "," );
Note:
See TracChangeset
for help on using the changeset viewer.