Changeset 290 in dev for trunk/abdev/BasicCompiler_Common/VariableOpe.cpp
- Timestamp:
- Aug 21, 2007, 11:00:25 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/VariableOpe.cpp
r288 r290 124 124 return type; 125 125 } 126 int GetTypeSize(int type,LONG_PTR lpIndex){127 if(type==DEF_LONG){128 if(lpIndex==LITERAL_NULL||lpIndex==LITERAL_M128_0||lpIndex==LITERAL_0_255)129 return sizeof(BYTE);130 else if(lpIndex==LITERAL_M32768_0||lpIndex==LITERAL_0_65535)131 return sizeof(WORD);132 133 return sizeof(DWORD);134 }135 136 //整数型137 if(type==DEF_INT64||type==DEF_QWORD)138 return sizeof(_int64);139 else if(type==DEF_LONG||type==DEF_DWORD)140 return sizeof(DWORD);141 else if(type==DEF_INTEGER||type==DEF_WORD)142 return sizeof(WORD);143 else if(type==DEF_SBYTE||type==DEF_BYTE || type == DEF_BOOLEAN)144 return sizeof(BYTE);145 146 //実数型147 else if(type==DEF_DOUBLE) return sizeof(double);148 else if(type==DEF_SINGLE) return sizeof(float);149 150 //文字型151 else if( type == DEF_CHAR ){152 if( Smoothie::IsUnicode() ) return sizeof( WORD );153 return sizeof( BYTE );154 }155 156 //ポインタ型157 else if(IsPtrType(type)) return PTR_SIZE;158 159 else if( type == DEF_STRUCT ){160 if(lpIndex == 0 || lpIndex == -1){161 SetError(300,NULL,cp);162 return 0;163 }164 165 const CClass *pobj_c=(CClass *)lpIndex;166 167 return pobj_c->GetSize();168 }169 170 else if(type==DEF_OBJECT){171 return PTR_SIZE;172 }173 else{174 SetError(300,NULL,cp);175 }176 return 0;177 }178 126 int GetPtrType(int type){ 179 127 return MAKE_PTR_TYPE(NATURAL_TYPE(type),PTR_LEVEL(type)+1); … … 475 423 476 424 477 bool GetMemberType( const CClass &objClass, const char *lpszMember, Type &resultType, BOOL bPrivateAccess, bool isErrorEnabled){ 425 bool GetMemberType( const Type &classType, const char *lpszMember, Type &resultType, BOOL bPrivateAccess, bool isErrorEnabled) 426 { 427 const CClass &objClass = classType.GetClass(); 428 478 429 extern int cp; 479 430 … … 522 473 resultType = pMember->GetType(); 523 474 475 476 ///////////////////////////////////////////////////////// 477 // ☆★☆ ジェネリクスサポート ☆★☆ 478 479 if( resultType.IsTypeParameter() ) 480 { 481 // 型パラメータだったとき 482 if( classType.HasActualGenericType() ) 483 { 484 // TODO: GetDummyActualGenericTypeを適切な形に実装し直す 485 resultType = classType.GetDummyActualGenericType(); 486 } 487 else 488 { 489 // TODO: ベースオブジェクト(指定されていないときはObjectクラス)にセットする 490 resultType.SetBasicType( DEF_OBJECT ); 491 } 492 } 493 494 // 495 ///////////////////////////////////////////////////////// 496 497 524 498 //ポインタ変数の場合 525 499 if( resultType.IsPointer() ){ … … 539 513 //入れ子構造の場合 540 514 541 return GetMemberType( pMember->GetType() .GetClass(),515 return GetMemberType( pMember->GetType(), 542 516 NestMember, 543 517 resultType, … … 633 607 } 634 608 635 return GetMemberType(*compiler.pCompilingClass,variable,resultType,1,isErrorEnabled); 609 return GetMemberType( 610 Type( DEF_OBJECT, *compiler.pCompilingClass ), 611 variable, 612 resultType, 613 1, 614 isErrorEnabled 615 ); 636 616 } 637 617 … … 729 709 if(member[0]){ 730 710 if( NATURAL_TYPE( resultType.GetBasicType() )==DEF_OBJECT 731 || NATURAL_TYPE( resultType.GetBasicType() )==DEF_STRUCT){ 732 return GetMemberType(resultType.GetClass(),member,resultType,0,isErrorEnabled); 711 || NATURAL_TYPE( resultType.GetBasicType() )==DEF_STRUCT) 712 { 713 return GetMemberType(resultType,member,resultType,0,isErrorEnabled); 733 714 } 734 715 } … … 753 734 } 754 735 755 bool GetVarOffsetReadOnly(const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts ){ 736 bool GetVarOffsetReadOnly(const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts ) 737 { 756 738 //読み取り専用で変数へアクセス 757 739 return GetVarOffset( … … 764 746 ); 765 747 } 766 bool GetVarOffsetReadWrite(const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts ){ 748 bool GetVarOffsetReadWrite(const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts ) 749 { 767 750 //読み書き両用で変数へアクセス 768 751 return GetVarOffset(
Note:
See TracChangeset
for help on using the changeset viewer.