Changeset 632 in dev for trunk/ab5.0/abdev/ab_common/src
- Timestamp:
- Jun 5, 2008, 10:04:39 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev/ab_common/src/Lexical
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
r603 r632 1 1 #include "stdafx.h" 2 3 4 CClass::CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name ) 5 : ClassPrototype( namespaceScopes, name ) 6 , importedNamespaces( importedNamespaces ) 7 , classType( Class ) 8 , pSuperClass( NULL ) 9 , blittableType( Type() ) 10 , isReady( false ) 11 , fixedAlignment( 0 ) 12 , ConstructorMemberSubIndex( -1 ) 13 , DestructorMemberSubIndex( -1 ) 14 , vtblNum( 0 ) 15 , vtbl_offset( -1 ) 16 , comVtblOffset( 0 ) 17 , isCompilingConstructor( false ) 18 , isCompilingDestructor( false ) 19 , cacheSize( 0 ) 20 { 21 } 22 23 CClass::CClass( const NamespaceScopes &namespaceScopes, 24 const NamespaceScopesCollection &importedNamespaces, 25 const std::string &name, 26 ClassType classType, 27 const GenericTypes &formalGenericTypes, 28 const Types &superClassActualTypeParameters, 29 int ConstructorMemberSubIndex, 30 int DestructorMemberSubIndex, 31 int vtblNum, 32 int fixedAlignment ) 33 : ClassPrototype( namespaceScopes, name ) 34 , importedNamespaces( importedNamespaces ) 35 , classType( classType ) 36 , formalGenericTypes( formalGenericTypes ) 37 , pSuperClass( NULL ) 38 , superClassActualTypeParameters( superClassActualTypeParameters ) 39 , blittableType( Type() ) 40 , isReady( false ) 41 , ConstructorMemberSubIndex( ConstructorMemberSubIndex ) 42 , DestructorMemberSubIndex( DestructorMemberSubIndex ) 43 , vtblNum( vtblNum ) 44 , fixedAlignment( fixedAlignment ) 45 , vtbl_offset( -1 ) 46 , comVtblOffset( 0 ) 47 , isCompilingConstructor( false ) 48 , isCompilingDestructor( false ) 49 , cacheSize( 0 ) 50 { 51 } 52 53 CClass::CClass() 54 : ClassPrototype() 55 , importedNamespaces() 56 , classType() 57 , pSuperClass( NULL ) 58 , blittableType( Type() ) 59 , isReady( false ) 60 , fixedAlignment( 0 ) 61 , ConstructorMemberSubIndex( -1 ) 62 , DestructorMemberSubIndex( -1 ) 63 , vtblNum( 0 ) 64 , vtbl_offset( -1 ) 65 , comVtblOffset( 0 ) 66 , isCompilingConstructor( false ) 67 , isCompilingDestructor( false ) 68 , cacheSize( 0 ) 69 { 70 } 71 72 CClass::~CClass() 73 { 74 // 動的メンバ 75 BOOST_FOREACH( Member *member, dynamicMembers ) 76 { 77 delete member; 78 } 79 80 // 静的メンバ 81 BOOST_FOREACH( Member *member, staticMembers ) 82 { 83 delete member; 84 } 85 86 // インターフェイス 87 BOOST_FOREACH( ::Interface *pInterface, interfaces ) 88 { 89 delete pInterface; 90 } 91 92 // テンプレート展開済みのクラス 93 BOOST_FOREACH( ExpandedTemplateClass *pExpandedTemplateClass, expandedTemplateClasses ) 94 { 95 delete pExpandedTemplateClass; 96 } 97 } 2 98 3 99 void CClass::Using() const -
trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp
r603 r632 186 186 187 187 // TypeDefも見る 188 int index = this->GetTypeDefs().GetIndex( symbol ); 189 if( index != -1 ){ 190 Type type = this->GetTypeDefs()[index].GetBaseType(); 191 if( type.IsObject() ){ 188 const TypeDef *pTypeDef = this->GetTypeDefs().Find( symbol ); 189 if( pTypeDef ) 190 { 191 Type type = pTypeDef->GetBaseType(); 192 if( type.IsObject() ) 193 { 192 194 return &type.GetClass(); 193 195 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Parameter.cpp
r603 r632 1 1 #include "stdafx.h" 2 3 Parameter::Parameter( const std::string &varName, const Type &type, bool isRef, const std::string initValue ) 4 : Type( type ) 5 , varName( varName ) 6 , isRef( isRef ) 7 , isArray( false ) 8 , initValue( initValue ) 9 { 10 } 11 12 Parameter::Parameter( const Parameter ¶m, const Type &type ) 13 : Type( type ) 14 , varName( param.varName ) 15 , isRef( param.isRef ) 16 , isArray( param.isArray ) 17 , subscripts( param.subscripts ) 18 , initValue( param.initValue ) 19 { 20 } 21 22 Parameter::Parameter( const Parameter ¶m ) 23 : Type( param ) 24 , varName( param.varName ) 25 , isRef( param.isRef ) 26 , isArray( param.isArray ) 27 , subscripts( param.subscripts ) 28 , initValue( param.initValue ) 29 { 30 } 31 32 Parameter::Parameter() 33 { 34 } 35 36 Parameter::~Parameter() 37 { 38 } 2 39 3 40 bool Parameter::Equals( const Parameter ¶m, bool isContravariant ) const -
trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp
r603 r632 1 1 #include "stdafx.h" 2 3 int id_base = 0; 4 5 UserProc::UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport ) 6 : Procedure( namespaceScopes, name, kind, isCdecl ) 7 , importedNamespaces( importedNamespaces ) 8 , pParentClass( NULL ) 9 , pInterface( NULL ) 10 , pMethod( NULL ) 11 , isMacro( isMacro ) 12 , secondParmNum( 0 ) 13 , realSecondParmNum( 1 ) 14 , isExport( isExport ) 15 , isSystem( false ) 16 , isAutoGeneration( false ) 17 , isCompiled( false ) 18 , beginOpAddress( 0 ) 19 , endOpAddress( 0 ) 20 , id( id_base ++ ) 21 { 22 } 23 24 UserProc::UserProc( const UserProc &userProc, const CClass *pParentClass ) 25 : Procedure( userProc ) 26 , _paramStr( userProc._paramStr ) 27 , importedNamespaces( userProc.importedNamespaces ) 28 , pParentClass( pParentClass ) 29 , pInterface( NULL ) 30 , pMethod( NULL ) 31 , isMacro( userProc.isMacro ) 32 , secondParmNum( userProc.secondParmNum ) 33 , realParams( userProc.realParams ) 34 , realSecondParmNum( userProc.realSecondParmNum ) 35 , isExport( userProc.isExport ) 36 , isSystem( userProc.isSystem ) 37 , isAutoGeneration( userProc.isAutoGeneration ) 38 , isCompiled( false ) 39 , beginOpAddress( 0 ) 40 , endOpAddress( 0 ) 41 , localVars( Variables() ) 42 , id( id_base ++ ) 43 , nativeCode( NativeCode() ) 44 { 45 } 46 47 UserProc::UserProc() 48 { 49 } 50 51 UserProc::~UserProc() 52 { 53 BOOST_FOREACH( Parameter *pParam, realParams ){ 54 delete pParam; 55 } 56 } 2 57 3 58 bool UserProc::IsEqualForOverride( const Types &actualTypeParametersForThisProc, const UserProc *pUserProc ) const … … 54 109 const NamespaceScopes &UserProc::GetNamespaceScopes() const 55 110 { 56 if( HasParentClass() ){ 111 if( HasParentClass() ) 112 { 57 113 return GetParentClassPtr()->GetNamespaceScopes(); 58 114 } -
trunk/ab5.0/abdev/ab_common/src/Lexical/Symbol.cpp
r603 r632 5 5 const NamespaceSupporter *Symbol::namespaceSupporter = NULL; 6 6 7 char *calcNames[25 5] = {7 char *calcNames[256] = { 8 8 "xor", 9 9 }; -
trunk/ab5.0/abdev/ab_common/src/Lexical/Type.cpp
r603 r632 384 384 return false; 385 385 } 386 387 bool Type::IsValueType() const 388 { 389 return ( IsWhole() || IsReal() ); 390 } 391 386 392 bool Type::IsProcPtr() const 387 393 { … … 550 556 } 551 557 558 bool Types::IsEquals( const Types &types ) const 559 { 560 if( this->size() != types.size() ) 561 { 562 // アイテム数が違う 563 return false; 564 } 565 566 const Types &thisTypes = *this; 567 for( int i=0; i<static_cast<int>(this->size()); i++ ) 568 { 569 if( !thisTypes[i].Equals( types[i] ) ) 570 { 571 return false; 572 } 573 } 574 575 return true; 576 } 552 577 553 578 void ResolveFormalGenericTypeParameter( Type &typeParameter, const Type &classType, const UserProc *pUserProc ) -
trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp
r603 r632 17 17 } 18 18 19 int TypeDefCollection::GetIndex( const Symbol &symbol ) const{ 20 int max = (int)(*this).size(); 21 for( int i=0; i<max; i++ ){ 22 if( (*this)[i].IsEqualSymbol( symbol ) ){ 23 return i; 19 const TypeDef *TypeDefCollection::Find( const Symbol &symbol ) const 20 { 21 const TypeDefCollection &typeDefs = *this; 22 BOOST_FOREACH( const TypeDef &typeDef, typeDefs ) 23 { 24 if( typeDef.IsEqualSymbol( symbol ) ) 25 { 26 return &typeDef; 24 27 } 25 28 } 26 return -1;29 return NULL; 27 30 }
Note:
See TracChangeset
for help on using the changeset viewer.