Changeset 128 in dev for BasicCompiler32


Ignore:
Timestamp:
May 18, 2007, 4:42:36 AM (17 years ago)
Author:
dai_9181
Message:

Blittable型を導入した。

Location:
BasicCompiler32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_Calc.cpp

    r116 r128  
    619619
    620620
     621    if( varType.IsObject() && Smoothie::Meta::blittableTypes.IsExist( calcType ) ){
     622        // Blittable型をオブジェクトとして扱う
     623        vector<UserProc *> userProcs;
     624        Smoothie::Meta::blittableTypes.GetClass( calcType ).EnumStaticMethod( "_Create", userProcs );
     625        if( userProcs.size() != 1 ){
     626            SetError();
     627            return;
     628        }
     629        UserProc *pUserProc = userProcs[0];
     630
     631        // call System.[TypeClass]._Create
     632        op_call( pUserProc );
     633
     634        // push eax
     635        op_push( REG_EAX );
     636
     637        calcType = pUserProc->ReturnType();
     638    }
     639
    621640
    622641    /////////////////////////////////
  • BasicCompiler32/Compile_Statement.cpp

    r122 r128  
    9090    bool isLiteral;
    9191    BOOL bUseHeap;
    92     bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, NULL, true );
    93 
     92    bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, false, NULL, true );
    9493    if( result ){
    9594
  • BasicCompiler32/NumOpe.cpp

    r122 r128  
    227227    return false;
    228228}
    229 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName, bool isProcedureCallOnly ){
     229bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool isWantObject, bool *pIsClassName, bool isProcedureCallOnly ){
    230230    char parameter[VN_SIZE];
    231231
     
    255255        bool isClassName = false;
    256256        Type leftType;
    257         if( !TermOpe( termLeft, baseType, leftType, isLiteral, pbUseHeap, &isClassName ) ){
     257        if( GetTermType( termLeft, leftType, isLiteral, &isClassName ) ){
     258            if( isClassName == false && Smoothie::Meta::blittableTypes.IsExist( leftType ) ){
     259                // 左側のオブジェクト部分がBlittable型のとき
     260
     261                char temporary[VN_SIZE];
     262                lstrcpy( temporary, termLeft );
     263                sprintf( termLeft, "%s(%s)",
     264                    Smoothie::Meta::blittableTypes.Find( leftType ).GetCreateStaticMethodFullName().c_str(),
     265                    temporary );
     266            }
     267        }
     268
     269        if( !TermOpe( termLeft, baseType, leftType, isLiteral, pbUseHeap, true, &isClassName ) ){
    258270            goto globalArea;
    259271        }
  • BasicCompiler32/Opcode.h

    r122 r128  
    102102//NumOpe.cpp
    103103void PushReturnValue(int type);
    104 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName = NULL, bool isProcedureCallOnly = false );
     104bool TermOpe(
     105             const char *term,
     106             const Type &baseType,
     107             Type &resultType,
     108             bool &isLiteral,
     109             BOOL *pbUseHeap,
     110             bool isWantObject = false,
     111             bool *pIsClassName = NULL,
     112             bool isProcedureCallOnly = false );
    105113bool NumOpe( int reg,
    106114            const char *expression,
Note: See TracChangeset for help on using the changeset viewer.