Changeset 79 in dev for BasicCompiler32/NumOpe.cpp


Ignore:
Timestamp:
Mar 25, 2007, 5:58:57 AM (17 years ago)
Author:
dai_9181
Message:

バージョンをβ17にした。
#strictをデフォルトの状態で適用するようにした(#90)。
Dimステートメントにおいて、初期値式とAsが同時に指定されていたとき、As以降も初期値式の一部として捉えるよう、変更(#91)。
GetTypeDef関数を完全廃止。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/NumOpe.cpp

    r76 r79  
    151151    int sp;
    152152    int type_stack[255];
     153    bool isNothing_stack[255];
    153154    LONG_PTR index_stack[255];
    154155    BOOL bUseHeap[255];
     
    160161        if(idCalc){
    161162            if(type_stack[sp-2]==DEF_OBJECT){
    162                 //オーバーロードされたオペレータを呼び出す
    163                 i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp);
    164                 if(i2==0){
    165                     if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
    166                     else GetCalcName(idCalc,temp2);
    167                     sprintf(temporary,"Operator %s",temp2);
    168                     SetError(27,temporary,cp);
    169                     goto error;
     163                if( idCalc == CALC_AS
     164                    && type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST )
     165                    && index_stack[sp-1] == index_stack[sp-2]
     166                    || isNothing_stack[sp-2] ){
     167                        // 同一の型、またはNothingに対するAsはAs演算子を呼び出さない
    170168                }
    171                 else if(i2==-1) goto error;
    172 
    173                 continue;
     169                else{
     170                    //オーバーロードされたオペレータを呼び出す
     171                    i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp);
     172                    if(i2==0){
     173                        if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
     174                        else GetCalcName(idCalc,temp2);
     175                        sprintf(temporary,"Operator %s",temp2);
     176                        SetError(27,temporary,cp);
     177                        goto error;
     178                    }
     179                    else if(i2==-1) goto error;
     180
     181                    continue;
     182                }
    174183            }
    175184
     
    181190            case 0:
    182191                index_stack[sp]=-1;
     192                isNothing_stack[sp] = false;
    183193                bUseHeap[sp]=0;
    184194
     
    363373                    // Nothing
    364374                    if( lstrcmp( term, "Nothing" ) == 0 ){
     375                        isNothing_stack[sp] = true;
     376
    365377                        type_stack[sp] = DEF_OBJECT;
    366378                        if( baseType.IsObject() ){
     
    489501                    // 型名の場合
    490502                    //////////////
    491 
    492                     LONG_PTR lp;
    493                     i3=GetTypeFixed(term,&lp);
    494                     if(i3!=-1){
    495                         type_stack[sp]=i3|FLAG_CAST;
    496                         index_stack[sp]=lp;
     503                    Type tempType;
     504                    if( Type::StringToType( term, tempType ) ){
     505                        type_stack[sp] = tempType.GetBasicType() | FLAG_CAST;
     506                        index_stack[sp] = tempType.GetIndex();
    497507                        sp++;
    498508                        break;
    499509                    }
    500 
    501510
    502511
Note: See TracChangeset for help on using the changeset viewer.