Changeset 64 in dev for BasicCompiler_Common/Class.cpp
- Timestamp:
- Mar 8, 2007, 2:49:34 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/Class.cpp
r63 r64 101 101 102 102 int CMember::GetSize(){ 103 if( IsRef() ){104 // 参照型105 return PTR_SIZE;106 }107 108 103 //メンバサイズを取得 109 104 return GetTypeSize(TypeInfo.type,TypeInfo.u.lpIndex); … … 126 121 char temporary[VN_SIZE]; 127 122 sprintf(temporary,"%s.%s",pobj_c->name,member->name); 128 AddGlobalVariable(123 dim( 129 124 false, 130 125 temporary, 131 126 member->SubScripts, 132 &member->TypeInfo,127 member->TypeInfo, 133 128 GetTypeSize(member->TypeInfo.type,member->TypeInfo.u.lpIndex), 134 129 member->InitBuf, 135 130 member->ConstractParameter, 136 131 0); 137 138 if(member->TypeInfo.type==DEF_OBJECT){139 //エラー用140 cp=member->source_code_address;141 142 CallConstructor(temporary,143 member->SubScripts,144 member->TypeInfo,145 member->ConstractParameter);146 }147 132 148 133 //ネイティブコードバッファの再確保 … … 220 205 } 221 206 } 207 208 bool CClass::IsStructure() const 209 { 210 return classType == CClass::Structure; 211 } 212 222 213 void CClass::Inherits( CClass *pInheritsClass ){ 223 214 int i3; … … 437 428 //アラインメントを算出 438 429 int member_size; 439 if(pMember->TypeInfo.type==DEF_ OBJECT){430 if(pMember->TypeInfo.type==DEF_STRUCT){ 440 431 //メンバクラスのアラインメントを取得 441 432 member_size=pMember->TypeInfo.u.pobj_Class->GetAlignment(); … … 500 491 CMember *pMember = ppobj_Member[i]; 501 492 502 if(pMember->TypeInfo.type==DEF_ OBJECT && pMember->IsRef() == false){493 if(pMember->TypeInfo.type==DEF_STRUCT){ 503 494 //メンバクラスのアラインメントを取得 504 495 member_size=pMember->TypeInfo.u.pobj_Class->GetAlignment(); … … 598 589 //コンポジションの関係にあるメンバも検査する 599 590 for(int i=0;i < iMemberNum;i++){ 600 if(ppobj_Member[i]->TypeInfo.type==DEF_OBJECT && ppobj_Member[i]->IsRef() == false){591 if(ppobj_Member[i]->TypeInfo.type==DEF_OBJECT){ 601 592 if(ppobj_Member[i]->TypeInfo.u.pobj_Class->IsAbstract()) 602 593 return true; … … 805 796 806 797 //クラスを追加 807 pobj_DBClass->AddClass(temporary,NowLine); 798 CClass *pClass = pobj_DBClass->AddClass(temporary,NowLine); 799 if( pClass ){ 800 if( basbuf[NowLine+1] == ESC_CLASS ){ 801 pClass->classType = CClass::Class; 802 } 803 else if( basbuf[NowLine+1] == ESC_INTERFACE ){ 804 pClass->classType = CClass::Interface; 805 } 806 else{ 807 pClass->classType = CClass::Structure; 808 } 809 } 808 810 } 809 811 } … … 843 845 if(psi->ParmNum==0) fConstructor=1; 844 846 847 // TODO: 消す 845 848 //コピーコンストラクタ 846 849 if(psi->ParmNum==1){ … … 953 956 for(i=0;i<pobj_c->iMemberNum;i++){ 954 957 CMember *pMember = pobj_c->ppobj_Member[i]; 955 if(pMember->TypeInfo.type==DEF_OBJECT && pMember->IsRef()==false){958 if(pMember->TypeInfo.type==DEF_OBJECT){ 956 959 //循環参照でないかをチェック 957 960 if(pobj_LoopRefCheck->check(pMember->TypeInfo.u.pobj_Class->name)){ … … 976 979 extern char *basbuf; 977 980 int i,i2,i3,sub_address,top_pos; 978 DWORD dwClassType;979 981 DWORD dwAccess; 980 982 char temporary[8192]; … … 1132 1134 top_pos=i; 1133 1135 1134 dwClassType=basbuf[i+1];1136 const DWORD dwClassType=basbuf[i+1]; 1135 1137 1136 1138 i+=2; … … 1263 1265 i += 2; 1264 1266 } 1265 1267 /* 1266 1268 //Ref修飾子 1267 1269 bool isRef = false; … … 1269 1271 isRef = true; 1270 1272 i += 2; 1271 } 1273 }*/ 1272 1274 1273 1275 if(basbuf[i]==1&&( … … 1348 1350 //静的メンバを追加 1349 1351 cp=i; //エラー用 1350 pobj_c->AddStaticMember( dwAccess, isConst, isRef, temporary, i);1352 pobj_c->AddStaticMember( dwAccess, isConst, false, temporary, i); 1351 1353 } 1352 1354 else{ 1353 1355 //メンバを追加 1354 1356 cp=i; //エラー用 1355 pobj_c->AddMember( dwAccess, isConst, isRef, temporary ); 1356 1357 1358 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->TypeInfo.type==DEF_OBJECT){ 1357 pobj_c->AddMember( dwAccess, isConst, false, temporary ); 1358 1359 1360 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->TypeInfo.type==DEF_OBJECT|| 1361 pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->TypeInfo.type==DEF_STRUCT){ 1359 1362 if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->TypeInfo.u.pobj_Class->ppobj_Member==0){ 1360 1363 //参照先が読み取られていないとき … … 1376 1379 } 1377 1380 else{ 1378 // 文法エラーチェック1379 if( isRef ){1380 SetError(1,NULL,cp);1381 }1382 1383 1381 //メソッドを追加 1384 1382 cp=i; //エラー用
Note:
See TracChangeset
for help on using the changeset viewer.