Changeset 447 in dev
- Timestamp:
- Mar 21, 2008, 2:23:20 PM (17 years ago)
- Location:
- trunk/ab5.0/abdev/BasicCompiler_Common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/include/Type.h
r424 r447 153 153 154 154 bool Equals( const Type &type ) const; 155 bool IsCovariant( const Type &type ) const; 155 156 156 157 int GetBasicSize() const; -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Class.cpp
r431 r447 130 130 131 131 //自身の派生クラスかどうかを確認 132 bool CClass::IsSubClass( const CClass *p Class ) const133 { 134 if( !p Class->HasSuperClass() )132 bool CClass::IsSubClass( const CClass *pSubClass ) const 133 { 134 if( !pSubClass->HasSuperClass() ) 135 135 { 136 136 return false; 137 137 } 138 138 139 const CClass *pTempClass = &p Class->GetSuperClass();139 const CClass *pTempClass = &pSubClass->GetSuperClass(); 140 140 while( pTempClass ){ 141 141 if( this == pTempClass ) return true; … … 146 146 147 147 //自身と等しいまたは派生クラスかどうかを確認 148 bool CClass::IsEqualsOrSubClass( const CClass *p Class ) const149 { 150 if( IsEquals( p Class ) ) return true;151 return IsSubClass( p Class );148 bool CClass::IsEqualsOrSubClass( const CClass *pSubClass ) const 149 { 150 if( IsEquals( pSubClass ) ) return true; 151 return IsSubClass( pSubClass ); 152 152 } 153 153 -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Procedure.cpp
r438 r447 26 26 return true; 27 27 } 28 29 if( this->returnType.IsTypeParameter() ) 28 else if( this->returnType.IsCovariant( pUserProc->returnType ) ) 29 { 30 // 戻り値が共変 31 return true; 32 } 33 else if( this->returnType.IsTypeParameter() ) 30 34 { 31 35 // 型パラメータだったとき 36 32 37 if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].Equals( pUserProc->returnType ) ) 33 38 { 34 39 // 戻り値が等しい 40 return true; 41 } 42 else if( actualTypeParametersForThisProc[this->returnType.GetFormalTypeIndex()].IsCovariant( pUserProc->returnType ) ) 43 { 44 // 戻り値が共変 35 45 return true; 36 46 } -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Type.cpp
r424 r447 150 150 } 151 151 return false; 152 } 153 154 bool Type::IsCovariant( const Type &type ) const 155 { 156 if( !this->IsObject() || !type.IsObject() ) 157 { 158 // 共変性の判別はクラス型のみ 159 return false; 160 } 161 162 return this->GetClass().IsSubClass( &type.GetClass() ); 152 163 } 153 164
Note:
See TracChangeset
for help on using the changeset viewer.