Changeset 76 in dev for BasicCompiler32/OperatorProc.cpp
- Timestamp:
- Mar 21, 2007, 9:26:56 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/OperatorProc.cpp
r75 r76 2 2 #include "Opcode.h" 3 3 4 void FreeTempObject(int reg, CClass *pobj_c){4 void FreeTempObject(int reg,const CClass *pobj_c){ 5 5 if(!IsSafeReg(reg)) SetError(300,NULL,cp); 6 6 … … 22 22 } 23 23 24 int CallOperatorProc(int idCalc, Type *pBaseTypeInfo,int *type,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){24 int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){ 25 25 //オーバーロードされたオペレータ関数を呼び出す 26 26 CClass *pobj_c; … … 39 39 40 40 41 int i;42 BOOL bReturnTypeIsObject=1;43 Type ReturnType={DEF_OBJECT,subs[0]->ReturnType().GetIndex()};44 foreach( UserProc *pUserProc, subs ){45 if(pUserProc->ReturnType().IsObject())46 bReturnTypeIsObject=0;47 }48 49 if(bReturnTypeIsObject==0){50 if(pBaseTypeInfo){51 if(pBaseTypeInfo->type==DEF_OBJECT){52 ReturnType.u.lpIndex=pBaseTypeInfo->u.lpIndex;53 }54 }55 }56 57 58 59 41 ///////////////////////////////////////////// 60 42 // オーバーロード解決用のパラメータを設定 … … 64 46 65 47 if(bTwoTerm){ 66 params.push_back( new Parameter( "", Type( type [sp-1], index_stack[sp-1] ) ) );48 params.push_back( new Parameter( "", Type( type_stack[sp-1], index_stack[sp-1] ) ) ); 67 49 } 68 50 … … 71 53 if(idCalc==CALC_EQUAL) lstrcpy(temporary,"=="); 72 54 else GetCalcName(idCalc,temporary); 73 Type returnType; 74 if( pBaseTypeInfo ){ 75 returnType.SetBasicType( pBaseTypeInfo->type ); 76 returnType.SetIndex( pBaseTypeInfo->u.lpIndex ); 77 } 78 UserProc *pUserProc = OverloadSolution( temporary, subs, params, returnType ); 55 UserProc *pUserProc = OverloadSolution( temporary, subs, params, baseType ); 79 56 80 57 if(!pUserProc){ … … 94 71 } 95 72 96 for(i =0;i<(int)params.size();i++){73 for(int i=0;i<(int)params.size();i++){ 97 74 CheckDifferentType( 98 75 pUserProc->Params()[i]->GetBasicType(), … … 108 85 } 109 86 110 int right_side_size = GetTypeSize(type [sp-1],index_stack[sp-1]);87 int right_side_size = GetTypeSize(type_stack[sp-1],index_stack[sp-1]); 111 88 112 89 if(bTwoTerm){ … … 224 201 225 202 sp--; 226 type [sp-1]=pUserProc->ReturnType().GetBasicType();203 type_stack[sp-1]=pUserProc->ReturnType().GetBasicType(); 227 204 index_stack[sp-1]=pUserProc->ReturnType().GetIndex(); 228 205 … … 237 214 } 238 215 239 void CallCastOperatorProc( int &CalcType,LONG_PTR &lpCalcIndex,BOOL bCalcUseHeap,int ToType,LONG_PTR lpToIndex){240 int type [10];216 void CallCastOperatorProc(Type &calcType,BOOL bCalcUseHeap,const Type &toType){ 217 int type_stack[10]; 241 218 LONG_PTR index_stack[10]; 242 219 BOOL array_bUseHeap[10]; … … 249 226 250 227 //左辺 251 type [0]=CalcType;252 index_stack[0]= lpCalcIndex;228 type_stack[0]=calcType.GetBasicType(); 229 index_stack[0]=calcType.GetIndex(); 253 230 array_bUseHeap[0]=0; 254 type [1]=ToType;255 index_stack[1]= lpToIndex;231 type_stack[1]=toType.GetBasicType(); 232 index_stack[1]=toType.GetIndex(); 256 233 array_bUseHeap[1]=0; 257 234 258 Type BaseTypeInfo={ToType,lpToIndex}; 259 260 int iRet; 261 iRet=CallOperatorProc(CALC_AS,&BaseTypeInfo,type,index_stack,array_bUseHeap,sp); 235 int iRet = CallOperatorProc(CALC_AS,toType,type_stack,index_stack,array_bUseHeap,sp); 236 262 237 if(iRet==1){ 263 238 //成功したとき 264 CalcType=type[0]; 265 lpCalcIndex=index_stack[0]; 239 calcType.SetType( type_stack[0], index_stack[0] ); 266 240 return; 267 241 } … … 274 248 SetError(-1,"キャスト演算子がオーバーロードされていません。",cp); 275 249 } 276 void CallIndexerGetterProc( CClass *pobj_Class,char *ObjectName,char *Parameter,Type &RetTypeInfo){250 void CallIndexerGetterProc(const CClass *pobj_Class,char *ObjectName,char *Parameter,Type &resultType){ 277 251 std::vector<UserProc *> subs; 278 252 pobj_Class->EnumMethod( CALC_ARRAY_GET, subs ); … … 282 256 283 257 Opcode_CallProc(Parameter,subs[0],0,ObjectName,DEF_OBJECT); 284 RetTypeInfo.type = subs[0]->ReturnType().GetBasicType(); 285 RetTypeInfo.u.lpIndex = subs[0]->ReturnType().GetIndex(); 286 } 258 resultType = subs[0]->ReturnType(); 259 }
Note:
See TracChangeset
for help on using the changeset viewer.