[206] | 1 | #include "stdafx.h"
|
---|
| 2 |
|
---|
| 3 | #include <Class.h>
|
---|
| 4 |
|
---|
| 5 | const int Type::basicTypeList[] = {
|
---|
| 6 | DEF_BYTE,
|
---|
| 7 | DEF_SBYTE,
|
---|
| 8 | DEF_WORD,
|
---|
| 9 | DEF_INTEGER,
|
---|
| 10 | DEF_DWORD,
|
---|
| 11 | DEF_LONG,
|
---|
| 12 | DEF_QWORD,
|
---|
| 13 | DEF_INT64,
|
---|
| 14 |
|
---|
| 15 | DEF_SINGLE,
|
---|
| 16 | DEF_DOUBLE,
|
---|
| 17 |
|
---|
| 18 | DEF_BOOLEAN,
|
---|
| 19 |
|
---|
| 20 | DEF_PTR_VOID,
|
---|
| 21 |
|
---|
| 22 | DEF_ANY,
|
---|
| 23 |
|
---|
| 24 | DEF_NON
|
---|
| 25 | };
|
---|
| 26 |
|
---|
[523] | 27 | const std::string Type::basicTypeNameList[] = {
|
---|
[206] | 28 | "Byte",
|
---|
| 29 | "SByte",
|
---|
| 30 | "Word",
|
---|
| 31 | "Integer",
|
---|
| 32 | "DWord",
|
---|
| 33 | "Long",
|
---|
| 34 | "QWord",
|
---|
| 35 | "Int64",
|
---|
| 36 |
|
---|
| 37 | "Single",
|
---|
| 38 | "Double",
|
---|
| 39 |
|
---|
| 40 | "Boolean",
|
---|
| 41 |
|
---|
| 42 | "VoidPtr",
|
---|
| 43 |
|
---|
| 44 | "Any",
|
---|
| 45 |
|
---|
| 46 | ""
|
---|
| 47 | };
|
---|
| 48 |
|
---|
[290] | 49 | Type::~Type()
|
---|
| 50 | {
|
---|
| 51 | }
|
---|
| 52 |
|
---|
[523] | 53 | bool Type::StringToBasicType( const std::string &typeName, int &basicType ){
|
---|
[206] | 54 | for( int i=0; ; i++ ){
|
---|
| 55 | if( basicTypeList[i] == DEF_NON ){
|
---|
| 56 | break;
|
---|
| 57 | }
|
---|
| 58 | if( basicTypeNameList[i] == typeName ){
|
---|
| 59 | basicType = basicTypeList[i];
|
---|
| 60 | return true;
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | return false;
|
---|
| 64 | }
|
---|
| 65 | const char *Type::BasicTypeToCharPtr( const Type &type )
|
---|
| 66 | {
|
---|
| 67 | for( int i=0; ; i++ ){
|
---|
| 68 | if( basicTypeList[i] == DEF_NON ){
|
---|
| 69 | break;
|
---|
| 70 | }
|
---|
| 71 | if( basicTypeList[i] == type.GetBasicType() ){
|
---|
| 72 | return basicTypeNameList[i].c_str();
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 | return NULL;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | int Type::GetBasicSize( int basicType )
|
---|
| 79 | {
|
---|
| 80 |
|
---|
| 81 | // 基本型
|
---|
| 82 | switch( basicType ){
|
---|
| 83 | case DEF_SBYTE:
|
---|
| 84 | case DEF_BYTE:
|
---|
| 85 | case DEF_BOOLEAN:
|
---|
| 86 | return sizeof(BYTE);
|
---|
| 87 |
|
---|
| 88 | case DEF_INTEGER:
|
---|
| 89 | case DEF_WORD:
|
---|
| 90 | return sizeof(WORD);
|
---|
| 91 |
|
---|
| 92 | case DEF_LONG:
|
---|
| 93 | case DEF_DWORD:
|
---|
| 94 | return sizeof(DWORD);
|
---|
| 95 |
|
---|
| 96 | case DEF_INT64:
|
---|
| 97 | case DEF_QWORD:
|
---|
| 98 | return sizeof(_int64);
|
---|
| 99 |
|
---|
| 100 | case DEF_DOUBLE:
|
---|
| 101 | return sizeof(double);
|
---|
| 102 | case DEF_SINGLE:
|
---|
| 103 | return sizeof(float);
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | // ポインタ
|
---|
| 107 | if(IsPointer( basicType )){
|
---|
| 108 | return PTR_SIZE;
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | // オブジェクト
|
---|
| 112 | if(basicType==DEF_OBJECT){
|
---|
| 113 | return PTR_SIZE;
|
---|
| 114 | }
|
---|
| 115 |
|
---|
[556] | 116 | throw;
|
---|
[206] | 117 |
|
---|
| 118 | return 0;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
[290] | 121 | const CClass &Type::GetClass() const
|
---|
| 122 | {
|
---|
| 123 | if( !HasMember() )
|
---|
| 124 | {
|
---|
| 125 | Jenga::Throw( "クラスまたは構造体でない型に対してGetClassを呼び出した" );
|
---|
| 126 | }
|
---|
[206] | 127 |
|
---|
[290] | 128 | return *pClass;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
[206] | 131 | bool Type::Equals( const Type &type ) const
|
---|
| 132 | {
|
---|
| 133 | if( basicType == type.basicType ){
|
---|
| 134 | if( NATURAL_TYPE( basicType ) == DEF_OBJECT
|
---|
| 135 | || NATURAL_TYPE( basicType ) == DEF_STRUCT ){
|
---|
| 136 |
|
---|
| 137 | if( index == type.index ){
|
---|
| 138 | return true;
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | }
|
---|
| 142 | else{
|
---|
| 143 | return true;
|
---|
| 144 | }
|
---|
| 145 | }
|
---|
| 146 | return false;
|
---|
| 147 | }
|
---|
| 148 |
|
---|
[447] | 149 | bool Type::IsCovariant( const Type &type ) const
|
---|
| 150 | {
|
---|
| 151 | if( !this->IsObject() || !type.IsObject() )
|
---|
| 152 | {
|
---|
| 153 | // 共変性の判別はクラス型のみ
|
---|
| 154 | return false;
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | return this->GetClass().IsSubClass( &type.GetClass() );
|
---|
| 158 | }
|
---|
[448] | 159 | bool Type::IsContravariant( const Type &type ) const
|
---|
| 160 | {
|
---|
| 161 | if( !this->IsObject() || !type.IsObject() )
|
---|
| 162 | {
|
---|
| 163 | // 反変性の判別はクラス型のみ
|
---|
| 164 | return false;
|
---|
| 165 | }
|
---|
[447] | 166 |
|
---|
[448] | 167 | return type.GetClass().IsSubClass( &this->GetClass() );
|
---|
| 168 | }
|
---|
| 169 |
|
---|
[206] | 170 | int Type::GetBasicSize() const
|
---|
| 171 | {
|
---|
| 172 | return GetBasicSize( basicType );
|
---|
| 173 | }
|
---|
| 174 | int Type::GetSize() const
|
---|
| 175 | {
|
---|
| 176 |
|
---|
| 177 | // 基本型
|
---|
| 178 | switch( basicType ){
|
---|
| 179 | case DEF_LONG:
|
---|
| 180 | if(index==LITERAL_NULL||index==LITERAL_M128_0||index==LITERAL_0_255){
|
---|
| 181 | return sizeof(BYTE);
|
---|
| 182 | }
|
---|
| 183 | else if(index==LITERAL_M32768_0||index==LITERAL_0_65535){
|
---|
| 184 | return sizeof(WORD);
|
---|
| 185 | }
|
---|
| 186 | return sizeof(DWORD);
|
---|
| 187 |
|
---|
| 188 | case DEF_SBYTE:
|
---|
| 189 | case DEF_BYTE:
|
---|
| 190 | case DEF_BOOLEAN:
|
---|
| 191 | return sizeof(BYTE);
|
---|
| 192 |
|
---|
| 193 | case DEF_INTEGER:
|
---|
| 194 | case DEF_WORD:
|
---|
| 195 | return sizeof(WORD);
|
---|
| 196 |
|
---|
| 197 | case DEF_DWORD:
|
---|
| 198 | return sizeof(DWORD);
|
---|
| 199 |
|
---|
| 200 | case DEF_INT64:
|
---|
| 201 | case DEF_QWORD:
|
---|
| 202 | return sizeof(_int64);
|
---|
| 203 |
|
---|
| 204 | case DEF_DOUBLE:
|
---|
| 205 | return sizeof(double);
|
---|
| 206 | case DEF_SINGLE:
|
---|
| 207 | return sizeof(float);
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | // ポインタ
|
---|
| 211 | if(IsPointer()){
|
---|
| 212 | return PTR_SIZE;
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | // 構造体
|
---|
[290] | 216 | if( IsStruct() )
|
---|
| 217 | {
|
---|
[206] | 218 | if( !pClass ){
|
---|
[556] | 219 | throw;
|
---|
[206] | 220 | }
|
---|
| 221 |
|
---|
| 222 | return pClass->GetSize();
|
---|
| 223 | }
|
---|
| 224 |
|
---|
| 225 | // オブジェクト
|
---|
[290] | 226 | if( IsObject() )
|
---|
| 227 | {
|
---|
[206] | 228 | return PTR_SIZE;
|
---|
| 229 | }
|
---|
| 230 |
|
---|
[556] | 231 | throw;
|
---|
[206] | 232 | }
|
---|
| 233 |
|
---|
| 234 | bool Type::IsNull() const{
|
---|
| 235 | if( basicType == DEF_NON ){
|
---|
| 236 | return true;
|
---|
| 237 | }
|
---|
| 238 | return false;
|
---|
| 239 | }
|
---|
| 240 |
|
---|
| 241 | bool Type::IsByte() const{
|
---|
| 242 | if( basicType == DEF_BYTE ){
|
---|
| 243 | return true;
|
---|
| 244 | }
|
---|
| 245 | return false;
|
---|
| 246 | }
|
---|
| 247 | bool Type::IsSByte() const{
|
---|
| 248 | if( basicType == DEF_SBYTE ){
|
---|
| 249 | return true;
|
---|
| 250 | }
|
---|
| 251 | return false;
|
---|
| 252 | }
|
---|
| 253 | bool Type::IsWord() const{
|
---|
| 254 | if( basicType == DEF_WORD ){
|
---|
| 255 | return true;
|
---|
| 256 | }
|
---|
| 257 | return false;
|
---|
| 258 | }
|
---|
| 259 | bool Type::IsInteger() const{
|
---|
| 260 | if( basicType == DEF_INTEGER ){
|
---|
| 261 | return true;
|
---|
| 262 | }
|
---|
| 263 | return false;
|
---|
| 264 | }
|
---|
| 265 | bool Type::IsDWord() const{
|
---|
| 266 | if( basicType == DEF_DWORD ){
|
---|
| 267 | return true;
|
---|
| 268 | }
|
---|
| 269 | return false;
|
---|
| 270 | }
|
---|
| 271 | bool Type::IsLong() const{
|
---|
| 272 | if( basicType == DEF_LONG ){
|
---|
| 273 | return true;
|
---|
| 274 | }
|
---|
| 275 | return false;
|
---|
| 276 | }
|
---|
| 277 | bool Type::IsQWord() const{
|
---|
| 278 | if( basicType == DEF_QWORD ){
|
---|
| 279 | return true;
|
---|
| 280 | }
|
---|
| 281 | return false;
|
---|
| 282 | }
|
---|
| 283 | bool Type::IsInt64() const{
|
---|
| 284 | if( basicType == DEF_INT64 ){
|
---|
| 285 | return true;
|
---|
| 286 | }
|
---|
| 287 | return false;
|
---|
| 288 | }
|
---|
| 289 | bool Type::IsSingle() const{
|
---|
| 290 | if( basicType == DEF_SINGLE ){
|
---|
| 291 | return true;
|
---|
| 292 | }
|
---|
| 293 | return false;
|
---|
| 294 | }
|
---|
| 295 | bool Type::IsDouble() const{
|
---|
| 296 | if( basicType == DEF_DOUBLE ){
|
---|
| 297 | return true;
|
---|
| 298 | }
|
---|
| 299 | return false;
|
---|
| 300 | }
|
---|
| 301 | bool Type::IsBoolean() const{
|
---|
| 302 | if( basicType == DEF_BOOLEAN ){
|
---|
| 303 | return true;
|
---|
| 304 | }
|
---|
| 305 | return false;
|
---|
| 306 | }
|
---|
| 307 |
|
---|
| 308 | bool Type::IsPointer( int basicType )
|
---|
| 309 | {
|
---|
[350] | 310 | if( basicType == DEF_NON )
|
---|
| 311 | {
|
---|
| 312 | return false;
|
---|
| 313 | }
|
---|
| 314 |
|
---|
[206] | 315 | if(PTR_LEVEL( basicType )|| basicType == DEF_PTR_VOID || basicType == DEF_PTR_PROC
|
---|
| 316 | || ( basicType & FLAG_PTR ) ){
|
---|
| 317 | return true;
|
---|
| 318 | }
|
---|
| 319 |
|
---|
| 320 | return false;
|
---|
| 321 | }
|
---|
| 322 | bool Type::IsPointer() const
|
---|
| 323 | {
|
---|
| 324 | return IsPointer( basicType );
|
---|
| 325 | }
|
---|
| 326 | bool Type::IsSigned() const
|
---|
| 327 | {
|
---|
| 328 | switch( basicType ){
|
---|
| 329 | case DEF_SBYTE:
|
---|
| 330 | case DEF_INTEGER:
|
---|
| 331 | case DEF_LONG:
|
---|
| 332 | case DEF_INT64:
|
---|
| 333 | case DEF_SINGLE:
|
---|
| 334 | case DEF_DOUBLE:
|
---|
| 335 | return true;
|
---|
| 336 | default:
|
---|
| 337 | break;
|
---|
| 338 | }
|
---|
| 339 | return false;
|
---|
| 340 | }
|
---|
| 341 | bool Type::IsNaturalWhole() const
|
---|
| 342 | {
|
---|
| 343 | switch( basicType ){
|
---|
| 344 | case DEF_SBYTE:
|
---|
| 345 | case DEF_BYTE:
|
---|
| 346 | case DEF_INTEGER:
|
---|
| 347 | case DEF_WORD:
|
---|
| 348 | case DEF_LONG:
|
---|
| 349 | case DEF_DWORD:
|
---|
| 350 | case DEF_INT64:
|
---|
| 351 | case DEF_QWORD:
|
---|
| 352 | return true;
|
---|
| 353 | default:
|
---|
| 354 | break;
|
---|
| 355 | }
|
---|
| 356 | return false;
|
---|
| 357 | }
|
---|
| 358 | bool Type::IsWhole() const
|
---|
| 359 | {
|
---|
| 360 | return (
|
---|
| 361 | IsNaturalWhole()
|
---|
| 362 | || IsPointer( basicType )
|
---|
| 363 | || basicType == DEF_BOOLEAN
|
---|
| 364 | );
|
---|
| 365 | }
|
---|
| 366 | bool Type::IsReal() const
|
---|
| 367 | {
|
---|
| 368 | switch( basicType ){
|
---|
| 369 | case DEF_SINGLE:
|
---|
| 370 | case DEF_DOUBLE:
|
---|
| 371 | return true;
|
---|
| 372 | default:
|
---|
| 373 | break;
|
---|
| 374 | }
|
---|
| 375 | return false;
|
---|
| 376 | }
|
---|
| 377 | bool Type::Is64() const
|
---|
| 378 | {
|
---|
| 379 | switch( basicType ){
|
---|
| 380 | case DEF_QWORD:
|
---|
| 381 | case DEF_INT64:
|
---|
| 382 | return true;
|
---|
| 383 | default:
|
---|
| 384 | break;
|
---|
| 385 | }
|
---|
| 386 | return false;
|
---|
| 387 | }
|
---|
| 388 | bool Type::IsProcPtr() const
|
---|
| 389 | {
|
---|
| 390 | if( basicType == DEF_PTR_PROC ){
|
---|
| 391 | return true;
|
---|
| 392 | }
|
---|
| 393 | return false;
|
---|
| 394 | }
|
---|
| 395 | bool Type::IsStruct() const
|
---|
| 396 | {
|
---|
| 397 | if( basicType == DEF_STRUCT ){
|
---|
| 398 | return true;
|
---|
| 399 | }
|
---|
| 400 | return false;
|
---|
| 401 | }
|
---|
| 402 | bool Type::IsStructPtr() const
|
---|
| 403 | {
|
---|
| 404 | if( basicType == DEF_PTR_STRUCT ){
|
---|
| 405 | return true;
|
---|
| 406 | }
|
---|
| 407 | return false;
|
---|
| 408 | }
|
---|
| 409 | bool Type::IsObject() const
|
---|
| 410 | {
|
---|
[290] | 411 | return (
|
---|
| 412 | basicType == DEF_OBJECT
|
---|
[316] | 413 | || basicType == DEF_TYPE_PARAMETER
|
---|
[290] | 414 | );
|
---|
[206] | 415 | }
|
---|
| 416 | bool Type::IsObjectPtr() const
|
---|
| 417 | {
|
---|
| 418 | if( basicType == DEF_PTR_OBJECT ){
|
---|
| 419 | return true;
|
---|
| 420 | }
|
---|
| 421 | return false;
|
---|
| 422 | }
|
---|
[290] | 423 | bool Type::IsTypeParameter() const
|
---|
| 424 | {
|
---|
[292] | 425 | return ( NATURAL_TYPE(basicType) == DEF_TYPE_PARAMETER );
|
---|
[290] | 426 | }
|
---|
[206] | 427 | bool Type::IsObjectClass() const
|
---|
| 428 | {
|
---|
| 429 | if( basicType == DEF_OBJECT ){
|
---|
| 430 | if( pClass->GetName() == "Object" ){
|
---|
| 431 | return true;
|
---|
| 432 | }
|
---|
| 433 | }
|
---|
| 434 | return false;
|
---|
| 435 | }
|
---|
| 436 | bool Type::IsStringClass() const
|
---|
| 437 | {
|
---|
| 438 | if( basicType == DEF_OBJECT ){
|
---|
| 439 | if( pClass->GetName() == "String" ){
|
---|
| 440 | return true;
|
---|
| 441 | }
|
---|
| 442 | }
|
---|
| 443 | return false;
|
---|
| 444 | }
|
---|
| 445 | bool Type::IsVoidPtr() const
|
---|
| 446 | {
|
---|
| 447 | if( basicType == DEF_PTR_VOID ){
|
---|
| 448 | return true;
|
---|
| 449 | }
|
---|
| 450 | return false;
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | bool Type::IsAny() const
|
---|
| 454 | {
|
---|
| 455 | if( basicType == DEF_ANY ){
|
---|
| 456 | return true;
|
---|
| 457 | }
|
---|
| 458 | return false;
|
---|
| 459 | }
|
---|
| 460 |
|
---|
[332] | 461 | bool Type::IsDelegate() const
|
---|
| 462 | {
|
---|
| 463 | return ( IsObject() && GetClass().IsDelegate() );
|
---|
| 464 | }
|
---|
[350] | 465 | bool Type::IsInterface() const
|
---|
| 466 | {
|
---|
| 467 | return ( IsObject() && GetClass().IsInterface() );
|
---|
| 468 | }
|
---|
[370] | 469 | bool Type::IsComInterface() const
|
---|
| 470 | {
|
---|
| 471 | return ( IsObject() && GetClass().IsComInterface() );
|
---|
| 472 | }
|
---|
[332] | 473 |
|
---|
[350] | 474 |
|
---|
[206] | 475 | bool Type::HasMember() const
|
---|
| 476 | {
|
---|
| 477 | if( NATURAL_TYPE( basicType ) == DEF_OBJECT
|
---|
[290] | 478 | || NATURAL_TYPE( basicType ) == DEF_STRUCT
|
---|
| 479 | || NATURAL_TYPE( basicType ) == DEF_TYPE_PARAMETER
|
---|
| 480 | ){
|
---|
| 481 | return true;
|
---|
[206] | 482 | }
|
---|
| 483 | return false;
|
---|
| 484 | }
|
---|
| 485 |
|
---|
[301] | 486 | const Type &Type::GetActualGenericType( int index ) const
|
---|
[290] | 487 | {
|
---|
[301] | 488 | return actualGenericTypes[index].GetType();
|
---|
[290] | 489 | }
|
---|
| 490 | bool Type::HasActualGenericType() const
|
---|
| 491 | {
|
---|
| 492 | return ( actualGenericTypes.size() > 0 );
|
---|
| 493 | }
|
---|
| 494 |
|
---|
[378] | 495 | std::string Type::ToString() const
|
---|
| 496 | {
|
---|
| 497 | const char *basicTypeName = BasicTypeToCharPtr( *this );
|
---|
| 498 | if( basicTypeName )
|
---|
| 499 | {
|
---|
| 500 | return basicTypeName;
|
---|
| 501 | }
|
---|
| 502 |
|
---|
| 503 | if( IsTypeParameter() )
|
---|
| 504 | {
|
---|
| 505 | return GetFormalTypeName();
|
---|
| 506 | }
|
---|
| 507 |
|
---|
| 508 | std::string typeName = GetClass().GetFullName();
|
---|
| 509 | if( HasActualGenericType() )
|
---|
| 510 | {
|
---|
| 511 | std::string actualGenericTypesName;
|
---|
| 512 | BOOST_FOREACH( const GenericType &actualGenericType, actualGenericTypes )
|
---|
| 513 | {
|
---|
| 514 | if( actualGenericTypesName.size() )
|
---|
| 515 | {
|
---|
| 516 | actualGenericTypesName += ",";
|
---|
| 517 | }
|
---|
| 518 | actualGenericTypesName += actualGenericType.GetName();
|
---|
| 519 | }
|
---|
| 520 |
|
---|
| 521 | typeName += "<" + actualGenericTypesName + ">";
|
---|
| 522 | }
|
---|
| 523 | return typeName;
|
---|
| 524 | }
|
---|
| 525 |
|
---|
[206] | 526 | int Type::GetBasicTypeFromSimpleName( const char *variable ){
|
---|
| 527 | extern char DefIntVari[26],DefSngVari[26],DefStrVari[26],divNum,dsvNum,dStrvNum;
|
---|
| 528 | int i;
|
---|
| 529 | char name[VN_SIZE];
|
---|
| 530 |
|
---|
| 531 | //構造体メンバの場合を考慮
|
---|
| 532 | for(i=lstrlen(variable);i>0;i--){
|
---|
| 533 | if(variable[i]=='.'){
|
---|
| 534 | i++;
|
---|
| 535 | break;
|
---|
| 536 | }
|
---|
| 537 | }
|
---|
| 538 |
|
---|
| 539 | for(;;i++){
|
---|
| 540 | if(variable[i]=='('||variable[i]=='\0'){
|
---|
| 541 | name[i]=0;
|
---|
| 542 | break;
|
---|
| 543 | }
|
---|
| 544 | name[i]=variable[i];
|
---|
| 545 | }
|
---|
| 546 | //変数名から選択
|
---|
| 547 | i--;
|
---|
| 548 | if(name[i]=='#') return DEF_DOUBLE;
|
---|
| 549 | if(name[i]=='!') return DEF_SINGLE;
|
---|
| 550 | if(name[i]=='%') return DEF_INTEGER;
|
---|
| 551 | return DEF_DOUBLE;
|
---|
| 552 | }
|
---|
| 553 |
|
---|
| 554 |
|
---|
[299] | 555 | void ResolveFormalGenericTypeParameter( Type &typeParameter, const Type &classType, const UserProc *pUserProc )
|
---|
| 556 | {
|
---|
[424] | 557 | if( !typeParameter.IsTypeParameter() )
|
---|
| 558 | {
|
---|
| 559 | // ジェネリックな型ではなかったとき
|
---|
| 560 | return;
|
---|
| 561 | }
|
---|
| 562 |
|
---|
[299] | 563 | /////////////////////////////////////////////////////////
|
---|
| 564 | // ☆★☆ ジェネリクスサポート ☆★☆
|
---|
| 565 |
|
---|
[424] | 566 | // ポインタレベルを抽出
|
---|
| 567 | int ptrLevel = PTR_LEVEL( typeParameter.GetBasicType() );
|
---|
| 568 |
|
---|
| 569 | if( pUserProc )
|
---|
[299] | 570 | {
|
---|
[424] | 571 | if( classType.IsObject() )
|
---|
[299] | 572 | {
|
---|
[424] | 573 | // 基底クラスでの自己解決
|
---|
| 574 | const CClass *pClass = &classType.GetClass();
|
---|
| 575 | while( pClass->HasSuperClass() )
|
---|
[299] | 576 | {
|
---|
[424] | 577 | if( pUserProc->GetParentClassPtr() == &pClass->GetSuperClass() )
|
---|
[299] | 578 | {
|
---|
[424] | 579 | if( pClass->GetSuperClassActualTypeParameters().size() )
|
---|
[299] | 580 | {
|
---|
[424] | 581 | // TODO: 適切な形に実装し直す(暫定的にトップの型を持ってきている)
|
---|
| 582 | typeParameter = pClass->GetSuperClassActualTypeParameters()[0];
|
---|
[299] | 583 | }
|
---|
| 584 | }
|
---|
[424] | 585 | pClass = &pClass->GetSuperClass();
|
---|
[299] | 586 | }
|
---|
| 587 | }
|
---|
[424] | 588 | }
|
---|
[299] | 589 |
|
---|
[424] | 590 | if( typeParameter.IsTypeParameter() )
|
---|
| 591 | {
|
---|
| 592 | if( classType.HasActualGenericType() )
|
---|
[299] | 593 | {
|
---|
[424] | 594 | typeParameter = classType.GetActualGenericType( typeParameter.GetFormalTypeIndex() );
|
---|
[299] | 595 | }
|
---|
[424] | 596 | else
|
---|
[299] | 597 | {
|
---|
[424] | 598 | // 制約クラス(指定されていないときはObjectクラス)にセットする
|
---|
| 599 | typeParameter.SetBasicType( DEF_OBJECT );
|
---|
[299] | 600 | }
|
---|
| 601 | }
|
---|
| 602 |
|
---|
[424] | 603 | for( int i=0; i<ptrLevel; i++ )
|
---|
| 604 | {
|
---|
| 605 | typeParameter.PtrLevelUp();
|
---|
| 606 | }
|
---|
| 607 |
|
---|
[299] | 608 | //
|
---|
| 609 | /////////////////////////////////////////////////////////
|
---|
| 610 | }
|
---|
| 611 |
|
---|
| 612 |
|
---|
[523] | 613 | const std::string BlittableType::GetCreateStaticMethodFullName() const
|
---|
[206] | 614 | {
|
---|
| 615 | return pClass->GetNamespaceScopes().ToString() + "." + pClass->GetName() + "._Create";
|
---|
| 616 | }
|
---|