Changeset 89 in dev for BasicCompiler32/Compile_ProcOp.cpp


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_ProcOp.cpp

    r86 r89  
    204204        obp+=31;
    205205    }
    206     else if( userProc.GetName() == "InitializeUserTypes" ){
     206    else if( userProc.GetName() == "InitializeUserTypes"
     207        && userProc.HasParentClass()
     208        && (string)userProc.GetParentClass().name == "_System_TypeBase" ){
     209
     210            pobj_DBClass->Compile_System_InitializeUserTypes();
    207211    }
    208212    else{
     
    243247    pUserProc->beginOpAddress=obp;
    244248
     249    //コンパイル中の関数が属するクラス
     250    pobj_CompilingClass=pUserProc->GetParentClassPtr();
     251
     252    //コンパイルスタートをクラス管理クラスに追加
     253    pobj_DBClass->StartCompile( pUserProc );
     254
     255    //コンパイル中の関数
     256    UserProc::CompileStartForUserProc( pUserProc );
     257
    245258    if(pUserProc->IsSystem()){
     259        ////////////////////
     260        // 特殊関数
     261        ////////////////////
     262
    246263        extern int AllLocalVarSize;
    247264        AllLocalVarSize=0;
     
    313330    AllLocalVarSize+=sizeof(long);
    314331
    315     //コンパイル中の関数が属するクラス
    316     pobj_CompilingClass=pUserProc->GetParentClassPtr();
    317 
    318     //コンパイルスタートをクラス管理クラスに追加
    319     pobj_DBClass->StartCompile( pUserProc );
    320 
    321     //コンパイル中の関数
    322     UserProc::CompileStartForUserProc( pUserProc );
    323 
    324332
    325333    ///////////////////////
     
    358366        }
    359367        else{
    360             //戻り値用の変数の定義
    361             sprintf(temporary,"%s%c%c%s",temp,1,ESC_AS, pUserProc->ReturnType().ToString().c_str() );
     368            if( pUserProc->ReturnType().IsObject() ){
     369                sprintf(temporary,"%s=Nothing%c%c%s",temp,1,ESC_AS, pUserProc->ReturnType().ToString().c_str() );
     370            }
     371            else{
     372                //戻り値用の変数の定義
     373                sprintf(temporary,"%s%c%c%s",temp,1,ESC_AS, pUserProc->ReturnType().ToString().c_str() );
     374            }
    362375
    363376            OpcodeDim(temporary,0);
     
    464477                    RemoveStringPare(temporary);
    465478
    466                     Opcode_CallProc(temporary,
    467                         pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc,
    468                         0,
    469                         "",
    470                         0);
     479                    Type dummyType;
     480                    CallProc( PROC_DEFAULT
     481                        , pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc
     482                        , pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc->GetName().c_str()
     483                        , temporary
     484                        , dummyType );
    471485                }
    472486                else{
Note: See TracChangeset for help on using the changeset viewer.