Ignore:
Timestamp:
May 13, 2007, 1:50:02 PM (17 years ago)
Author:
dai_9181
Message:

(呼び出し単体コードも対応→)関数の戻り値オブジェクトのメンバ・メソッドを一時オブジェクトを介さずに参照できるようにした。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler64/Compile_Statement.cpp

    r97 r122  
    44void OpcodeOthers(char *Command){
    55    int i,i2;
    6     char buffer[8192];
    76    UserProc *pUserProc;
    87
     8    char leftTerm[8192];
     9    int lastParePos = 0;
    910    for(i=0;;i++){
    10         if(Command[i]=='['){
    11             i2=GetStringInBracket(buffer+i,Command+i);
     11        if(Command[i]=='\"'){
     12            //ダブルクォートは不正なのでエラー扱い
     13            leftTerm[i]=0;
     14            SetError(3,leftTerm,cp);
     15            return;
     16        }
     17
     18        if(Command[i]=='('){
     19            lastParePos = i;
     20            i2=GetStringInPare(leftTerm+i,Command+i);
    1221            i+=i2-1;
    1322            continue;
    1423        }
    15         if(Command[i]==1&&Command[i+1]==ESC_PSMEM){
    16             buffer[i]=Command[i];
    17             i++;
    18             buffer[i]=Command[i];
     24        if(Command[i]=='['){
     25            i2=GetStringInBracket(leftTerm+i,Command+i);
     26            i+=i2-1;
    1927            continue;
    2028        }
    21         if(!IsVariableChar(Command[i])){
    22             buffer[i]=0;
     29        if(Command[i]=='\0'){
     30            leftTerm[i] = 0;
    2331            break;
    2432        }
    25         buffer[i]=Command[i];
    26     }
    27 
     33
     34        if( IsNumCalcMark( Command, i ) ){
     35            leftTerm[i] = 0;
     36            break;
     37        }
     38
     39        leftTerm[i]=Command[i];
     40    }
    2841    if(!(
    29         IsVariableTopChar(buffer[0])||
    30         buffer[0]=='.'||
    31         (buffer[0]==1&&buffer[1]==ESC_PSMEM)
     42        IsVariableTopChar(leftTerm[0])||
     43        leftTerm[0]=='.'||
     44        (leftTerm[0]==1&&leftTerm[1]==ESC_PSMEM)
    3245        )){
    3346        SetError(1,NULL,cp);
     
    3649
    3750
    38     if(Command[i]=='\0'){
     51    if(Command[i]=='\0' && lastParePos == 0){
    3952        //////////////////////////////
    4053        // パラメータ無しのマクロ検索
     
    7386    }
    7487
    75     int idProc;
    76     void *pProc;
    77     idProc=GetProc(buffer,(void **)&pProc);
    78 
    79     int i4;
    80     char temp2[VN_SIZE];
    81     if(idProc){
    82         if(Command[i]!='('){
    83             SetError(10,buffer,cp);
    84             return;
    85         }
    86         i4=GetStringInPare_RemovePare(temp2,Command+i+1);
    87 
    88         //閉じカッコ")"に続く文字がNULLでないときはエラーにする
    89         if(Command[i+1+i4+1]!='\0') SetError(42,NULL,cp);
    90 
    91         ////////////////
    92         // 呼び出し
    93         ////////////////
    94 
    95         Type resultType;
    96         CallProc(idProc,pProc,buffer,temp2,resultType);
    97 
     88    if( pobj_reg ){
     89        SetError();
     90    }
     91    pobj_reg=new CRegister(REG_RAX);
     92
     93    Type resultType;
     94    bool isLiteral;
     95    BOOL bUseHeap;
     96    bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, NULL, true );
     97
     98    delete pobj_reg;
     99    pobj_reg = NULL;
     100
     101    if( result ){
    98102
    99103        /////////////////////
     
    107111            FreeTempObject(REG_R14,&resultType.GetClass());
    108112        }
    109         return;
    110     }
    111 
    112 
    113     //////////////////////////
    114     // その他は代入演算を行う
    115     //////////////////////////
    116     OpcodeCalc(Command);
     113
     114        //成功
     115        return;
     116    }
     117
     118    // 失敗
     119    SetError(1, NULL,cp);
    117120}
    118121
Note: See TracChangeset for help on using the changeset viewer.