Ignore:
Timestamp:
Aug 21, 2007, 11:00:25 PM (17 years ago)
Author:
dai_9181
Message:

ジェネリクスのベースを実装

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/src/Type.cpp

    r206 r290  
    5252};
    5353
     54Type::~Type()
     55{
     56}
     57
    5458bool Type::StringToBasicType( const string &typeName, int &basicType ){
    5559    for( int i=0; ; i++ ){
     
    120124}
    121125
     126const CClass &Type::GetClass() const
     127{
     128    if( !HasMember() )
     129    {
     130        Jenga::Throw( "クラスまたは構造体でない型に対してGetClassを呼び出した" );
     131    }
     132
     133    return *pClass;
     134}
    122135
    123136bool Type::Equals( const Type &type ) const
     
    185198
    186199    // 構造体
    187     if( basicType == DEF_STRUCT ){
     200    if( IsStruct() )
     201    {
    188202        if( !pClass ){
    189203            SmoothieException::Throw();
     
    195209
    196210    // オブジェクト
    197     if(basicType==DEF_OBJECT){
     211    if( IsObject() )
     212    {
    198213        if( GetClass().IsInterface() ){
    199214            // vtblOffsetのサイズを含める
     
    379394bool Type::IsObject() const
    380395{
    381     if( basicType == DEF_OBJECT ){
    382         return true;
    383     }
    384     return false;
     396    return (
     397        basicType == DEF_OBJECT
     398        || IsTypeParameter()
     399    );
    385400}
    386401bool Type::IsObjectPtr() const
     
    390405    }
    391406    return false;
     407}
     408bool Type::IsTypeParameter() const
     409{
     410    return ( basicType == DEF_TYPE_PARAMETER );
    392411}
    393412bool Type::IsObjectClass() const
     
    428447{
    429448    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
     457const Type &Type::GetDummyActualGenericType() const
     458{
     459    return actualGenericTypes[0].GetType();
     460}
     461bool Type::HasActualGenericType() const
     462{
     463    return ( actualGenericTypes.size() > 0 );
    434464}
    435465
Note: See TracChangeset for help on using the changeset viewer.