Changeset 716 in dev


Ignore:
Timestamp:
Aug 8, 2008, 12:11:01 AM (16 years ago)
Author:
dai
Message:

[712]を64bit版にマージ。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/compiler_x64/Compile_Statement.cpp

    r676 r716  
    481481    char temporary[VN_SIZE],variable[VN_SIZE],collectionVar[VN_SIZE];
    482482    bool isError = false;
    483 
    484     //レキシカルスコープをレベルアップ
    485     compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR );
     483    std::string elementTypeName;
    486484
    487485    //第1パラメータを取得
     
    498496    lstrcpy( collectionVar, Parameter + i );
    499497
    500     if( !GetVarType( variable, resultType, false ) )
     498
     499    Exception::TryCommand(); //Finallyで_System_ForeachEnumerator.Disposeするため
     500
     501    //Enumeratorの取得
     502    sprintf(temporary,"_System_ForeachEnumerator=%s.GetEnumerator()", collectionVar );
     503    OpcodeDim(temporary,DIMFLAG_INITDEBUGVAR);
     504
     505    //レキシカルスコープをレベルアップ
     506    compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR );
     507
    501508    {
    502509        Type collectionType;
     
    506513            goto ErrorStep;
    507514        }
     515        elementTypeName = collectionType.GetActualGenericType(0).GetClass().GetFullName();
     516    }
     517
     518    if( !GetVarType( variable, resultType, false ) )
     519    {
    508520
    509521        // 未定義の場合は自動的に定義する
    510         sprintf(temporary,"%s=Nothing%c%c%s", variable, 1, ESC_AS, collectionType.GetActualGenericType(0).GetClass().GetFullName().c_str() );
     522        sprintf(temporary,"%s=Nothing%c%c%s", variable, 1, ESC_AS, elementTypeName.c_str() );
    511523        OpcodeDim(temporary,DIMFLAG_INITDEBUGVAR);
    512524    }
    513 
    514     // Resetメソッドを呼び出す
    515     sprintf( temporary, "%s.Reset()", collectionVar );
    516     Compile( temporary );
    517525
    518526    //Continueアドレスのバックアップとセット
     
    520528
    521529    // MoveNextメソッドを呼び出す
    522     sprintf( temporary, "%s.MoveNext()", collectionVar );
    523530    int reg = REG_RAX;
    524     NumOpe(&reg,temporary,Type(),resultType);
     531    NumOpe( &reg, "_System_ForeachEnumerator.MoveNext()", Type(), resultType );
    525532
    526533    //cmp rax,0
     
    535542    {
    536543        // Currentプロパティから現在の値を取得
    537         sprintf( temporary, "%s=%s.Current", variable, collectionVar );
     544        sprintf( temporary, "%s=_System_ForeachEnumerator.Current%c%c%s", variable, 1, ESC_AS, elementTypeName.c_str() );
    538545        Compile( temporary );
    539546    }
     
    561568    //jeジャンプ先のオフセット値
    562569    compiler.codeGenerator.opfix_JmpPertialSchedule( pTempPertialSchedule );
     570
     571    //Disposeを呼んでTryスコープを終える
     572    Exception::FinallyCommand();
     573    Compile( "_System_ForeachEnumerator.Dispose()" );
     574    Exception::EndTryCommand();
    563575
    564576    //Continueアドレスを復元
Note: See TracChangeset for help on using the changeset viewer.