Changeset 89 in dev for BasicCompiler64


Ignore:
Timestamp:
Apr 4, 2007, 2:03:09 AM (17 years ago)
Author:
dai_9181
Message:

実行時型情報の生成に対応。
関数の戻り値の型に抽象クラスを指定できるようにした。

Location:
BasicCompiler64
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler64/BasicCompiler.vcproj

    r88 r89  
    13211321                </File>
    13221322                <File
    1323                     RelativePath="..\BasicCompiler_Common\preprocessor.cpp"
    1324                     >
    1325                 </File>
    1326                 <File
    13271323                    RelativePath="..\BasicCompiler_Common\RSrcSection.cpp"
    13281324                    >
  • BasicCompiler64/Compile_ProcOp.cpp

    r86 r89  
    195195        obp+=31;
    196196    }
    197     else if( userProc.GetName() == "InitializeUserTypes" ){
     197    else if( userProc.GetName() == "InitializeUserTypes"
     198        && userProc.HasParentClass()
     199        && (string)userProc.GetParentClass().name == "_System_TypeBase" ){
     200
     201            pobj_DBClass->Compile_System_InitializeUserTypes();
    198202    }
    199203    else{
     
    233237    pUserProc->beginOpAddress=obp;
    234238
     239    //コンパイル中の関数が属するクラス
     240    pobj_CompilingClass=pUserProc->GetParentClassPtr();
     241
     242    //コンパイルスタートをクラス管理クラスに追加
     243    pobj_DBClass->StartCompile( pUserProc );
     244
     245    //コンパイル中の関数
     246    UserProc::CompileStartForUserProc( pUserProc );
     247
    235248    if(pUserProc->IsSystem()){
    236249        ////////////////////
     
    351364    extern int LocalVar_ThisPtrOffset;
    352365    LocalVar_ThisPtrOffset=AllLocalVarSize;
    353 
    354     //コンパイル中の関数が属するクラス
    355     pobj_CompilingClass=pUserProc->GetParentClassPtr();
    356 
    357     //コンパイルスタートをクラス管理クラスに追加
    358     pobj_DBClass->StartCompile( pUserProc );
    359 
    360     //コンパイル中の関数
    361     UserProc::CompileStartForUserProc( pUserProc );
    362366
    363367    //スタックフレーム管理用クラスを初期化
     
    446450        }
    447451        else{
    448             //戻り値用の変数の定義
    449             sprintf(temporary,"%s%c%c%s",temp,1,ESC_AS, pUserProc->ReturnType().ToString().c_str() );
     452            if( pUserProc->ReturnType().IsObject() ){
     453                sprintf(temporary,"%s=Nothing%c%c%s",temp,1,ESC_AS, pUserProc->ReturnType().ToString().c_str() );
     454            }
     455            else{
     456                //戻り値用の変数の定義
     457                sprintf(temporary,"%s%c%c%s",temp,1,ESC_AS, pUserProc->ReturnType().ToString().c_str() );
     458            }
    450459
    451460            OpcodeDim(temporary,0);
     
    520529                    RemoveStringPare(temporary);
    521530
    522                     Opcode_CallProc(temporary,
    523                         pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc,
    524                         0,
    525                         "",
    526                         0);
     531                    Type dummyType;
     532                    CallProc( PROC_DEFAULT
     533                        , pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc
     534                        , pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc->GetName().c_str()
     535                        , temporary
     536                        , dummyType );
    527537                }
    528538                else{
  • BasicCompiler64/Compile_Var.cpp

    r79 r89  
    12071207    }
    12081208
     1209    /*
     1210    TODO: 消す
     1211    変数は抽象クラスでもOK
    12091212    if( type.IsObject() ){
    12101213        if( type.GetClass().IsAbstract() ){
     
    12131216        }
    12141217    }
     1218    */
    12151219}
    12161220void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar){
  • BasicCompiler64/MakePeHdr.cpp

    r88 r89  
    157157    //クラス情報を取得(※注 - GetSubInfoの後に呼び出す)
    158158    pobj_DBClass->GetAllClassInfo();
    159 
    160     // 実行時型情報の確定コード(InitializeUserTypesメソッドの実装コード)を生成
    161     pobj_DBClass->GenerateRuntimeTypeInfo();
    162159
    163160    //コードと行番号の関係
Note: See TracChangeset for help on using the changeset viewer.