Changeset 424 in dev for trunk/abdev
- Timestamp:
- Mar 10, 2008, 5:39:36 PM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Func.cpp
r370 r424 452 452 453 453 //オーバーロードを解決 454 pUserProc=OverloadSolution( name, subs, *pBaseParams, Type() );454 pUserProc=OverloadSolution( name, subs, *pBaseParams, Type(), Type() ); 455 455 456 456 if( isCallOn && baseType.IsDelegate() ) -
trunk/abdev/BasicCompiler32/Compile_Statement.cpp
r415 r424 1022 1022 1023 1023 //オーバーロードを解決 1024 const UserProc *pUserProc = OverloadSolution( "==",subs, params, NULL);1024 const UserProc *pUserProc = OverloadSolution( "==", subs, params, Type( DEF_BOOLEAN ), type1 ); 1025 1025 1026 1026 delete params[0]; -
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r421 r424 428 428 int ptrLevel = PTR_LEVEL( resultType.GetBasicType() ); 429 429 430 // TODO: ベースオブジェクト(指定されていないときはObjectクラス)にセットする430 // 制約クラス(指定されていないときはObjectクラス)にセットする 431 431 resultType.SetBasicType( DEF_OBJECT ); 432 432 -
trunk/abdev/BasicCompiler32/Opcode.h
r415 r424 190 190 191 191 private: 192 bool EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType, bool &isErrored );192 bool EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType, const Type &leftType, const UserProc &userProc, bool &isErrored ); 193 193 public: 194 const UserProc *_OverloadSolution( const char *name, std::vector<const UserProc *> &subs, bool isEnabledReturnType = false );195 const UserProc *OverloadSolution( const char *name, std::vector<const UserProc *> &subs, bool isEnabledReturnType = false );194 const UserProc *_OverloadSolution( const char *name, std::vector<const UserProc *> &subs, const Type &leftType, bool isEnabledReturnType ); 195 const UserProc *OverloadSolution( const char *name, std::vector<const UserProc *> &subs, const Type &leftType, bool isEnabledReturnType = false ); 196 196 197 197 void ApplyDefaultParameters( const Parameters ¶ms ); -
trunk/abdev/BasicCompiler32/OperatorProc.cpp
r402 r424 60 60 if(idCalc==CALC_EQUAL) lstrcpy(temporary,"=="); 61 61 else GetCalcName(idCalc,temporary); 62 const UserProc *pUserProc = OverloadSolution( temporary, subs, params, baseType );62 const UserProc *pUserProc = OverloadSolution( temporary, subs, params, baseType, leftType ); 63 63 64 64 if(!pUserProc){ -
trunk/abdev/BasicCompiler_Common/Compile.cpp
r402 r424 84 84 // ジェネリクスのクラス型記述を分析 85 85 /////////////////////////////////////////////////// 86 void SplitGenericClassInstance( const char *fullName, char *className, Jenga::Common::Strings &typeParameters )86 void SplitGenericClassInstance( const char *fullName, char *className, Jenga::Common::Strings &typeParameters, bool isDefiningClass, Jenga::Common::Strings *pTypeParameterBaseClassNames ) 87 87 { 88 if( isDefiningClass ) 89 { 90 if( !pTypeParameterBaseClassNames ) 91 { 92 SetError(); 93 } 94 pTypeParameterBaseClassNames->clear(); 95 } 96 88 97 int i = 0; 89 98 typeParameters.clear(); … … 109 118 SetError(1,NULL,cp); 110 119 } 111 112 120 typeParameters.push_back( temporary ); 121 122 if( isDefiningClass ) 123 { 124 // クラス定義中にこの関数が呼び出されたとき 125 126 if( fullName[i] == 1 && fullName[i+1] == ESC_AS ) 127 { 128 // 型パラメータの制約クラスを取得 129 i += 2; 130 GetIdentifierToken( temporary, fullName, i ); 131 if( temporary[0] == '\0' ) 132 { 133 extern int cp; 134 SetError(1,NULL,cp); 135 } 136 } 137 else 138 { 139 temporary[0] = 0; 140 } 141 pTypeParameterBaseClassNames->push_back( temporary ); 142 } 113 143 114 144 if( fullName[i] == ',' ) -
trunk/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
r415 r424 194 194 } 195 195 196 int GetReturnType_OperatorProc(int idCalc,const Type &baseType,int *type,LONG_PTR *index_stack,int &sp){ 197 //オーバーロードされたオペレータ関数の戻り値を取得 198 CClass *pobj_c; 199 pobj_c=(CClass *)index_stack[sp-2]; 196 int GetReturnType_OperatorProc(int idCalc,const Type &baseType,int *type_stack,LONG_PTR *index_stack,int &sp){ 197 Type leftType( type_stack[sp-2], index_stack[sp-2] ); 198 Type rightType( type_stack[sp-1] & (~FLAG_CAST), index_stack[sp-1] ); 199 200 //オーバーロードされたオペレータ関数を呼び出す 201 const CClass *pobj_c = &leftType.GetClass(); 200 202 201 203 std::vector<const UserProc *> subs; … … 221 223 222 224 if(bTwoTerm){ 223 params.push_back( new Parameter( "", Type( type[sp-1], index_stack[sp-1] )) );225 params.push_back( new Parameter( "", rightType ) ); 224 226 } 225 227 … … 229 231 if(idCalc==CALC_EQUAL) lstrcpy(temporary,"=="); 230 232 else GetCalcName(idCalc,temporary); 231 const UserProc *pUserProc = OverloadSolution( temporary, subs, params, baseType );233 const UserProc *pUserProc = OverloadSolution( temporary, subs, params, baseType, leftType ); 232 234 233 235 if(bTwoTerm){ … … 246 248 247 249 sp--; 248 type [sp-1]=pUserProc->ReturnType().GetBasicType();250 type_stack[sp-1]=pUserProc->ReturnType().GetBasicType(); 249 251 index_stack[sp-1]=pUserProc->ReturnType().GetIndex(); 250 252 -
trunk/abdev/BasicCompiler_Common/Overload.cpp
r206 r424 29 29 char MethodName[VN_SIZE]; 30 30 if( !SplitMemberName( name, NULL, MethodName ) ) lstrcpy( MethodName, name ); 31 31 32 /* 32 33 //メソッドの場合は静的かどうかを調べる … … 40 41 pobj_parameter=new ParamImpl(Parameter); 41 42 43 Type leftType; 44 GetTermType( ObjectName, leftType ); 42 45 43 const UserProc *pUserProc = pobj_parameter->OverloadSolution( name,subs);46 const UserProc *pUserProc = pobj_parameter->OverloadSolution( name, subs, leftType ); 44 47 45 48 … … 54 57 std::vector<const UserProc *> &subs, 55 58 const Parameters ¶ms, 56 const Type &returnType ){ 59 const Type &returnType, 60 const Type &leftType ) 61 { 57 62 58 63 // オーバーロードの解決 … … 67 72 } 68 73 69 const UserProc *pUserProc = pobj_Parameter->OverloadSolution( name,subs);74 const UserProc *pUserProc = pobj_Parameter->OverloadSolution( name, subs, leftType); 70 75 71 76 delete pobj_Parameter; -
trunk/abdev/BasicCompiler_Common/ParamImpl.cpp
r364 r424 107 107 } 108 108 109 bool ParamImpl::EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType, bool &isErrored ){109 bool ParamImpl::EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType, const Type &leftType, const UserProc &userProc, bool &isErrored ){ 110 110 //パラメータを識別してオーバーロードを解決 111 111 … … 124 124 for(int i=0;i<max;i++){ 125 125 Parameter ¶m = *targetParms[i]; 126 127 Type paramType( param ); 128 ResolveFormalGenericTypeParameter( paramType, leftType, &userProc ); 126 129 127 130 if( i >= ParmsNum ){ … … 140 143 141 144 if( !NumOpe_GetType(Parms[i], 142 ( level <= OVERLOAD_LEVEL3 )? nullParam : param ,145 ( level <= OVERLOAD_LEVEL3 )? nullParam : paramType, 143 146 argType) ) 144 147 { … … 151 154 } 152 155 153 if(argType.GetBasicType()!=param.GetBasicType()){ 156 if( ( argType.IsObject() && paramType.IsObject() ) || argType.GetBasicType() == paramType.GetBasicType() ) 157 { 158 if( argType.IsStruct() ){ 159 if(argType.GetIndex()!=paramType.GetIndex()){ 160 return false; 161 } 162 } 163 else if( argType.IsObject() ){ 164 if( level == OVERLOAD_LEVEL0 ){ 165 if( !paramType.GetClass().IsEquals( &argType.GetClass() ) ){ 166 return false; 167 } 168 } 169 else{ 170 if( !paramType.GetClass().IsEqualsOrSubClass( &argType.GetClass() ) ){ 171 return false; 172 } 173 } 174 } 175 } 176 else 177 { 154 178 if( level == OVERLOAD_LEVEL0 || level == OVERLOAD_LEVEL1 || level==OVERLOAD_LEVEL4 ){ 155 179 return false; 156 180 } 157 181 else if( level == OVERLOAD_LEVEL2 ){ 158 if( !(argType.IsWhole() && param .IsWhole() && argType.GetBasicSize() == param.GetBasicSize() ) ){182 if( !(argType.IsWhole() && paramType.IsWhole() && argType.GetBasicSize() == paramType.GetBasicSize() ) ){ 159 183 // サイズ違い 160 184 return false; … … 163 187 else if( level == OVERLOAD_LEVEL3 || level==OVERLOAD_LEVEL5){ 164 188 if(!( 165 argType.IsWhole()&¶m .IsWhole()||166 argType.IsReal()&¶m .IsReal()189 argType.IsWhole()&¶mType.IsWhole()|| 190 argType.IsReal()&¶mType.IsReal() 167 191 )){ 168 192 return false; 169 193 } 170 if( argType.IsPointer() || param .IsPointer() )194 if( argType.IsPointer() || paramType.IsPointer() ) 171 195 { 172 196 // ポインタ型の不整合は認めない … … 175 199 } 176 200 else if(level==OVERLOAD_LEVEL6){ 177 if(argType.IsObject()||param.IsObject()) return false; 178 } 179 } 180 else{ 181 if( NATURAL_TYPE(argType.GetBasicType())==DEF_STRUCT){ 182 if(argType.GetIndex()!=param.GetIndex()){ 183 return false; 184 } 185 } 186 else if( NATURAL_TYPE(argType.GetBasicType())==DEF_OBJECT ){ 187 if( level == OVERLOAD_LEVEL0 ){ 188 if( !param.GetClass().IsEquals( &argType.GetClass() ) ){ 189 return false; 190 } 191 } 192 else{ 193 if( !param.GetClass().IsEqualsOrSubClass( &argType.GetClass() ) ){ 194 return false; 195 } 196 } 201 if(argType.IsObject()||paramType.IsObject()) return false; 197 202 } 198 203 } … … 209 214 } 210 215 211 const UserProc *ParamImpl::_OverloadSolution( const char *name, std::vector<const UserProc *> &subs, bool isEnabledReturnType ){216 const UserProc *ParamImpl::_OverloadSolution( const char *name, std::vector<const UserProc *> &subs, const Type &leftType, bool isEnabledReturnType ){ 212 217 const UserProc *pUserProc = NULL; 213 218 … … 218 223 bool isErrored = false; 219 224 bool isHit = false; 220 isHit = EvaluateOverloadScore( level, pTempUserProc->Params(), isEnabledReturnType?pTempUserProc->ReturnType():Type(), isErrored );225 isHit = EvaluateOverloadScore( level, pTempUserProc->Params(), isEnabledReturnType?pTempUserProc->ReturnType():Type(), leftType, *pTempUserProc, isErrored ); 221 226 if( isErrored ) 222 227 { … … 239 244 trace_for_overload( "戻り値も比較するモードに切り替えてオーバーロード解決を試みる" ); 240 245 241 return OverloadSolution( name,subs, true);246 return OverloadSolution( name, subs, leftType, true); 242 247 } 243 248 } … … 278 283 return pUserProc; 279 284 } 280 const UserProc *ParamImpl::OverloadSolution( const char *name, std::vector<const UserProc *> &subs, bool isEnabledReturnType ){285 const UserProc *ParamImpl::OverloadSolution( const char *name, std::vector<const UserProc *> &subs, const Type &leftType, bool isEnabledReturnType ){ 281 286 trace_for_overload( "" ); 282 287 trace_for_overload( "■■■■■■■■■■■■■■■■■■" ); 283 288 trace_for_overload( "■■■ オーバーロード解決(" << name << ")" ); 284 289 285 const UserProc *result = _OverloadSolution( name, subs, isEnabledReturnType );290 const UserProc *result = _OverloadSolution( name, subs, leftType, isEnabledReturnType ); 286 291 287 292 trace_for_overload( "■■■ ここまで" ); -
trunk/abdev/BasicCompiler_Common/common.h
r415 r424 250 250 std::vector<const UserProc *> &subs, 251 251 const Parameters ¶ms, 252 const Type &returnType ); 252 const Type &returnType, 253 const Type &leftType ); 253 254 254 255 //Debug.cpp … … 382 383 void GetCommandToken( char *token, const char *source, int &pos ); 383 384 void GetCustomToken( char *token, const char *source, int &pos, char delimitation, bool isEscapeSequence ); 384 void SplitGenericClassInstance( const char *fullName, char *className, Jenga::Common::Strings &typeParameters );385 void SplitGenericClassInstance( const char *fullName, char *className, Jenga::Common::Strings &typeParameters, bool isDefiningClass = false, Jenga::Common::Strings *pTypeParameterBaseClassNames = NULL ); 385 386 int JumpStatement(const char *source, int &pos); 386 387 void Compile(void); -
trunk/abdev/BasicCompiler_Common/error.cpp
r412 r424 463 463 if( varType.IsObject() || calcType.IsObject() ) 464 464 { 465 //いずれかがオブジェクト の場合466 if( varType.GetBasicType() != calcType.GetBasicType() )465 //いずれかがオブジェクトではない場合 466 if( (!varType.IsObject()) || (!calcType.IsObject()) ) 467 467 { 468 468 DifferentTypeError( varType, calcType,3,pszFuncName,ParmNum); -
trunk/abdev/BasicCompiler_Common/include/Class.h
r417 r424 290 290 291 291 // 型パラメータ 292 const GenericTypes &GetFormalGenericTypes() const 293 { 294 return formalGenericTypes; 295 } 292 296 void AddFormalGenericType( GenericType genericType ) 293 297 { -
trunk/abdev/BasicCompiler_Common/include/Type.h
r378 r424 247 247 typedef std::vector<Type> Types; 248 248 249 /*! 250 @brief ジェネリックな型を解決する 251 @param typeParameter ジェネリック型を指定する。ここに解決後の型が入る。 252 classType インスタンス化されているオブジェクトの型 253 pUserProc 現在コンパイル中の関数(ただしクラスメソッドのみ) 254 */ 249 255 void ResolveFormalGenericTypeParameter( Type &typeParameter, const Type &classType, const UserProc *pUserProc = NULL ); 250 256 -
trunk/abdev/BasicCompiler_Common/src/Class_Collect.cpp
r409 r424 332 332 char className[VN_SIZE]; 333 333 Jenga::Common::Strings typeParameters; 334 SplitGenericClassInstance( temporary, className, typeParameters ); 334 Jenga::Common::Strings typeParameterBaseClassNames; 335 SplitGenericClassInstance( temporary, className, typeParameters, true, &typeParameterBaseClassNames ); 335 336 336 337 CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, className) ); … … 353 354 ///////////////////////////////////////////////////////// 354 355 // ☆★☆ ジェネリクスサポート ☆★☆ 355 BOOST_FOREACH( const std::string &typeParameter, typeParameters ) 356 { 357 pobj_c->AddFormalGenericType( GenericType( typeParameter, Type(DEF_OBJECT,*GetObjectClassPtr()) ) ); 356 for( i2=0; i2<static_cast<int>(typeParameters.size()); i2++ ) 357 { 358 Type baseType( DEF_OBJECT, *GetObjectClassPtr() ); 359 if( typeParameterBaseClassNames[i2].size() ) 360 { 361 if( !compiler.StringToType( typeParameterBaseClassNames[i2], baseType ) ) 362 { 363 SetError(106,typeParameterBaseClassNames[i2],i); 364 } 365 else if( !baseType.IsObject() ) 366 { 367 SetError(106,typeParameterBaseClassNames[i2],i); 368 } 369 } 370 371 pobj_c->AddFormalGenericType( GenericType( typeParameters[i2], baseType ) ); 358 372 } 359 373 ///////////////////////////////////////////////////////// … … 527 541 char className[VN_SIZE]; 528 542 Jenga::Common::Strings typeParameters; 529 SplitGenericClassInstance( temporary, className, typeParameters ); 543 Jenga::Common::Strings typeParameterBaseClassNames; 544 SplitGenericClassInstance( temporary, className, typeParameters, true, &typeParameterBaseClassNames ); 530 545 531 546 CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, className) ); … … 549 564 ///////////////////////////////////////////////////////// 550 565 // ☆★☆ ジェネリクスサポート ☆★☆ 551 BOOST_FOREACH( const std::string &typeParameter, typeParameters ) 552 { 553 pobj_c->AddFormalGenericType( GenericType( typeParameter, Type(DEF_OBJECT,*GetObjectClassPtr()) ) ); 566 for( i2=0; i2<static_cast<int>(typeParameters.size()); i2++ ) 567 { 568 Type baseType( DEF_OBJECT, *GetObjectClassPtr() ); 569 if( typeParameterBaseClassNames[i2].size() ) 570 { 571 if( !compiler.StringToType( typeParameterBaseClassNames[i2], baseType ) ) 572 { 573 SetError(106,typeParameterBaseClassNames[i2],i); 574 } 575 else if( !baseType.IsObject() ) 576 { 577 SetError(106,typeParameterBaseClassNames[i2],i); 578 } 579 } 580 581 pobj_c->AddFormalGenericType( GenericType( typeParameters[i2], baseType ) ); 554 582 } 555 583 ///////////////////////////////////////////////////////// -
trunk/abdev/BasicCompiler_Common/src/Compiler.cpp
r370 r424 155 155 // コンパイル中クラスにおけるジェネリクス用の型パラメータのとき 156 156 type.SetBasicType( DEF_TYPE_PARAMETER ); 157 type.SetClassPtr( this->GetObjectModule().meta.GetClasses().GetObjectClassPtr() );157 type.SetClassPtr( &this->pCompilingClass->GetFormalGenericTypes()[formalTypeIndex].GetType().GetClass() ); 158 158 type.SetFormalTypeName( typeName ); 159 159 type.SetFormalTypeIndex( formalTypeIndex ); -
trunk/abdev/BasicCompiler_Common/src/Enum.cpp
r407 r424 177 177 sprintf(buffer+length,"Class Enum %s\n",enumInfo.GetName().c_str()); 178 178 length+=lstrlen(buffer+length); 179 lstrcpy(buffer+length,"\tInherits EnumBase\n");179 sprintf(buffer+length,"\tInherits EnumBase<%s>\n",enumInfo.GetName().c_str()); 180 180 length+=lstrlen(buffer+length); 181 181 sprintf(buffer+length,"\tSub %s(value As Long,lpszName As LPSTR)\n",enumInfo.GetName().c_str()); … … 211 211 } 212 212 213 sprintf(buffer+length,"\tFunction Operator or (enumBase As %s) As %s\n",enumInfo.GetName().c_str(),enumInfo.GetName().c_str());214 length+=lstrlen(buffer+length);215 sprintf(buffer+length,"\t\tReturn New %s(This.value or enumBase.value, \"custom\")\n",enumInfo.GetName().c_str());216 length+=lstrlen(buffer+length);217 lstrcpy(buffer+length,"\tEnd Function\n");218 length+=lstrlen(buffer+length);219 220 sprintf(buffer+length,"\tFunction Operator and (enumBase As %s) As %s\n",enumInfo.GetName().c_str(),enumInfo.GetName().c_str());221 length+=lstrlen(buffer+length);222 sprintf(buffer+length,"\t\tReturn New %s(This.value and enumBase.value, \"custom\")\n",enumInfo.GetName().c_str());223 length+=lstrlen(buffer+length);224 lstrcpy(buffer+length,"\tEnd Function\n");225 length+=lstrlen(buffer+length);226 227 /*228 sprintf(buffer+length,"\tOverride Function ToString() As String\n",enumInfo.TypeName);229 length+=lstrlen(buffer+length);230 lstrcpy(buffer+length,"\t\tSelect Case value\n");231 length+=lstrlen(buffer+length);232 for(i2=0;i2<enumInfo.iEnumMemberNum;i2++){233 CEnumMember *member;234 member=enumInfo.ppobj_EnumMember[i2];235 236 sprintf(buffer+length,"\t\t\tCase %d\n",member->m_value);237 length+=lstrlen(buffer+length);238 sprintf(buffer+length,"\t\t\t\tReturn \"%s\"\n",member->m_name);239 length+=lstrlen(buffer+length);240 }241 lstrcpy(buffer+length,"\t\tEnd Select\n");242 length+=lstrlen(buffer+length);243 lstrcpy(buffer+length,"\tEnd Function\n");244 length+=lstrlen(buffer+length);245 246 247 sprintf(buffer+length,"\tSub Operator= (ByRef value As %s)\n",enumInfo.TypeName);248 length+=lstrlen(buffer+length);249 lstrcpy(buffer+length,"\t\tThis.Copy(ByVal VarPtr(value))\n");250 length+=lstrlen(buffer+length);251 lstrcpy(buffer+length,"\tEnd Sub\n");252 length+=lstrlen(buffer+length);253 254 sprintf(buffer+length,"\tSub Operator= (ByRef value As String)\n",enumInfo.TypeName);255 length+=lstrlen(buffer+length);256 lstrcpy(buffer+length,"\t\tSelect Case value\n");257 length+=lstrlen(buffer+length);258 for(i2=0;i2<enumInfo.iEnumMemberNum;i2++){259 CEnumMember *member;260 member=enumInfo.ppobj_EnumMember[i2];261 262 sprintf(buffer+length,"\t\t\tCase \"%s\"\n",member->m_name);263 length+=lstrlen(buffer+length);264 sprintf(buffer+length,"\t\t\t\tThis=%s.%s\n",enumInfo.TypeName,member->m_name);265 length+=lstrlen(buffer+length);266 }267 lstrcpy(buffer+length,"\t\tEnd Select\n");268 length+=lstrlen(buffer+length);269 lstrcpy(buffer+length,"\tEnd Sub\n");270 length+=lstrlen(buffer+length);271 272 sprintf(buffer+length,"\tSub Operator= (value As Long)\n",enumInfo.TypeName);273 length+=lstrlen(buffer+length);274 lstrcpy(buffer+length,"\t\tm_Value=value\n");275 length+=lstrlen(buffer+length);276 lstrcpy(buffer+length,"\tEnd Sub\n");277 length+=lstrlen(buffer+length);*/278 279 213 lstrcpy(buffer+length,"End Class\n"); 280 214 length+=lstrlen(buffer+length); -
trunk/abdev/BasicCompiler_Common/src/Type.cpp
r378 r424 541 541 void ResolveFormalGenericTypeParameter( Type &typeParameter, const Type &classType, const UserProc *pUserProc ) 542 542 { 543 if( !typeParameter.IsTypeParameter() ) 544 { 545 // ジェネリックな型ではなかったとき 546 return; 547 } 548 543 549 ///////////////////////////////////////////////////////// 544 550 // ☆★☆ ジェネリクスサポート ☆★☆ 545 551 552 // ポインタレベルを抽出 553 int ptrLevel = PTR_LEVEL( typeParameter.GetBasicType() ); 554 555 if( pUserProc ) 556 { 557 if( classType.IsObject() ) 558 { 559 // 基底クラスでの自己解決 560 const CClass *pClass = &classType.GetClass(); 561 while( pClass->HasSuperClass() ) 562 { 563 if( pUserProc->GetParentClassPtr() == &pClass->GetSuperClass() ) 564 { 565 if( pClass->GetSuperClassActualTypeParameters().size() ) 566 { 567 // TODO: 適切な形に実装し直す(暫定的にトップの型を持ってきている) 568 typeParameter = pClass->GetSuperClassActualTypeParameters()[0]; 569 } 570 } 571 pClass = &pClass->GetSuperClass(); 572 } 573 } 574 } 575 546 576 if( typeParameter.IsTypeParameter() ) 547 577 { 548 // 型パラメータだったとき 549 550 // ポインタレベルを抽出 551 int ptrLevel = PTR_LEVEL( typeParameter.GetBasicType() ); 552 553 if( pUserProc ) 578 if( classType.HasActualGenericType() ) 554 579 { 555 if( classType.IsObject() ) 556 { 557 // 基底クラスでの自己解決 558 const CClass *pClass = &classType.GetClass(); 559 while( pClass->HasSuperClass() ) 560 { 561 if( pUserProc->GetParentClassPtr() == &pClass->GetSuperClass() ) 562 { 563 if( pClass->GetSuperClassActualTypeParameters().size() ) 564 { 565 // TODO: 適切な形に実装し直す(暫定的にトップの型を持ってきている) 566 typeParameter = pClass->GetSuperClassActualTypeParameters()[0]; 567 } 568 } 569 pClass = &pClass->GetSuperClass(); 570 } 571 } 572 } 573 574 if( typeParameter.IsTypeParameter() ) 580 typeParameter = classType.GetActualGenericType( typeParameter.GetFormalTypeIndex() ); 581 } 582 else 575 583 { 576 if( classType.HasActualGenericType() ) 577 { 578 typeParameter = classType.GetActualGenericType( typeParameter.GetFormalTypeIndex() ); 579 } 580 else 581 { 582 // TODO: ベースオブジェクト(指定されていないときはObjectクラス)にセットする 583 typeParameter.SetBasicType( DEF_OBJECT ); 584 } 585 } 586 587 for( int i=0; i<ptrLevel; i++ ) 588 { 589 typeParameter.PtrLevelUp(); 590 } 584 // 制約クラス(指定されていないときはObjectクラス)にセットする 585 typeParameter.SetBasicType( DEF_OBJECT ); 586 } 587 } 588 589 for( int i=0; i<ptrLevel; i++ ) 590 { 591 typeParameter.PtrLevelUp(); 591 592 } 592 593
Note:
See TracChangeset
for help on using the changeset viewer.