Changeset 640 in dev for trunk/ab5.0/abdev/ab_common


Ignore:
Timestamp:
Jun 14, 2008, 12:16:27 PM (16 years ago)
Author:
dai_9181
Message:

静的リンクリンカの依存関係解決モジュールを製作中

Location:
trunk/ab5.0/abdev/ab_common
Files:
1 added
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/ab_common/ab_common.vcproj

    r637 r640  
    534534                </File>
    535535                <File
     536                    RelativePath=".\include\Lexical\Resolver.h"
     537                    >
     538                </File>
     539                <File
    536540                    RelativePath=".\include\Lexical\Source.h"
    537541                    >
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Class.h

    r639 r640  
    147147        return false;
    148148    }
     149    bool Equals( const CClass *pClass ) const
     150    {
     151        // ポインタが等しいかどうかを見てみる
     152        if( this == pClass )
     153        {
     154            return true;
     155        }
     156        else if( this->IsNeedResolve() || pClass->IsNeedResolve() )
     157        {
     158            // 依存関係解決前の状態であれば、パスが等しいかどうかを見てみる
     159            if( this->IsDuplication( pClass ) )
     160            {
     161                return true;
     162            }
     163        }
     164        return false;
     165    }
    149166
    150167    virtual void Using() const;
     
    466483    void GetReferenceOffsetsInitializeBuffer( std::string &referenceOffsetsBuffer, int &numOfReference, int baseOffset = 0 ) const;
    467484
    468     virtual bool Resolve( const ObjectModule &resolver );
     485    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    469486};
    470487
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Const.h

    r639 r640  
    11#pragma once
    22
    3 //定数
     3//萔
    44class CConst
    55    : public RelationalObjectModuleItem
     
    99    _int64 i64data;
    1010
    11     // XMLシリアライズ用
     11    // XMLVACYp
    1212private:
    1313    friend class boost::serialization::access;
     
    6666    double GetDoubleData();
    6767
    68     virtual bool Resolve( const ObjectModule &resolver );
     68    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    6969};
    7070class Consts : public Jenga::Common::Hashmap<CConst>
    7171{
    72     // XMLシリアライズ用
     72    // XMLVACYp
    7373private:
    7474    friend class boost::serialization::access;
     
    9696};
    9797
    98 //定数マクロ
     98//萔}N
    9999class ConstMacro
    100100    : public RelationalObjectModuleItem
     
    104104    std::string expression;
    105105
    106     // XMLシリアライズ用
     106    // XMLVACYp
    107107private:
    108108    friend class boost::serialization::access;
     
    154154    }
    155155
    156     virtual bool Resolve( const ObjectModule &resolver );
     156    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    157157};
    158158class ConstMacros
    159159    : public Jenga::Common::Hashmap<ConstMacro>
    160160{
    161     // XMLシリアライズ用
     161    // XMLVACYp
    162162private:
    163163    friend class boost::serialization::access;
  • trunk/ab5.0/abdev/ab_common/include/Lexical/DataTable.h

    r639 r640  
    150150    void ResetDataSectionBaseOffset( long dataSectionBaseOffset );
    151151
    152     void Resolve( const ObjectModule &resolver );
     152    void Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    153153};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Delegate.h

    r639 r640  
    3333
    3434        ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
     35        ar & BOOST_SERIALIZATION_NVP( paramStr );
     36        ar & BOOST_SERIALIZATION_NVP( returnTypeName );
     37        ar & BOOST_SERIALIZATION_NVP( sourceIndex );
    3538        ar & BOOST_SERIALIZATION_NVP( dynamicParams );
    3639    }
     
    9295    bool IsSimilar( const Delegate &dgt ) const;
    9396
    94     virtual bool Resolve( const ObjectModule &resolver );
     97    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    9598};
    9699typedef Jenga::Common::Hashmap<Delegate> Delegates;
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Interface.h

    r639 r640  
    9090    }
    9191
     92    bool Equals( const Interface *pInterface ) const;
     93
    9294    std::string GetFullNameWithActualGenericTypeParameters() const;
    9395
    94     virtual bool Resolve( const ObjectModule &resolver );
     96    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    9597};
    9698typedef std::vector<Interface *> Interfaces;
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Member.h

    r639 r640  
    7777    }
    7878
    79     virtual bool Resolve( const ObjectModule &resolver );
     79    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    8080};
    8181typedef std::vector<Member *> Members;
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Meta.h

    r639 r640  
    162162    const CClass *FindClassSupportedTypeDef( const Symbol &symbol );
    163163
    164     void Resolve( const ObjectModule &resolver );
     164    void Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    165165};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Method.h

    r639 r640  
    4949    virtual void SetNotUseMark( bool isNotUse ) = 0;
    5050
    51     virtual bool Resolve( const ObjectModule &resolver );
     51    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    5252};
    5353
     
    159159    }
    160160
    161     virtual bool Resolve( const ObjectModule &resolver );
     161    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    162162};
    163163BOOST_CLASS_EXPORT( DynamicMethod );
     
    235235    }
    236236
    237     virtual bool Resolve( const ObjectModule &resolver );
     237    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    238238};
    239239BOOST_CLASS_EXPORT( StaticMethod );
  • trunk/ab5.0/abdev/ab_common/include/Lexical/NativeCode.h

    r639 r640  
    117117    const ::CClass &GetClass() const;
    118118
    119     virtual bool Resolve( const ObjectModule &resolver );
     119    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    120120};
    121121typedef std::vector<Schedule> Schedules;
     
    249249    void ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable );
    250250
    251     void Resolve( const ObjectModule &resolver );
     251    void Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    252252};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/ObjectModule.h

    r637 r640  
    6565
    6666    // 依存関係の解決を行う
    67     void Resolve();
     67    void Resolve( ResolveErrors &resolveErrors );
    6868
    6969    // 下記の関連になるようなテーブルを取得する
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h

    r639 r640  
    111111    }
    112112
    113     virtual bool Resolve( const ObjectModule &resolver );
     113    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    114114};
    115115
     
    161161        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure );
    162162        ar & boost::serialization::make_nvp("pParentClass", const_cast<CClass *&>(pParentClass) );
     163        ar & boost::serialization::make_nvp("pInterface", const_cast<Interface *&>(pInterface) );
    163164
    164165        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     
    173174        ar & BOOST_SERIALIZATION_NVP( _paramStr );
    174175        ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
    175         ar & boost::serialization::make_nvp("pInterface", const_cast<Interface *&>(pInterface) );
    176176        ar & BOOST_SERIALIZATION_NVP( pMethod );
    177177        ar & BOOST_SERIALIZATION_NVP( isMacro );
     
    209209    virtual bool IsDuplication( const UserProc *pUserProc ) const
    210210    {
    211         if( this->GetParentClassPtr() == pUserProc->GetParentClassPtr() // 親クラスが等しい
    212             && this->pInterface == pUserProc->pInterface                // インターフェイスが等しい
    213             && pUserProc->IsEqualSymbol( *this )                        // 名前空間及び名前が等しい
    214             && this->Params().Equals( pUserProc->Params() )             // パラメータが等しい
    215             && this->returnType.Equals( pUserProc->returnType ) )       // 戻り値が等しい
     211        bool isEqualParentClass =
     212            this->HasParentClass() && pUserProc->HasParentClass()
     213            ? this->GetParentClassPtr()->Equals( pUserProc->GetParentClassPtr() )
     214            : this->GetParentClassPtr() == pUserProc->GetParentClassPtr();
     215        bool isEqualInterface =
     216            this->pInterface && pUserProc->pInterface
     217            ? this->pInterface->Equals( pUserProc->pInterface )
     218            : this->pInterface == pUserProc->pInterface;
     219
     220        if( isEqualParentClass                                      // 親クラスが等しい
     221            && isEqualInterface                                     // インターフェイスが等しい
     222            && pUserProc->IsEqualSymbol( *this )                    // 名前空間及び名前が等しい
     223            && this->Params().Equals( pUserProc->Params() )         // パラメータが等しい
     224            && this->returnType.Equals( pUserProc->returnType ) )   // 戻り値が等しい
    216225        {
    217226            return true;
     
    376385    const CMethod &GetMethod() const;
    377386
    378     virtual bool Resolve( const ObjectModule &resolver );
     387    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    379388
    380389    static const UserProc *pGlobalProc;
     
    484493    }
    485494
    486     virtual bool Resolve( const ObjectModule &resolver );
     495    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    487496};
    488497class DllProcs : public Jenga::Common::Hashmap<DllProc>
     
    525534    }
    526535
    527     virtual bool Resolve( const ObjectModule &resolver );
     536    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    528537};
    529538
  • trunk/ab5.0/abdev/ab_common/include/Lexical/RelationalObjectModuleItem.h

    r639 r640  
    6868    }
    6969
    70     virtual bool Resolve( const ObjectModule &resolver ) = 0;
     70    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors ) = 0;
    7171};
    7272
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Template.h

    r639 r640  
    4747    }
    4848
    49     virtual bool Resolve( const ObjectModule &resolver );
     49    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    5050};
    5151
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Type.h

    r639 r640  
    230230    std::string ToString() const;
    231231
    232     virtual bool Resolve( const ObjectModule &resolver );
     232    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    233233
    234234
     
    311311{
    312312    Type basicType;
    313     CClass *pClass;
     313    const CClass *pClass;
    314314
    315315    // XMLシリアライズ用
     
    321321
    322322        ar & BOOST_SERIALIZATION_NVP( basicType );
    323         ar & BOOST_SERIALIZATION_NVP( pClass );
    324     }
    325 
    326 public:
    327     BlittableType( const Type &basicType, CClass *pClass )
     323        ar & boost::serialization::make_nvp("pClass", const_cast<CClass *&>(pClass) );
     324    }
     325
     326public:
     327    BlittableType( const Type &basicType, const CClass *pClass )
    328328        : basicType( basicType )
    329329        , pClass( pClass )
     
    342342    }
    343343    const std::string GetCreateStaticMethodFullName() const;
     344
     345    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    344346};
    345347class BlittableTypes : public std::vector<BlittableType>
  • trunk/ab5.0/abdev/ab_common/include/Lexical/TypeDef.h

    r639 r640  
    5151    }
    5252
    53     virtual bool Resolve( const ObjectModule &resolver );
     53    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    5454};
    5555
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Variable.h

    r639 r640  
    175175    }
    176176
    177     virtual bool Resolve( const ObjectModule &resolver );
     177    virtual bool Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors );
    178178
    179179
  • trunk/ab5.0/abdev/ab_common/include/ab_common.h

    r637 r640  
    88#include "Lexical/NamespaceSupporter.h"
    99#include "Lexical/Symbol.h"
     10#include "Lexical/Resolver.h"
    1011#include "Lexical/RelationalObjectModuleItem.h"
    1112#include "Lexical/Prototype.h"
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp

    r639 r640  
    869869}
    870870
    871 bool CClass::Resolve( const ObjectModule &resolver )
     871bool CClass::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    872872{
    873873    // 型パラメータ
    874874    BOOST_FOREACH( GenericType &genericType, formalGenericTypes )
    875875    {
    876         genericType.GetType().Resolve( resolver );
     876        genericType.GetType().Resolve( resolver, resolveErrors );
    877877    }
    878878
     
    882882        if( this->pSuperClass->IsNeedResolve() )
    883883        {
    884             this->pSuperClass = resolver.meta.GetClasses().FindEx( *pSuperClass );
     884            const CClass *pTempClass = resolver.meta.GetClasses().FindLike( this->pSuperClass );
     885            if( pTempClass )
     886            {
     887                this->pSuperClass = pTempClass;
     888            }
     889            else
     890            {
     891                resolveErrors.Add( ResolveError( this->pSuperClass->GetRelationalObjectModuleIndex(), this->pSuperClass->GetFullName() ) );
     892            }
    885893        }
    886894    }
     
    889897    BOOST_FOREACH( Type &superClassActualTypeParameter, superClassActualTypeParameters )
    890898    {
    891         superClassActualTypeParameter.Resolve( resolver );
     899        superClassActualTypeParameter.Resolve( resolver, resolveErrors );
    892900    }
    893901
    894902    // Blittable型情報
    895     blittableType.Resolve( resolver );
     903    blittableType.Resolve( resolver, resolveErrors );
    896904
    897905    // 実装するインターフェイス
    898906    BOOST_FOREACH( ::Interface *pInterface, interfaces )
    899907    {
    900         pInterface->Resolve( resolver );
     908        pInterface->Resolve( resolver, resolveErrors );
    901909    }
    902910
     
    904912    BOOST_FOREACH( Member *pMember, dynamicMembers )
    905913    {
    906         pMember->Resolve( resolver );
     914        pMember->Resolve( resolver, resolveErrors );
    907915    }
    908916
     
    910918    BOOST_FOREACH( Member *pMember, staticMembers )
    911919    {
    912         pMember->Resolve( resolver );
     920        pMember->Resolve( resolver, resolveErrors );
    913921    }
    914922
     
    916924    BOOST_FOREACH( CMethod *pMethod, GetDynamicMethods() )
    917925    {
    918         pMethod->Resolve( resolver );
     926        pMethod->Resolve( resolver, resolveErrors );
    919927    }
    920928
     
    922930    BOOST_FOREACH( CMethod *pMethod, staticMethods )
    923931    {
    924         pMethod->Resolve( resolver );
     932        pMethod->Resolve( resolver, resolveErrors );
    925933    }
    926934
     
    928936    BOOST_FOREACH( ActiveBasic::Common::Lexical::ExpandedTemplateClass *pExpandedTemplateClass, expandedTemplateClasses )
    929937    {
    930         pExpandedTemplateClass->Resolve( resolver );
     938        pExpandedTemplateClass->Resolve( resolver, resolveErrors );
    931939    }
    932940
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Const.cpp

    r639 r640  
    77}
    88
    9 bool CConst::Resolve( const ObjectModule &resolver )
     9bool CConst::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    1010{
    11     type.Resolve( resolver );
     11    type.Resolve( resolver, resolveErrors );
    1212    return true;
    1313}
     
    7878}
    7979
    80 bool ConstMacro::Resolve( const ObjectModule &resolver )
     80bool ConstMacro::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    8181{
    8282    // 依存関係を解決すべきメンバは無い
  • trunk/ab5.0/abdev/ab_common/src/Lexical/DataTable.cpp

    r639 r640  
    7878}
    7979
    80 void DataTable::Resolve( const ObjectModule &resolver )
     80void DataTable::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    8181{
    8282    BOOST_FOREACH( Schedule &schedule, schedules )
    8383    {
    84         schedule.Resolve( resolver );
     84        schedule.Resolve( resolver, resolveErrors );
    8585    }
    8686}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Delegate.cpp

    r639 r640  
    1919}
    2020
    21 bool Delegate::Resolve( const ObjectModule &resolver )
     21bool Delegate::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    2222{
    23     Procedure::Resolve( resolver );
     23    Procedure::Resolve( resolver, resolveErrors );
    2424
    2525    BOOST_FOREACH( Parameter *pParameter, dynamicParams )
    2626    {
    27         pParameter->Resolve( resolver );
     27        pParameter->Resolve( resolver, resolveErrors );
    2828    }
    2929
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Interface.cpp

    r639 r640  
    3333}
    3434
     35bool Interface::Equals( const Interface *pInterface ) const
     36{
     37    // ポインタが等しいかどうかを見てみる
     38    if( this == pInterface )
     39    {
     40        return true;
     41    }
     42    else if( this->pInterfaceClass->IsNeedResolve() || pInterface->pInterfaceClass->IsNeedResolve() )
     43    {
     44        // 依存関係解決前の状態であれば、パスが等しいかどうかを見てみる
     45        if( this-pInterfaceClass->IsDuplication( pInterface->pInterfaceClass ) )
     46        {
     47            return true;
     48        }
     49    }
     50    return false;
     51}
     52
    3553std::string Interface::GetFullNameWithActualGenericTypeParameters() const
    3654{
     
    5371}
    5472
    55 bool Interface::Resolve( const ObjectModule &resolver )
     73bool Interface::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    5674{
    5775    // 動的メソッド
    5876    BOOST_FOREACH( CMethod *pMethod, GetDynamicMethods() )
    5977    {
    60         pMethod->Resolve( resolver );
     78        pMethod->Resolve( resolver, resolveErrors );
    6179    }
    6280
     
    6684        if( this->pInterfaceClass->IsNeedResolve() )
    6785        {
    68             this->pInterfaceClass = resolver.meta.GetClasses().FindLike( pInterfaceClass );
     86            const CClass *pTempClass = resolver.meta.GetClasses().FindLike( this->pInterfaceClass );
     87            if( pTempClass )
     88            {
     89                this->pInterfaceClass = pTempClass;
     90            }
     91            else
     92            {
     93                resolveErrors.Add( ResolveError( this->pInterfaceClass->GetRelationalObjectModuleIndex(), this->pInterfaceClass->GetFullName() ) );
     94            }
    6995        }
    7096    }
     
    7298    BOOST_FOREACH( Type &actualTypeParameter, actualTypeParameters )
    7399    {
    74         actualTypeParameter.Resolve( resolver );
     100        actualTypeParameter.Resolve( resolver, resolveErrors );
    75101    }
    76102
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Member.cpp

    r639 r640  
    4141}
    4242
    43 bool Member::Resolve( const ObjectModule &resolver )
     43bool Member::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    4444{
    45     type.Resolve( resolver );
     45    type.Resolve( resolver, resolveErrors );
    4646    return true;
    4747}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp

    r639 r640  
    253253}
    254254
    255 void Meta::Resolve( const ObjectModule &resolver )
     255void Meta::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    256256{
    257257    // 関数・メソッド
     
    261261    {
    262262        UserProc *pUserProc = this->GetUserProcs().Iterator_GetNext();
    263         pUserProc->Resolve( resolver );
     263        pUserProc->Resolve( resolver, resolveErrors );
    264264    }
    265265
     
    270270    {
    271271        DllProc *pDllProc = this->GetDllProcs().Iterator_GetNext();
    272         pDllProc->Resolve( resolver );
     272        pDllProc->Resolve( resolver, resolveErrors );
    273273    }
    274274
     
    279279    {
    280280        CClass *pClass = this->GetClasses().Iterator_GetNext();
    281         pClass->Resolve( resolver );
     281        pClass->Resolve( resolver, resolveErrors );
    282282    }
    283283
     
    285285    BOOST_FOREACH( Variable *pVar, globalVars )
    286286    {
    287         pVar->Resolve( resolver );
     287        pVar->Resolve( resolver, resolveErrors );
    288288    }
    289289
     
    294294    {
    295295        CConst *pConst = this->GetGlobalConsts().Iterator_GetNext();
    296         pConst->Resolve( resolver );
     296        pConst->Resolve( resolver, resolveErrors );
    297297    }
    298298
     
    303303    {
    304304        ConstMacro *pConstMacro = this->GetGlobalConstMacros().Iterator_GetNext();
    305         pConstMacro->Resolve( resolver );
     305        pConstMacro->Resolve( resolver, resolveErrors );
     306    }
     307
     308    // blittable型
     309    BOOST_FOREACH( BlittableType &blittableType, blittableTypes )
     310    {
     311        blittableType.Resolve( resolver, resolveErrors );
    306312    }
    307313
     
    309315    BOOST_FOREACH( TypeDef &typeDef, typeDefs )
    310316    {
    311         typeDef.Resolve( resolver );
     317        typeDef.Resolve( resolver, resolveErrors );
    312318    }
    313319
     
    315321    BOOST_FOREACH( ProcPointer *pProcPointer, procPointers )
    316322    {
    317         pProcPointer->Resolve( resolver );
     323        pProcPointer->Resolve( resolver, resolveErrors );
    318324    }
    319325
     
    324330    {
    325331        Delegate *pDelegate = this->GetDelegates().Iterator_GetNext();
    326         pDelegate->Resolve( resolver );
    327     }
    328 }
     332        pDelegate->Resolve( resolver, resolveErrors );
     333    }
     334}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Method.cpp

    r639 r640  
    11#include "stdafx.h"
    22
    3 bool CMethod::Resolve( const ObjectModule &resolver )
     3bool CMethod::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    44{
    5     if( pUserProc )
     5    if( this->pUserProc )
    66    {
    7         if( pUserProc->IsNeedResolve() )
     7        if( this->pUserProc->IsNeedResolve() )
    88        {
    9             pUserProc = resolver.meta.GetUserProcs().FindLike( pUserProc );
     9            const UserProc *pTempUserProc = resolver.meta.GetUserProcs().FindLike( this->pUserProc );
     10            if( pTempUserProc )
     11            {
     12                this->pUserProc = pTempUserProc;
     13            }
     14            else
     15            {
     16                resolveErrors.Add( ResolveError( this->pUserProc->GetRelationalObjectModuleIndex(), this->pUserProc->GetFullName() ) );
     17            }
    1018        }
    1119    }
     
    4149}
    4250
    43 bool DynamicMethod::Resolve( const ObjectModule &resolver )
     51bool DynamicMethod::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    4452{
    45     CMethod::Resolve( resolver );
     53    CMethod::Resolve( resolver, resolveErrors );
    4654
    4755    if( this->pInheritsClass )
     
    4957        if( this->pInheritsClass->IsNeedResolve() )
    5058        {
    51             this->pInheritsClass = resolver.meta.GetClasses().FindLike( pInheritsClass );
     59            const CClass *pTempClass = resolver.meta.GetClasses().FindLike( pInheritsClass );
     60            if( pTempClass )
     61            {
     62                this->pInheritsClass = pTempClass;
     63            }
     64            else
     65            {
     66                resolveErrors.Add( ResolveError( this->pInheritsClass->GetRelationalObjectModuleIndex(), this->pInheritsClass->GetFullName() ) );
     67            }
    5268        }
    5369    }
     
    6278}
    6379
    64 bool StaticMethod::Resolve( const ObjectModule &resolver )
     80bool StaticMethod::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    6581{
    66     CMethod::Resolve( resolver );
     82    CMethod::Resolve( resolver, resolveErrors );
    6783    return true;
    6884}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp

    r639 r640  
    1919}
    2020
    21 bool Schedule::Resolve( const ObjectModule &resolver )
     21bool Schedule::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    2222{
    2323    switch( type )
     
    2626    case AddressOf:
    2727    case CatchAddress:
    28         if( pUserProc->IsNeedResolve() )
    29         {
    30             pUserProc = resolver.meta.GetUserProcs().FindLike( pUserProc );
     28        if( this->pUserProc->IsNeedResolve() )
     29        {
     30            const ::UserProc *pTempUserProc = resolver.meta.GetUserProcs().FindLike( this->pUserProc );
     31            if( pTempUserProc )
     32            {
     33                this->pUserProc = pTempUserProc;
     34            }
     35            else
     36            {
     37                resolveErrors.Add( ResolveError( this->pUserProc->GetRelationalObjectModuleIndex(), this->pUserProc->GetFullName() ) );
     38            }
    3139        }
    3240        break;
    3341    case DllProc:
    34         if( pDllProc->IsNeedResolve() )
    35         {
    36             pDllProc = resolver.meta.GetDllProcs().FindLike( pDllProc );
     42        if( this->pDllProc->IsNeedResolve() )
     43        {
     44            const ::DllProc *pTempDllProc = resolver.meta.GetDllProcs().FindLike( this->pDllProc );
     45            if( pTempDllProc )
     46            {
     47                this->pDllProc = pTempDllProc;
     48            }
     49            else
     50            {
     51                resolveErrors.Add( ResolveError( this->pDllProc->GetRelationalObjectModuleIndex(), this->pDllProc->GetFullName() ) );
     52            }
    3753        }
    3854        break;
     
    4056    case Vtbl:
    4157    case TypeInfo:
    42         if( pClass->IsNeedResolve() )
    43         {
    44             pClass = resolver.meta.GetClasses().FindLike( pClass );
     58        if( this->pClass->IsNeedResolve() )
     59        {
     60            const CClass *pTempClass = resolver.meta.GetClasses().FindLike( this->pClass );
     61            if( pTempClass )
     62            {
     63                this->pClass = pTempClass;
     64            }
     65            else
     66            {
     67                resolveErrors.Add( ResolveError( this->pClass->GetRelationalObjectModuleIndex(), this->pClass->GetFullName() ) );
     68            }
    4569        }
    4670        break;
     
    191215}
    192216
    193 void NativeCode::Resolve( const ObjectModule &resolver )
     217void NativeCode::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    194218{
    195219    BOOST_FOREACH( Schedule &schedule, schedules )
    196220    {
    197         schedule.Resolve( resolver );
    198     }
    199 }
     221        schedule.Resolve( resolver, resolveErrors );
     222    }
     223}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/ObjectModule.cpp

    r639 r640  
    7777    }
    7878
    79     // 依存関係を解決
    80     this->Resolve();
    81 
    8279    // TODO: basbufがいらなくなったら消す
    8380    extern char *basbuf;
     
    8582}
    8683
    87 void ObjectModule::Resolve()
    88 {
    89     this->meta.Resolve( *this );
     84void ObjectModule::Resolve( ResolveErrors &resolveErrors )
     85{
     86    this->meta.Resolve( *this, resolveErrors );
    9087
    9188    // グローバルネイティブコードを解決(スケジュールを解決する)
    92     this->globalNativeCode.Resolve( *this );
     89    this->globalNativeCode.Resolve( *this, resolveErrors );
    9390
    9491    // データテーブルを解決(スケジュールを解決する)
    95     this->dataTable.Resolve( *this );
     92    this->dataTable.Resolve( *this, resolveErrors );
    9693}
    9794
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp

    r639 r640  
    1212}
    1313
    14 bool Procedure::Resolve( const ObjectModule &resolver )
     14bool Procedure::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    1515{
    1616    BOOST_FOREACH( Parameter *pParameter, params )
    1717    {
    18         pParameter->Resolve( resolver );
    19     }
    20 
    21     returnType.Resolve( resolver );
     18        pParameter->Resolve( resolver, resolveErrors );
     19    }
     20
     21    returnType.Resolve( resolver, resolveErrors );
    2222
    2323    return true;
     
    170170}
    171171
    172 bool UserProc::Resolve( const ObjectModule &resolver )
    173 {
    174     Procedure::Resolve( resolver );
    175 
    176     if( pParentClass )
    177     {
    178         if( pParentClass->IsNeedResolve() )
    179         {
    180             pParentClass = resolver.meta.GetClasses().FindLike( pParentClass );
     172bool UserProc::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
     173{
     174    Procedure::Resolve( resolver, resolveErrors );
     175
     176    if( this->pParentClass )
     177    {
     178        if( this->pParentClass->IsNeedResolve() )
     179        {
     180            const CClass *pTempClass = resolver.meta.GetClasses().FindLike( this->pParentClass );
     181            if( pTempClass )
     182            {
     183                this->pParentClass = pTempClass;
     184            }
     185            else
     186            {
     187                resolveErrors.Add( ResolveError( this->pParentClass->GetRelationalObjectModuleIndex(), this->pParentClass->GetFullName() ) );
     188            }
    181189        }
    182190    }
     
    184192    if( pInterface )
    185193    {
    186         const_cast<Interface *>(pInterface)->Resolve( resolver );
     194        const_cast<Interface *>(pInterface)->Resolve( resolver, resolveErrors );
    187195    }
    188196
    189197    if( pMethod )
    190198    {
    191         pMethod->Resolve( resolver );
     199        pMethod->Resolve( resolver, resolveErrors );
    192200    }
    193201
    194202    BOOST_FOREACH( Parameter *pParameter, realParams )
    195203    {
    196         pParameter->Resolve( resolver );
     204        pParameter->Resolve( resolver, resolveErrors );
    197205    }
    198206
    199207    BOOST_FOREACH( Variable *pLocalVar, localVars )
    200208    {
    201         pLocalVar->Resolve( resolver );
    202     }
    203 
    204     nativeCode.Resolve( resolver );
     209        pLocalVar->Resolve( resolver, resolveErrors );
     210    }
     211
     212    nativeCode.Resolve( resolver, resolveErrors );
    205213    return true;
    206214}
     
    228236}
    229237
    230 bool DllProc::Resolve( const ObjectModule &resolver )
    231 {
    232     Procedure::Resolve( resolver );
    233     return true;
    234 }
    235 
    236 bool ProcPointer::Resolve( const ObjectModule &resolver )
    237 {
    238     Procedure::Resolve( resolver );
     238bool DllProc::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
     239{
     240    Procedure::Resolve( resolver, resolveErrors );
     241    return true;
     242}
     243
     244bool ProcPointer::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
     245{
     246    Procedure::Resolve( resolver, resolveErrors );
    239247    return true;
    240248}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Template.cpp

    r639 r640  
    99}
    1010
    11 bool ExpandedTemplateClass::Resolve( const ObjectModule &resolver )
     11bool ExpandedTemplateClass::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    1212{
    1313    if( pClass->IsNeedResolve() )
    1414    {
    15         pClass = const_cast<CClass *>(resolver.meta.GetClasses().FindLike( pClass ));
     15        CClass *pTempClass = const_cast<CClass *>(resolver.meta.GetClasses().FindLike( pClass ));
     16        if( pTempClass )
     17        {
     18            this->pClass = pTempClass;
     19        }
     20        else
     21        {
     22            resolveErrors.Add( ResolveError( this->pClass->GetRelationalObjectModuleIndex(), this->pClass->GetFullName() ) );
     23        }
    1624    }
    1725
    1826    BOOST_FOREACH( Type &actualType, actualTypes )
    1927    {
    20         actualType.Resolve( resolver );
     28        actualType.Resolve( resolver, resolveErrors );
    2129    }
    2230
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Type.cpp

    r639 r640  
    129129bool Type::Equals( const Type &type ) const
    130130{
    131     if( basicType == type.basicType ){
    132         if( NATURAL_TYPE( basicType ) == DEF_OBJECT
    133             || NATURAL_TYPE( basicType ) == DEF_STRUCT ){
    134 
    135                 if( index == type.index ){
     131    if( basicType == type.basicType )
     132    {
     133        if( NATURAL_TYPE( basicType ) == DEF_OBJECT || NATURAL_TYPE( basicType ) == DEF_STRUCT )
     134        {
     135            // ポインタが等しいかどうかを見てみる
     136            if( this->pClass == type.pClass )
     137            {
     138                return true;
     139            }
     140            else if( this->pClass->IsNeedResolve() || type.pClass->IsNeedResolve() )
     141            {
     142                // 依存関係解決前の状態であれば、パスが等しいかどうかを見てみる
     143                if( this->pClass->IsDuplication( type.pClass ) )
     144                {
    136145                    return true;
    137146                }
    138 
    139         }
    140         else{
     147            }
     148        }
     149        else
     150        {
    141151            return true;
    142152        }
     
    556566}
    557567
    558 bool Type::Resolve( const ObjectModule &resolver )
     568bool Type::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    559569{
    560570    if( this->HasMember() )
     
    562572        if( this->pClass->IsNeedResolve() )
    563573        {
    564             this->pClass = resolver.meta.GetClasses().FindLike( this->pClass );
     574            const CClass *pTempClass = resolver.meta.GetClasses().FindLike( this->pClass );
     575            if( pTempClass )
     576            {
     577                this->pClass = pTempClass;
     578            }
     579            else
     580            {
     581                resolveErrors.Add( ResolveError( this->pClass->GetRelationalObjectModuleIndex(), this->pClass->GetFullName() ) );
     582            }
    565583        }
    566584
    567585        BOOST_FOREACH( GenericType &actualGenericType, actualGenericTypes )
    568586        {
    569             actualGenericType.GetType().Resolve( resolver );
     587            actualGenericType.GetType().Resolve( resolver, resolveErrors );
    570588        }
    571589    }
     
    655673    return pClass->GetNamespaceScopes().ToString() + "." + pClass->GetName() + "._Create";
    656674}
     675
     676bool BlittableType::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
     677{
     678    basicType.Resolve( resolver, resolveErrors );
     679
     680    if( this->pClass->IsNeedResolve() )
     681    {
     682        const CClass *pTempClass = resolver.meta.GetClasses().FindLike( this->pClass );
     683        if( pTempClass )
     684        {
     685            this->pClass = pTempClass;
     686        }
     687        else
     688        {
     689            resolveErrors.Add( ResolveError( this->pClass->GetRelationalObjectModuleIndex(), this->pClass->GetFullName() ) );
     690        }
     691    }
     692
     693    return true;
     694}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp

    r639 r640  
    88}
    99
    10 bool TypeDef::Resolve( const ObjectModule &resolver )
     10bool TypeDef::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    1111{
    12     this->baseType.Resolve( resolver );
     12    this->baseType.Resolve( resolver, resolveErrors );
    1313    return true;
    1414}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Variable.cpp

    r639 r640  
    2828}
    2929
    30 bool Variable::Resolve( const ObjectModule &resolver )
     30bool Variable::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
    3131{
    32     this->type.Resolve( resolver );
     32    this->type.Resolve( resolver, resolveErrors );
    3333    return true;
    3434}
Note: See TracChangeset for help on using the changeset viewer.