Changeset 673 in dev for trunk/ab5.0


Ignore:
Timestamp:
Jun 29, 2008, 1:44:08 PM (16 years ago)
Author:
dai_9181
Message:

・オーバーロード解決時、戻り値に型パラメータだった場合に型解決されずに、正しいオーバーロード解決が行われない不具合を修正。
・演算子メソッドの戻り値が型パラメータだったとき、型解決が行われない不具合を修正。

Location:
trunk/ab5.0/abdev
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/ParamImpl.cpp

    r527 r673  
    202202    if( !targetResultType.IsNull() ){
    203203        //戻り値も比較対象にする
    204         if( !returnType.Equals( targetResultType ) ){
     204
     205        Type temp( targetResultType );
     206        ResolveFormalGenericTypeParameter( temp, leftType, &userProc );
     207
     208        if( !returnType.Equals( temp ) ){
    205209            return false;
    206210        }
  • trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp

    r664 r673  
    88using namespace ActiveBasic::Compiler;
    99
    10 void PushReturnValue(int type){
     10void PushReturnValue( const Type &type )
     11{
    1112    //関数の戻り値をスタックへプッシュする
    1213    //※この処理内では、esi、ediは使用不可
    1314
    14     if(type==DEF_OBJECT || type==DEF_STRUCT){
     15    if( type.IsObject() || type.IsStruct() )
     16    {
    1517        //push eax
    1618        compiler.codeGenerator.op_push(REG_EAX);
    1719    }
    18     else if(type==DEF_DOUBLE){
     20    else if( type.IsDouble() )
     21    {
    1922        //sub esp,8
    2023        compiler.codeGenerator.op_sub_esp(8);
     
    2326        compiler.codeGenerator.op_fstp_basereg( DEF_DOUBLE, REG_ESP );
    2427    }
    25     else if(type==DEF_SINGLE){
     28    else if( type.IsSingle() )
     29    {
    2630        //sub esp,4
    2731        compiler.codeGenerator.op_sub_esp(4);
     
    3034        compiler.codeGenerator.op_fstp_basereg( DEF_SINGLE, REG_ESP );
    3135    }
    32     else if(type==DEF_INT64||type==DEF_QWORD){
     36    else if( type.Is64() )
     37    {
    3338        //push edx
    3439        compiler.codeGenerator.op_push(REG_EDX);
     
    3742        compiler.codeGenerator.op_push(REG_EAX);
    3843    }
    39     else if(type==DEF_LONG){
    40         //push eax
    41         compiler.codeGenerator.op_push(REG_EAX);
    42     }
    43     else if(type==DEF_INTEGER || (compiler.IsUnicode()&&type==DEF_CHAR)){
     44    else if( type.IsInteger() || ( compiler.IsUnicode() && type.GetBasicType() == DEF_CHAR ) )
     45    {
    4446        //movsx ebx,ax
    4547        compiler.codeGenerator.op_movsx_R32R16( REG_EBX, REG_EAX );
     
    4850        compiler.codeGenerator.op_push(REG_EBX);
    4951    }
    50     else if(type==DEF_SBYTE || (compiler.IsUnicode()==false&&type==DEF_CHAR)){
     52    else if( type.IsSByte() || ( !compiler.IsUnicode() && type.GetBasicType() == DEF_CHAR ) )
     53    {
    5154        //movsx ebx,al
    5255        compiler.codeGenerator.op_movsx_R32R8( REG_EBX, REG_EAX );
     
    5558        compiler.codeGenerator.op_push(REG_EBX);
    5659    }
    57     else if(type==DEF_DWORD||type==DEF_WORD||type==DEF_BYTE||type==DEF_BOOLEAN||
    58         IsPtrType(type)){
     60    else if( type.IsLong() || type.IsDWord() || type.IsWord() || type.IsByte() || type.IsBoolean() || type.IsPointer() )
     61    {
    5962        //push eax
    6063        compiler.codeGenerator.op_push(REG_EAX);
  • trunk/ab5.0/abdev/compiler_x86/Opcode.h

    r603 r673  
    5656
    5757//NumOpe.cpp
    58 void PushReturnValue(int type);
     58void PushReturnValue( const Type &type );
    5959bool TermOpeOnlyVariable( const char *term, Type &resultType, RELATIVE_VAR &relativeVar, bool isWriteAccess );
    6060bool TermOpe(
  • trunk/ab5.0/abdev/compiler_x86/OperatorProc.cpp

    r465 r673  
    195195    if( !pUserProc->ReturnType().IsNull() ){
    196196        //スタックへプッシュ
    197         PushReturnValue(pUserProc->ReturnType().GetBasicType());
     197        PushReturnValue( pUserProc->ReturnType() );
    198198    }
    199199
     
    205205    }
    206206
     207    Type temp( pUserProc->ReturnType() );
     208    ResolveFormalGenericTypeParameter( temp, leftType, pUserProc );
     209
    207210    sp--;
    208     type_stack[sp-1]=pUserProc->ReturnType().GetBasicType();
    209     index_stack[sp-1]=pUserProc->ReturnType().GetIndex();
     211    type_stack[sp-1] = temp.GetBasicType();
     212    index_stack[sp-1] = temp.GetIndex();
    210213
    211214    if( pUserProc->ReturnType().IsStruct() )
Note: See TracChangeset for help on using the changeset viewer.