Changeset 114 in dev for BasicCompiler_Common/Class.cpp
- Timestamp:
- May 10, 2007, 8:52:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/Class.cpp
r108 r114 9 9 CDBClass *pobj_DBClass; 10 10 11 CClass *pobj_CompilingClass;12 CClass *pobj_StringClass;11 const CClass *pobj_CompilingClass; 12 const CClass *pobj_StringClass; 13 13 14 14 CMember *pCompilingMethod; … … 224 224 return isUsing; 225 225 } 226 void CClass::Using(){ 226 void CClass::Using() const 227 { 227 228 isUsing = true; 228 229 } … … 249 250 } 250 251 251 bool CClass::Inherits( CClass &inheritsClass, int nowLine ){252 bool CClass::Inherits( const CClass &inheritsClass, int nowLine ){ 252 253 253 254 //ループ継承でないかをチェック … … 309 310 return true; 310 311 } 311 bool CClass::InheritsInterface( CClass &inheritsInterface, int nowLine ){312 bool CClass::InheritsInterface( const CClass &inheritsInterface, int nowLine ){ 312 313 313 314 //ループ継承でないかをチェック … … 615 616 return n; 616 617 } 617 LONG_PTR CClass::GetVtblGlobalOffset(void){ 618 LONG_PTR CClass::GetVtblGlobalOffset(void) const 619 { 618 620 619 621 //既に存在する場合はそれを返す … … 688 690 689 691 // コンストラクタのコンパイルを開始 690 void CClass::NotifyStartConstructorCompile(){ 692 void CClass::NotifyStartConstructorCompile() const 693 { 691 694 isCompilingConstructor = true; 692 695 } 693 696 694 697 //コンストラクタのコンパイルを終了 695 void CClass::NotifyFinishConstructorCompile(){ 698 void CClass::NotifyFinishConstructorCompile() const 699 { 696 700 isCompilingConstructor = false; 697 701 } … … 704 708 705 709 //デストラクタのコンパイルを開始 706 void CClass::NotifyStartDestructorCompile() {710 void CClass::NotifyStartDestructorCompile() const{ 707 711 isCompilingDestructor = true; 708 712 } 709 713 710 714 //デストラクタのコンパイルを終了 711 void CClass::NotifyFinishDestructorCompile() {715 void CClass::NotifyFinishDestructorCompile() const{ 712 716 isCompilingDestructor = false; 713 717 } … … 810 814 } 811 815 812 CClass *CDBClass::Find( const string &fullName ) const 813 { 814 char AreaName[VN_SIZE] = ""; //オブジェクト変数 815 char NestName[VN_SIZE] = ""; //入れ子メンバ 816 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName ); 817 818 int key; 819 key=hash(NestName); 820 821 if(pobj_ClassHash[key]){ 822 CClass *pobj_c; 823 pobj_c=pobj_ClassHash[key]; 824 while(1){ 825 if( pobj_c->IsEqualSymbol( fullName ) ){ 826 //名前空間とクラス名が一致した 827 return pobj_c; 828 } 829 830 if(pobj_c->pobj_NextClass==0) break; 831 pobj_c=pobj_c->pobj_NextClass; 832 } 833 } 834 return NULL; 835 } 836 CClass *CDBClass::Find( const NamespaceScopes &namespaceScopes, const string &name ) const 816 const CClass *CDBClass::Find( const NamespaceScopes &namespaceScopes, const string &name ) const 837 817 { 838 818 int key; … … 852 832 } 853 833 } 834 835 // TypeDefも見る 836 int index = Smoothie::Meta::typeDefs.GetIndex( namespaceScopes, name ); 837 if( index != -1 ){ 838 Type type = Smoothie::Meta::typeDefs[index].GetBaseType(); 839 if( type.IsObject() ){ 840 return &type.GetClass(); 841 } 842 } 843 854 844 return NULL; 845 } 846 const CClass *CDBClass::Find( const string &fullName ) const 847 { 848 char AreaName[VN_SIZE] = ""; //オブジェクト変数 849 char NestName[VN_SIZE] = ""; //入れ子メンバ 850 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName ); 851 852 return Find( NamespaceScopes( AreaName ), NestName ); 855 853 } 856 854 … … 1213 1211 GetIdentifierToken( temporary, basbuf, i ); 1214 1212 1215 CClass *pobj_c =pobj_DBClass->Find(namespaceScopes, temporary);1213 CClass *pobj_c = const_cast<CClass *>( pobj_DBClass->Find(namespaceScopes, temporary) ); 1216 1214 if(!pobj_c) continue; 1217 1215 … … 1251 1249 1252 1250 //継承元クラスを取得 1253 CClass *pInheritsClass = Find(temporary);1251 const CClass *pInheritsClass = Find(temporary); 1254 1252 if( !pInheritsClass ){ 1255 1253 SetError(106,temporary,i); … … 1359 1357 GetIdentifierToken( temporary, basbuf, i ); 1360 1358 1361 CClass *pobj_c =pobj_DBClass->Find(namespaceScopes, temporary);1359 CClass *pobj_c = const_cast<CClass *>( pobj_DBClass->Find(namespaceScopes, temporary) ); 1362 1360 if(!pobj_c) continue; 1363 1361 … … 1416 1414 1417 1415 //継承元クラスを取得 1418 CClass *pInheritsClass = Find(temporary);1416 const CClass *pInheritsClass = Find(temporary); 1419 1417 if( !pInheritsClass ){ 1420 1418 SetError(106,temporary,i); … … 1424 1422 if( pInheritsClass->IsInterface() ){ 1425 1423 // クラスを継承していないとき 1426 CClass *pObjectClass = Find("Object");1424 const CClass *pObjectClass = Find("Object"); 1427 1425 if( !pObjectClass ){ 1428 1426 SetError(106,"Object",i); … … 1806 1804 } 1807 1805 } 1808 CClass *CDBClass::GetNowCompilingClass(){ 1806 const CClass *CDBClass::GetNowCompilingClass() const 1807 { 1809 1808 return pCompilingClass; 1810 1809 }
Note:
See TracChangeset
for help on using the changeset viewer.