Changeset 346 in dev
- Timestamp:
- Oct 10, 2007, 4:01:07 AM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Object.cpp
r343 r346 224 224 } 225 225 } 226 BOOST_FOREACH( const ::Interface &objInterface, classObj.GetInterfaces() )226 BOOST_FOREACH( const ::Interface *pInterface, classObj.GetInterfaces() ) 227 227 { 228 BOOST_FOREACH( const CMethod *pMethod, objInterface.GetDynamicMethods() )228 BOOST_FOREACH( const CMethod *pMethod, pInterface->GetDynamicMethods() ) 229 229 { 230 230 if( pMethod->IsVirtual() ) -
trunk/abdev/BasicCompiler64/Compile_Object.cpp
r345 r346 219 219 } 220 220 } 221 BOOST_FOREACH( const ::Interface &objInterface, classObj.GetInterfaces() )221 BOOST_FOREACH( const ::Interface *pInterface, classObj.GetInterfaces() ) 222 222 { 223 BOOST_FOREACH( const CMethod *pMethod, objInterface.GetDynamicMethods() )223 BOOST_FOREACH( const CMethod *pMethod, pInterface->GetDynamicMethods() ) 224 224 { 225 225 if( pMethod->IsVirtual() ) -
trunk/abdev/BasicCompiler_Common/include/Class.h
r345 r346 98 98 } 99 99 }; 100 typedef std::vector<Interface > Interfaces;100 typedef std::vector<Interface *> Interfaces; 101 101 102 102 class CClass: public ClassPrototype, public Jenga::Common::ObjectInHashmap<CClass> … … 215 215 { 216 216 // 動的メンバ 217 BOOST_FOREACH( CMember *member, dynamicMembers ){ 217 BOOST_FOREACH( CMember *member, dynamicMembers ) 218 { 218 219 delete member; 219 220 } 220 221 221 222 // 静的メンバ 222 BOOST_FOREACH( CMember *member, staticMembers ){ 223 BOOST_FOREACH( CMember *member, staticMembers ) 224 { 223 225 delete member; 226 } 227 228 // インターフェイス 229 BOOST_FOREACH( ::Interface *pInterface, interfaces ) 230 { 231 delete pInterface; 224 232 } 225 233 } -
trunk/abdev/BasicCompiler_Common/include/Method.h
r336 r346 197 197 void AddStatic(UserProc *pUserProc,Prototype::Accessibility accessibility); 198 198 199 // オーバーライド 200 bool Override( UserProc *pUserProc, Prototype::Accessibility accessibility ); 201 199 202 const CMethod *GetMethodPtr( const UserProc *pUserProc ) const; 200 203 bool IsExist( const char *name ) const; -
trunk/abdev/BasicCompiler_Common/src/Class.cpp
r345 r346 198 198 bool CClass::IsInheritsInterface( const CClass *pInterfaceClass ) const 199 199 { 200 BOOST_FOREACH( const ::Interface &objInterface, interfaces ){201 if( pInterfaceClass == & objInterface.GetClass() ){200 BOOST_FOREACH( const ::Interface *pInterface, interfaces ){ 201 if( pInterfaceClass == &pInterface->GetClass() ){ 202 202 return true; 203 203 } … … 447 447 } 448 448 449 interfaces.push_back( ::Interface( &interfaceClass ) );449 interfaces.push_back( new ::Interface( &interfaceClass ) ); 450 450 451 451 return true; … … 587 587 if( isAbstract ) pUserProc->CompleteCompile(); 588 588 589 //メソッドのオーバーライド 590 BOOST_FOREACH( CMethod *pMethod, pobj_c->GetDynamicMethods() ){ 591 if( pMethod->GetUserProc().GetName() == temporary ){ 592 if( pMethod->GetUserProc().Params().Equals( pUserProc->Params() ) 593 && pMethod->GetUserProc().ReturnType().Equals( pUserProc->ReturnType() ) ) 589 // メソッドのオーバーライド 590 if( pobj_c->GetDynamicMethods().Override( pUserProc, accessibility ) ) 591 { 592 // オーバーライドが行われた場合 593 if( !isOverride ) 594 { 595 SetError(127,NULL,nowLine); 596 } 597 return; 598 } 599 else 600 { 601 // インターフェイス メソッドのオーバーライド 602 BOOST_FOREACH( ::Interface *pInterface, pobj_c->GetInterfaces() ) 603 { 604 if( pInterface->GetDynamicMethods().Override( pUserProc, accessibility ) ) 594 605 { 595 //メンバ関数を上書き 596 pMethod->SetUserProcPtr( pUserProc ); 597 pMethod->Override(); 598 599 if( !pMethod->IsVirtual() ) 600 { 601 // オーバーライドミス 602 SetError(136,NULL,cp); 603 } 606 // オーバーライドが行われた場合 604 607 if( !isOverride ) 605 608 { 606 609 SetError(127,NULL,nowLine); 607 610 } 608 if(pMethod->GetAccessibility() != accessibility )609 {610 SetError(128,NULL,nowLine);611 }612 613 pUserProc->SetMethod( pMethod );614 611 return; 615 612 } … … 802 799 } 803 800 804 BOOST_FOREACH( const ::Interface &objInterface, interfaces )801 BOOST_FOREACH( const ::Interface *pInterface, interfaces ) 805 802 { 806 803 index++; 807 804 808 BOOST_FOREACH( const CMethod *pMethod, objInterface.GetClass().GetDynamicMethods() ){805 BOOST_FOREACH( const CMethod *pMethod, pInterface->GetClass().GetDynamicMethods() ){ 809 806 if( &pMethod->GetUserProc() == pUserProc ) 810 807 { … … 902 899 903 900 // インターフェイスのvtblを生成 904 BOOST_FOREACH( const ::Interface &objInterface, interfaces )901 BOOST_FOREACH( const ::Interface *pInterface, interfaces ) 905 902 { 906 903 long tempVtblOffset; 907 objInterface.GetClass().GenerateVTablePart( tempVtblOffset );904 pInterface->GetClass().GenerateVTablePart( tempVtblOffset ); 908 905 vtblMasterList.push_back( tempVtblOffset ); 909 906 910 objInterface.SetVtblOffset( tempVtblOffset );907 pInterface->SetVtblOffset( tempVtblOffset ); 911 908 } 912 909 … … 947 944 948 945 // インターフェイスのvtbl 949 BOOST_FOREACH( const ::Interface &objInterface, interfaces )950 { 951 LONG_PTR *pVtbl = (LONG_PTR *)((char *)compiler.GetObjectModule().dataTable.GetPtr() + objInterface.GetClass().vtbl_offset);952 953 for( int i=0; i< objInterface.GetClass().GetVtblNum(); i++ ){946 BOOST_FOREACH( const ::Interface *pInterface, interfaces ) 947 { 948 LONG_PTR *pVtbl = (LONG_PTR *)((char *)compiler.GetObjectModule().dataTable.GetPtr() + pInterface->GetClass().vtbl_offset); 949 950 for( int i=0; i<pInterface->GetClass().GetVtblNum(); i++ ){ 954 951 const UserProc *pUserProc = (UserProc *)pVtbl[i]; 955 952 if(!pUserProc) continue; -
trunk/abdev/BasicCompiler_Common/src/Method.cpp
r206 r346 24 24 this->push_back( pMethod ); 25 25 pUserProc->SetMethod( pMethod ); 26 } 27 28 bool Methods::Override( UserProc *pUserProc, Prototype::Accessibility accessibility ) 29 { 30 //メソッドのオーバーライド 31 Methods &methods = *this; 32 BOOST_FOREACH( CMethod *pMethod, methods ) 33 { 34 if( pMethod->GetUserProc().GetName() == pUserProc->GetName() ) 35 { 36 if( pMethod->GetUserProc().Params().Equals( pUserProc->Params() ) 37 && pMethod->GetUserProc().ReturnType().Equals( pUserProc->ReturnType() ) ) 38 { 39 //メンバ関数を上書き 40 pMethod->SetUserProcPtr( pUserProc ); 41 pMethod->Override(); 42 43 if( !pMethod->IsVirtual() ) 44 { 45 // オーバーライドミス 46 SetError(136,NULL,cp); 47 } 48 if(pMethod->GetAccessibility() != accessibility ) 49 { 50 SetError(128,NULL,cp); 51 } 52 53 pUserProc->SetMethod( pMethod ); 54 return true; 55 } 56 } 57 } 58 return false; 26 59 } 27 60
Note:
See TracChangeset
for help on using the changeset viewer.