Changeset 45 in dev


Ignore:
Timestamp:
Feb 2, 2007, 2:58:14 AM (17 years ago)
Author:
dai_9181
Message:

・オーバーロードが解決できない場合のエラーが表示されないバグを修正。
・DLL関数のByRefパラメータに変数以外の数値を指定すると正常にコンパイルされないバグを修正。

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/CParameter.cpp

    r36 r45  
    395395                //↑ここでスタックに積む
    396396
    397                 useTempParameters[i2] = true;
    398                 useTempObject = true;
    399 
    400                 types[i2].type = type;
    401                 types[i2].u.lpIndex = lpVarIndex;
     397                bool result = CheckDifferentType(
     398                    DummyTypeInfo.type,
     399                    DummyTypeInfo.u.lpIndex,
     400                    type,
     401                    lpVarIndex,
     402                    FuncName,
     403                    i2);
     404
     405                if( result ){
     406                    useTempParameters[i2] = true;
     407                    useTempObject = true;
     408
     409                    types[i2].type = type;
     410                    types[i2].u.lpIndex = lpVarIndex;
     411                }
    402412
    403413                nCountOfTempObjects++;
     
    430440            //call destructor
    431441            int i5 = types[i2].u.pobj_Class->DestructorMemberSubIndex;
    432             op_call( types[i2].u.pobj_Class->ppobj_Method[i5]->psi );
     442            if( i5 != -1 ){
     443                op_call( types[i2].u.pobj_Class->ppobj_Method[i5]->psi );
     444            }
    433445
    434446
  • BasicCompiler32/Compile_CallProc.cpp

    r40 r45  
    357357
    358358    //エラーチェック
    359     if( !pobj_parameter->ErrorCheck(psi->name,psi->pRealParmInfo,psi->RealParmNum,psi->RealSecondParmNum) ){
     359    if( !pobj_parameter->ErrorCheck(psi->name,psi->pRealParmInfo,psi->RealParmNum,psi->SecondParmNum) ){
    360360        //パラメータにエラーがあるときは処理を終える
    361361        return;
     
    524524    }
    525525
     526    //一時オブジェクトを生成
     527    pobj_parameter->NewTempParameters( pdi->name,pdi->pParmInfo,pdi->ParmNum,pdi->ParmNum );
     528
    526529    //レジスタ、スタックフレームにセット
    527530    int ParmSize;
    528531    ParmSize=pobj_parameter->SetParameter(pdi->name,pdi->pParmInfo,pdi->ParmNum,pdi->ParmNum);
    529 
    530     //パラメータオブジェクトを破棄
    531     delete pobj_parameter;
    532532
    533533
     
    545545    }
    546546
     547    //一時オブジェクトを破棄
     548    pobj_parameter->DeleteTempParameters();
     549
     550    //パラメータオブジェクトを破棄
     551    delete pobj_parameter;
     552
    547553    if(plpIndex) *plpIndex=pdi->u.ReturnIndex;
    548554
  • BasicCompiler64/CParameter.cpp

    r31 r45  
    391391                StackOffsetOfTempObject[i2] = pobj_sf->push(reg);
    392392
    393                 useTempParameters[i2] = true;
    394                 useTempObject = true;
    395 
    396                 types[i2].type = type;
    397                 types[i2].u.lpIndex = lpVarIndex;
     393                bool result = CheckDifferentType(
     394                    DummyTypeInfo.type,
     395                    DummyTypeInfo.u.lpIndex,
     396                    type,
     397                    lpVarIndex,
     398                    FuncName,
     399                    i2);
     400
     401                if( result ){
     402                    useTempParameters[i2] = true;
     403                    useTempObject = true;
     404
     405                    types[i2].type = type;
     406                    types[i2].u.lpIndex = lpVarIndex;
     407                }
    398408            }
    399409        }
     
    415425            //call destructor
    416426            int i5 = types[i2].u.pobj_Class->DestructorMemberSubIndex;
    417             op_call( types[i2].u.pobj_Class->ppobj_Method[i5]->psi );
     427            if( i5 != -1 ){
     428                op_call( types[i2].u.pobj_Class->ppobj_Method[i5]->psi );
     429            }
    418430
    419431            //メモリを解放する
  • BasicCompiler64/Compile_CallProc.cpp

    r40 r45  
    546546    pobj_parameter->BackupParameter(pdi->ParmNum);
    547547
     548    //一時オブジェクトを生成
     549    pobj_parameter->NewTempParameters( pdi->name,pdi->pParmInfo,pdi->ParmNum,pdi->ParmNum );
     550
    548551    //レジスタ、スタックフレームにセット
    549552    pobj_parameter->SetParameter(pdi->name,pdi->pParmInfo,pdi->ParmNum,pdi->ParmNum);
     
    564567    }*/
    565568
     569    //一時オブジェクトを破棄
     570    pobj_parameter->DeleteTempParameters();
     571
    566572    //スタックフレームに存在する既存のパラメータを復元
    567573    pobj_parameter->RestoreParameter(pdi->ParmNum);
  • BasicCompiler_Common/common.h

    r43 r45  
    578578void SetError(int ErrorNum,const char *KeyWord,int pos);
    579579void CompileMessage(char *buffer);
    580 void CheckDifferentType(int VarType,LONG_PTR lpVarIndex,int CalcType,LONG_PTR lpCalcIndex,char *pszFuncName,int ParmNum);
     580bool CheckDifferentType(int VarType,LONG_PTR lpVarIndex,int CalcType,LONG_PTR lpCalcIndex,char *pszFuncName,int ParmNum);
    581581
    582582//Compile.cpp
  • BasicCompiler_Common/error.cpp

    r40 r45  
    393393    if(iWarning==1) SetError(-101,temporary,cp);
    394394    else if(iWarning==2) SetError(-102,temporary,cp);
     395    else if(iWarning==3) SetError(50,temporary,cp);
    395396}
    396397
    397 void CheckDifferentType(int VarType,LONG_PTR lpVarIndex,int CalcType,LONG_PTR lpCalcIndex,char *pszFuncName,int ParmNum){
     398bool CheckDifferentType(int VarType,LONG_PTR lpVarIndex,int CalcType,LONG_PTR lpCalcIndex,char *pszFuncName,int ParmNum){
    398399
    399400    if(VarType==DEF_OBJECT||CalcType==DEF_OBJECT){
    400401        //オブジェクトインスタンスの場合
    401402        if(!(VarType==CalcType&&lpVarIndex==lpCalcIndex)){
    402             DifferentTypeError(VarType,lpVarIndex,CalcType,lpCalcIndex,2,pszFuncName,ParmNum);
    403             return;
     403            DifferentTypeError(VarType,lpVarIndex,CalcType,lpCalcIndex,3,pszFuncName,ParmNum);
     404            return false;
    404405        }
    405406    }
     
    407408    //#strictが指定されていないときは型チェックを行わないようにする
    408409    extern BOOL bStrict;
    409     if(bStrict==0) return;
     410    if(bStrict==0) return true;
    410411
    411412    if(CalcType&FLAG_PTR){
     
    421422        if(IsPtrType(VarType)&&lpCalcIndex==LITERAL_NULL){
    422423            //リテラルNULL値の場合
    423             return;
     424            return true;
    424425        }
    425426
    426427        if(VarType==DEF_PTR_VOID){
    427428            //左辺がVoidPtr型の場合は、ポインタ型すべてを受け入れる
    428             if(IsPtrType(CalcType)) return;
     429            if(IsPtrType(CalcType)) return true;
    429430        }
    430431
    431432        if(CalcType==DEF_PTR_VOID){
    432433            //右辺がVoidPtr型の場合は、ポインタ型すべてを受け入れる
    433             if(IsPtrType(VarType)) return;
     434            if(IsPtrType(VarType)) return true;
    434435        }
    435436
    436437        if(VarType!=CalcType){
    437438            DifferentTypeError(VarType,lpVarIndex,CalcType,lpCalcIndex,2,pszFuncName,ParmNum);
    438             return;
     439            return true;
    439440        }
    440441
     
    449450                    if(lpVarIndex==(LONG_PTR)pobj_tempClass){
    450451                        //継承先が等しいとき
    451                         return;
     452                        return true;
    452453                    }
    453454                }
    454455                DifferentTypeError(VarType,lpVarIndex,CalcType,lpCalcIndex,2,pszFuncName,ParmNum);
    455                 return;
     456                return true;
    456457            }
    457458        }
     
    507508        }
    508509    }
     510
     511    return true;
    509512}
Note: See TracChangeset for help on using the changeset viewer.