Ignore:
Timestamp:
Dec 19, 2007, 3:31:03 AM (16 years ago)
Author:
dai_9181
Message:

Foreach文のパラメータをInで区切るようにした。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler32/Compile_Statement.cpp

    r380 r381  
    596596{
    597597    Type resultType;
    598     int i;
    599     char temporary[VN_SIZE],collectionVar[VN_SIZE];
     598    char temporary[VN_SIZE],variable[VN_SIZE],collectionVar[VN_SIZE];
    600599    bool isError = false;
    601600
     601    //レキシカルスコープをレベルアップ
     602    compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR );
     603
    602604    //第1パラメータを取得
    603     char variable[VN_SIZE];
    604     i=GetOneParameter(Parameter,0,variable);
     605    int i = 0;
     606    GetCustomToken( variable, Parameter, i, ESC_IN, true );
    605607    if(!Parameter[i]){
    606608        SetError(12,"Foreach",cp);
     
    608610        goto ErrorStep;
    609611    }
     612    i++;
    610613
    611614    //第2パラメータを取得(in~)
    612     i=GetOneParameter(Parameter,i,collectionVar);
    613 
    614     //レキシカルスコープをレベルアップ
    615     compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR );
     615    lstrcpy( collectionVar, Parameter + i );
    616616
    617617    if( !GetVarType( variable, resultType, false ) )
     
    651651    const PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true );
    652652
    653     // Currentプロパティから現在の値を取得
    654     sprintf( temporary, "%s=%s.Current", variable, collectionVar );
    655     Compile( temporary );
     653    if( !isError )
     654    {
     655        // Currentプロパティから現在の値を取得
     656        sprintf( temporary, "%s=%s.Current", variable, collectionVar );
     657        Compile( temporary );
     658    }
    656659
    657660    //For内をコンパイル
     
    666669    }
    667670
    668     //jmp ...
    669     compiler.codeGenerator.op_jmp_continue();
     671    if( !isError )
     672    {
     673        //jmp ...
     674        compiler.codeGenerator.op_jmp_continue();
     675    }
    670676
    671677    //レキシカルスコープをレベルダウン
Note: See TracChangeset for help on using the changeset viewer.