Changeset 334 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Sep 28, 2007, 12:05:10 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Func.cpp
r332 r334 296 296 userProc.Using(); 297 297 } 298 void Opcode_CreateSimpleDelegate( const char *methodInstanceName, const UserProc &userProc )298 void Opcode_CreateSimpleDelegate( const CClass &dgClass, const char *methodInstanceName, const UserProc &userProc ) 299 299 { 300 300 ///////////////////////////////////////////////////////////////// … … 339 339 compiler.codeGenerator.op_mov_RM( sizeof(long), REG_EAX, REG_EAX, 0, MOD_BASE ); 340 340 341 //push this341 //push eax 342 342 compiler.codeGenerator.op_push( REG_EAX ); 343 343 … … 347 347 ///////////////////////////////////////////////////////////////// 348 348 349 std::vector<const UserProc *> subs; 350 dgClass.GetStaticMethods().Enum( "_CreateDelegate", subs ); 351 349 352 // call _System_CreateSimpleDynamicDelegate 350 extern const UserProc *pSub_System_CreateSimpleDynamicDelegate; 351 compiler.codeGenerator.op_call( pSub_System_CreateSimpleDynamicDelegate ); 353 compiler.codeGenerator.op_call( subs[0] ); 352 354 } 353 355 void Opcode_Func_AddressOf( const char *name, const Type &baseType, bool isCallOn, Type &resultType ){ … … 356 358 357 359 const Parameters *pBaseParams = NULL; 358 bool isDelegate = false;359 360 if( baseType.IsProcPtr() ) 360 361 { … … 362 363 pBaseParams = &compiler.GetObjectModule().meta.GetProcPointers()[baseType.GetIndex()]->Params(); 363 364 } 364 else if( baseType.IsObject() && baseType.GetClass().GetName() == "_SimpleDelegate" ) 365 { 366 extern const Delegate *pConstructingDelegate; 367 if( !pConstructingDelegate ) 368 { 369 SetError(); 370 } 365 else if( baseType.IsDelegate() ) 366 { 371 367 // 左辺でデリゲートを要求されているとき 372 pBaseParams = &pConstructingDelegate->Params(); 373 374 isDelegate = true; 368 pBaseParams = &baseType.GetClass().GetDelegate().Params(); 375 369 } 376 370 … … 402 396 } 403 397 404 if( isDelegate)398 if( baseType.IsDelegate() ) 405 399 { 406 400 if( isCallOn ) 407 401 { 408 402 // デリゲートのとき 409 Opcode_CreateSimpleDelegate( name, *pUserProc );403 Opcode_CreateSimpleDelegate( baseType.GetClass(), name, *pUserProc ); 410 404 } 411 405 resultType = baseType; -
trunk/abdev/BasicCompiler32/Compile_Object.cpp
r332 r334 17 17 18 18 19 const Delegate *pBackConstructingDelegate;20 if( pobj_c->IsDelegate() )21 {22 // デリゲートの場合はオーバーロード解決用のグローバル変数をセットする23 extern const Delegate *pConstructingDelegate;24 pBackConstructingDelegate = pConstructingDelegate;25 pConstructingDelegate = &pobj_c->GetDelegate();26 }27 28 29 19 /* //jnzのジャンプ先番地 30 20 extern int obp; … … 106 96 */ 107 97 } 108 109 if( pobj_c->IsDelegate() )110 {111 // デリゲートの場合はオーバーロード解決用のグローバル変数を元に戻す112 extern const Delegate *pConstructingDelegate;113 pConstructingDelegate = pBackConstructingDelegate;114 }115 98 } 116 99 void Operator_New( const CClass &classObj, const char *objectSizeStr, const char *parameter, const Type &baseType ){ -
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r301 r334 250 250 if(!GetArrayOffset(pMember->GetSubscripts(),array,pMember->GetType())){ 251 251 if(isErrorEnabled) SetError(14,member,cp); 252 return false; 252 253 } 253 254 } -
trunk/abdev/BasicCompiler32/MakePeHdr.cpp
r332 r334 42 42 *pSub_System_GC_free_for_SweepingDelete, 43 43 *pSubStaticMethod_System_TypeBase_InitializeUserTypes, 44 *pSub_System_CreateSimpleDynamicDelegate,45 44 46 45 *pSub_allrem, … … 284 283 pSubStaticMethod_System_TypeBase_InitializeUserTypes->ThisIsAutoGenerationProc(); 285 284 } 286 287 pSub_System_CreateSimpleDynamicDelegate = GetSubHash( "_System_CreateSimpleDynamicDelegate", TRUE );288 285 289 286 if( pUserProc_System_CGarbageCollection_RegisterGlobalRoots = GetClassMethod( "_System_CGarbageCollection", "RegisterGlobalRoots" ) ){ -
trunk/abdev/BasicCompiler32/NumOpe.cpp
r331 r334 147 147 const int useReg = REG_EAX; 148 148 149 150 //////////////////////////////// 151 // インデクサ(getアクセサ) 152 //////////////////////////////// 153 char VarName[VN_SIZE],ArrayElements[VN_SIZE]; 154 GetArrayElement(member,VarName,ArrayElements); 155 if(ArrayElements[0]){ 156 Type classType; 157 GetMemberType( leftType, VarName, classType, 0, false ); 158 if( classType.IsObject() ) 159 { 160 //オブジェクトポインタをecxにコピー 161 compiler.codeGenerator.op_mov_RR( REG_ECX, useReg ); 162 163 RELATIVE_VAR relativeVar; 164 relativeVar.dwKind=VAR_DIRECTMEM; 165 166 if( !_member_offset( 167 true, //エラー表示あり 168 false, //読み込み専用 169 leftType, 170 VarName,&relativeVar,classType,0)){ 171 return false; 172 } 173 174 // オブジェクトメンバのポインタをeaxにコピー 175 if( !VarToReg( relativeVar, baseType, resultType ) ){ 176 SetError(11,termFull,cp); 177 } 178 179 180 //オブジェクトポインタをスタックに入れておく 181 //push eax 182 compiler.codeGenerator.op_push( REG_EAX ); 183 184 char objectFullName[VN_SIZE], dummyArrayElements[VN_SIZE]; 185 GetArrayElement(termFull,objectFullName,dummyArrayElements); 186 187 CallIndexerGetterProc(/*UseReg,*/classType,objectFullName, ArrayElements,resultType, PROCFLAG_NEW ); 188 189 compiler.codeGenerator.op_pop(); 190 191 return true; 192 } 193 } 194 195 196 /////////////////////////////////////////////////////////////////// 197 // メンバを検索 198 /////////////////////////////////////////////////////////////////// 149 199 if( GetMemberType( leftType, member, resultType, 0, false ) ){ 150 200 // メンバが見つかったとき -
trunk/abdev/BasicCompiler32/Opcode.h
r331 r334 222 222 int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp); 223 223 void CallCastOperatorProc(Type &calcType,BOOL bCalcUseHeap,const Type &toType); 224 void CallIndexerGetterProc( const Type &classType, c har *ObjectName, char *Parameter,Type &resultType);224 void CallIndexerGetterProc( const Type &classType, const char *ObjectName, char *Parameter,Type &resultType, DWORD dwProcFlags = 0 ); 225 225 226 226 //Compile_Statement.cpp -
trunk/abdev/BasicCompiler32/OperatorProc.cpp
r299 r334 252 252 SetError(-1,"キャスト演算子がオーバーロードされていません。",cp); 253 253 } 254 void CallIndexerGetterProc( const Type &classType, c har *ObjectName, char *Parameter,Type &resultType){254 void CallIndexerGetterProc( const Type &classType, const char *ObjectName, char *Parameter,Type &resultType, DWORD dwProcFlags ){ 255 255 std::vector<const UserProc *> subs; 256 256 classType.GetClass().GetMethods().Enum( CALC_ARRAY_GET, subs ); … … 261 261 const UserProc *pUserProc = subs[0]; 262 262 263 Opcode_CallProc(Parameter,pUserProc, 0,ObjectName);263 Opcode_CallProc(Parameter,pUserProc,dwProcFlags,ObjectName); 264 264 resultType = pUserProc->ReturnType(); 265 265
Note:
See TracChangeset
for help on using the changeset viewer.