Changeset 116 in dev


Ignore:
Timestamp:
May 12, 2007, 4:34:39 PM (17 years ago)
Author:
dai_9181
Message:

暗黙的なアップキャストを可能にした

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_Calc.cpp

    r75 r116  
    606606
    607607    if( calcType.IsObject() && !calcType.Equals( varType ) ){
    608         //キャスト演算子のオーバーロードに対応する
    609         CallCastOperatorProc(calcType,bCalcUseHeap,varType);
     608        bool isUpCast = false;
     609        if( varType.IsObject() ){
     610            if( varType.GetClass().IsEqualsOrSubClass( &calcType.GetClass() ) ){
     611                isUpCast = true;
     612            }
     613        }
     614        if( !isUpCast ){
     615            //キャスト演算子のオーバーロードに対応する
     616            CallCastOperatorProc(calcType,bCalcUseHeap,varType);
     617        }
    610618    }
    611619
  • BasicCompiler32/Compile_Var.cpp

    r106 r116  
    513513                CClass::RefType refType;
    514514                GetVarFormatString(temporary,tempArray,lpPtrOffset,tempMember, refType );
     515            }
     516
     517            int typeDefIndex = Smoothie::Meta::typeDefs.GetIndex( VarName );
     518            if( typeDefIndex != -1 ){
     519                // TypeDef後の型名だったとき
     520                lstrcpy( VarName, Smoothie::Meta::typeDefs[typeDefIndex].GetBaseName().c_str() );
    515521            }
    516522
  • BasicCompiler64/Compile_Calc.cpp

    r75 r116  
    215215
    216216    if( calcType.IsObject() && !calcType.Equals( varType ) ){
    217         //キャスト演算子のオーバーロードに対応する
    218         CallCastOperatorProc(REG_RAX,calcType,bCalcUseHeap,varType);
     217        bool isUpCast = false;
     218        if( varType.IsObject() ){
     219            if( varType.GetClass().IsEqualsOrSubClass( &calcType.GetClass() ) ){
     220                isUpCast = true;
     221            }
     222        }
     223        if( !isUpCast ){
     224            //キャスト演算子のオーバーロードに対応する
     225            CallCastOperatorProc(REG_RAX,calcType,bCalcUseHeap,varType);
     226        }
    219227    }
    220228
  • BasicCompiler64/Compile_Var.cpp

    r107 r116  
    537537                CClass::RefType refType;
    538538                GetVarFormatString(temporary,tempArray,lpPtrOffset,tempMember, refType );
     539            }
     540
     541            int typeDefIndex = Smoothie::Meta::typeDefs.GetIndex( VarName );
     542            if( typeDefIndex != -1 ){
     543                // TypeDef後の型名だったとき
     544                lstrcpy( VarName, Smoothie::Meta::typeDefs[typeDefIndex].GetBaseName().c_str() );
    539545            }
    540546
  • BasicCompiler_Common/NumOpe_GetType.cpp

    r114 r116  
    614614                    // As演算子の右辺値
    615615                    //型名
     616                    if( (string)term=="Hoge"){
     617                        int test=0;
     618                    }
    616619                    if( Type::StringToType( term, resultType ) ){
    617620                        resultType.SetBasicType( resultType.GetBasicType() | FLAG_CAST );
  • BasicCompiler_Common/ParamImpl.cpp

    r111 r116  
    284284    if( SecondParmNum == -1 ) SecondParmNum = (int)params.size();
    285285
    286     if(ParmsNum>(int)params.size()){
     286    if(ParmsNum>(int)params.size() && params.size() != 0){
    287287        if(params[params.size()-1]->GetBasicType()!=DEF_ELLIPSE){
    288288            //パラメータが多すぎるとき
  • BasicCompiler_Common/Procedure.cpp

    r113 r116  
    518518    return true;
    519519}*/
     520const NamespaceScopes &GlobalProc::GetNamespaceScopes() const
     521{
     522    if( HasParentClass() ){
     523        return GetParentClassPtr()->GetNamespaceScopes();
     524    }
     525    return namespaceScopes;
     526}
    520527bool GlobalProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
    521528{
  • BasicCompiler_Common/Procedure.h

    r114 r116  
    161161        this->pParentClass = pParentClass;
    162162    }
    163     const CClass *GetParentClassPtr()
     163    const CClass *GetParentClassPtr() const
    164164    {
    165165        return pParentClass;
     
    274274    bool AddGlobalProc( const NamespaceScopes &namespaceScopes, char *buffer,int nowLine );
    275275*/
    276     virtual const NamespaceScopes &GetNamespaceScopes() const
    277     {
    278         return namespaceScopes;
    279     }
     276    virtual const NamespaceScopes &GetNamespaceScopes() const;
    280277    virtual const NamespaceScopesCollection &GetImportedNamespaces() const
    281278    {
  • BasicCompiler_Common/Type.cpp

    r114 r116  
    8989    // TypeDefされた型
    9090    ////////////////////
    91     int i=Smoothie::Meta::typeDefs.GetIndex( typeName.c_str() );
     91    int i=Smoothie::Meta::typeDefs.GetIndex( typeName );
    9292    if(i!=-1){
    9393        type = Smoothie::Meta::typeDefs[i].GetBaseType();
     
    9696
    9797    //クラス
    98     const CClass *pobj_c = pobj_DBClass->Find( typeName.c_str() );
     98    const CClass *pobj_c = pobj_DBClass->Find( typeName );
    9999    if(pobj_c){
    100100        type.pClass = pobj_c;
  • BasicCompiler_Common/VariableOpe.cpp

    r114 r116  
    732732        }
    733733
    734         // TODO: TypeDefされたクラスの静的メンバに未対応
     734        int typeDefIndex = Smoothie::Meta::typeDefs.GetIndex( VarName );
     735        if( typeDefIndex != -1 ){
     736            // TypeDef後の型名だったとき
     737            lstrcpy( VarName, Smoothie::Meta::typeDefs[typeDefIndex].GetBaseName().c_str() );
     738        }
    735739
    736740        char temp2[VN_SIZE];
Note: See TracChangeset for help on using the changeset viewer.