Changeset 290 in dev for trunk/abdev/BasicCompiler_Common/src/Type.cpp
- Timestamp:
- Aug 21, 2007, 11:00:25 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/Type.cpp
r206 r290 52 52 }; 53 53 54 Type::~Type() 55 { 56 } 57 54 58 bool Type::StringToBasicType( const string &typeName, int &basicType ){ 55 59 for( int i=0; ; i++ ){ … … 120 124 } 121 125 126 const CClass &Type::GetClass() const 127 { 128 if( !HasMember() ) 129 { 130 Jenga::Throw( "クラスまたは構造体でない型に対してGetClassを呼び出した" ); 131 } 132 133 return *pClass; 134 } 122 135 123 136 bool Type::Equals( const Type &type ) const … … 185 198 186 199 // 構造体 187 if( basicType == DEF_STRUCT ){ 200 if( IsStruct() ) 201 { 188 202 if( !pClass ){ 189 203 SmoothieException::Throw(); … … 195 209 196 210 // オブジェクト 197 if(basicType==DEF_OBJECT){ 211 if( IsObject() ) 212 { 198 213 if( GetClass().IsInterface() ){ 199 214 // vtblOffsetのサイズを含める … … 379 394 bool Type::IsObject() const 380 395 { 381 if( basicType == DEF_OBJECT ){382 return true;383 }384 return false;396 return ( 397 basicType == DEF_OBJECT 398 || IsTypeParameter() 399 ); 385 400 } 386 401 bool Type::IsObjectPtr() const … … 390 405 } 391 406 return false; 407 } 408 bool Type::IsTypeParameter() const 409 { 410 return ( basicType == DEF_TYPE_PARAMETER ); 392 411 } 393 412 bool Type::IsObjectClass() const … … 428 447 { 429 448 if( NATURAL_TYPE( basicType ) == DEF_OBJECT 430 || NATURAL_TYPE( basicType ) == DEF_STRUCT ){ 431 return true; 432 } 433 return false; 449 || NATURAL_TYPE( basicType ) == DEF_STRUCT 450 || NATURAL_TYPE( basicType ) == DEF_TYPE_PARAMETER 451 ){ 452 return true; 453 } 454 return false; 455 } 456 457 const Type &Type::GetDummyActualGenericType() const 458 { 459 return actualGenericTypes[0].GetType(); 460 } 461 bool Type::HasActualGenericType() const 462 { 463 return ( actualGenericTypes.size() > 0 ); 434 464 } 435 465
Note:
See TracChangeset
for help on using the changeset viewer.