Changeset 398 in dev


Ignore:
Timestamp:
Feb 25, 2008, 10:57:09 PM (16 years ago)
Author:
dai_9181
Message:

関数の戻り値がクラス型のとき、直接インデクサ指定できるような対応を行った。ただし、この対応は暫定的なものであるため、後ほど改修が必要。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler32/NumOpe.cpp

    r370 r398  
    155155    if(ArrayElements[0]){
    156156        Type classType;
    157         GetMemberType( leftType, VarName, classType, 0, false );
     157        if( VarName[0] == '\0' )
     158        {
     159            classType = leftType;
     160        }
     161        else
     162        {
     163            GetMemberType( leftType, VarName, classType, 0, false );
     164        }
    158165        if( classType.IsObject() )
    159166        {
     
    164171            relativeVar.dwKind=VAR_DIRECTMEM;
    165172
    166             if( !_member_offset(
    167                 true,   //エラー表示あり
    168                 false,  //読み込み専用
    169                 leftType,
    170                 VarName,&relativeVar,classType,0)){
    171                     return false;
    172             }
    173 
    174             // オブジェクトメンバのポインタをeaxにコピー
    175             if( !VarToReg( relativeVar, baseType, resultType ) ){
    176                 SetError(11,termFull,cp);
    177             }
    178 
    179 
    180             //オブジェクトポインタをスタックに入れておく
    181             //push eax
    182             compiler.codeGenerator.op_push( REG_EAX );
     173            if( VarName[0] )
     174            {
     175                if( !_member_offset(
     176                    true,   //エラー表示あり
     177                    false,  //読み込み専用
     178                    leftType,
     179                    VarName,&relativeVar,classType,0)){
     180                        return false;
     181                }
     182
     183                // オブジェクトメンバのポインタをeaxにコピー
     184                if( !VarToReg( relativeVar, baseType, resultType ) ){
     185                    SetError(11,termFull,cp);
     186                }
     187
     188
     189                //オブジェクトポインタをスタックに入れておく
     190                //push eax
     191                compiler.codeGenerator.op_push( REG_EAX );
     192            }
     193            else
     194            {
     195                //オブジェクトポインタをスタックに入れておく
     196                //push ecx
     197                compiler.codeGenerator.op_push( REG_ECX );
     198            }
    183199
    184200            char objectFullName[VN_SIZE], dummyArrayElements[VN_SIZE];
     
    237253        const UserProc *pUserProc = OverloadSolutionWithStrParam(termFull,userProcs,parameter,termLeft);
    238254
    239         if( pUserProc ){
     255        if( pUserProc )
     256        {
     257            // TODO: この判定処理は暫定(特に[]サーチを行うところが)
     258            if( pUserProc->Params().size() == 0 && parameter[0] && strstr( termFull, "[" ) )
     259            {
     260                TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, methodName );
     261
     262                char temporary[VN_SIZE], temp2[VN_SIZE];
     263                sprintf( temporary, "[%s]", parameter );
     264                sprintf( temp2, "%s.%s", termLeft, methodName );
     265                Type classType = resultType;
     266                return TermMemberOpe( classType, baseType, resultType, termFull, temp2, temporary );
     267            }
    240268
    241269            resultType = pUserProc->ReturnType();
Note: See TracChangeset for help on using the changeset viewer.