Changeset 428 in dev


Ignore:
Timestamp:
Mar 11, 2008, 3:57:13 PM (16 years ago)
Author:
dai_9181
Message:

[403]の修正をNumOpe_GetTypeにも適用した。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp

    r424 r428  
    310310    if(ArrayElements[0]){
    311311        Type classType;
    312         GetMemberType( leftType, VarName, classType, 0, false );
    313         if( classType.IsObject() ){
     312        if( VarName[0] == '\0' )
     313        {
     314            classType = leftType;
     315
     316            if( classType.IsObject() )
     317            {
     318                // 既にuseRegにオブジェクトポインタが格納されており、それに対するインデクサを呼び出す場合
     319                // ※「プロパティ値として返ってきたオブジェクトインスタンスのインデクサを呼び出す」場合にここにくる
     320            }
     321        }
     322        else
     323        {
     324            GetMemberType( leftType, VarName, classType, 0, false );
     325        }
     326
     327        if( classType.IsObject() )
     328        {
    314329            if( !GetReturnTypeOfIndexerGetterProc( classType, resultType ) ){
    315330                SetError(1,NULL,cp);
     
    343358    char parameter[VN_SIZE];
    344359    ReferenceKind refType;
     360    PareOrBracket pareOrBracket = None;
    345361    lstrcpy( methodName, member );
    346     GetVarFormatString(methodName,parameter,lpPtrOffset,dummy,refType);
     362    GetVarFormatString( methodName, parameter, lpPtrOffset, dummy, refType, &pareOrBracket );
    347363
    348364    vector<const UserProc *> userProcs;
     
    352368        const UserProc *pUserProc = OverloadSolutionWithStrParam(termFull,userProcs,parameter,termLeft);
    353369
    354         if( pUserProc ){
     370        if( pUserProc )
     371        {
     372            if(
     373                pUserProc->Params().size() == 0             // 仮引数の個数は0
     374                && parameter[0]                             // 実引数は1つ以上
     375                && pUserProc->ReturnType().IsObject()       // 戻り値がクラス型の場合
     376                && pareOrBracket == Bracket )               // 実引数は[]で囲まれている
     377            {
     378                // プロパティ値として返ってきたオブジェクトインスタンスのインデクサを呼び出す
     379
     380                // まずはプロパティ値を取得
     381                bool dummyIsVariable;
     382                GetMemberTermType( leftType, baseType, resultType, termFull, termLeft, methodName, &dummyIsVariable );
     383
     384                // 戻り値のオブジェクトインスタンスのインデクサを呼び出す
     385                char temporary[VN_SIZE], temp2[VN_SIZE];
     386                sprintf( temporary, "[%s]", parameter );
     387                sprintf( temp2, "%s.%s", termLeft, methodName );
     388                Type classType = resultType;
     389                return GetMemberTermType( classType, baseType, resultType, termFull, temp2, temporary, pIsVariable );
     390            }
     391
    355392            resultType = pUserProc->ReturnType();
    356393
Note: See TracChangeset for help on using the changeset viewer.