source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/src/Delegate.cpp @ 525

Last change on this file since 525 was 525, checked in by dai_9181, 15 years ago

デリゲート収集コードの実装をLexicalAnalyzerクラスに移動した。

File size: 1.1 KB
Line 
1#include "stdafx.h"
2
3#include <Delegate.h>
4
5void Delegate::RefleshParameterAndReturnType()
6{
7    compiler.GetNamespaceSupporter().SetImportedNamespaces( this->importedNamespaces );
8    compiler.GetNamespaceSupporter().SetLivingNamespaceScopes( this->GetNamespaceScopes() );
9
10    // パラメータを解析
11    params.Analyze( paramStr.c_str(), sourceIndex );
12
13    // 動的パラメータを作る
14    dynamicParams = params;
15    dynamicParams.insert( dynamicParams.begin(), new Parameter( "_System_LocalThis", Type( DEF_PTR_VOID ) ) );
16
17    if( IsFunction() )
18    {
19        // 戻り値を取得
20        if( !compiler.StringToType( returnTypeName, returnType ) )
21        {
22            compiler.errorMessenger.Output(3,returnTypeName,sourceIndex);
23        }
24    }
25}
26
27bool Delegate::IsSimilar( const Delegate &dgt ) const
28{
29    if( this->Params().Equals( dgt.Params(), true ) )           // パラメータが等しい、もしくは反変
30    {
31        if( this->returnType.Equals( dgt.returnType ) )
32        {
33            // 戻り値が等しい
34            return true;
35        }
36        else if( this->returnType.IsCovariant( dgt.returnType ) )
37        {
38            // 戻り値が共変
39            return true;
40        }
41    }
42    return false;
43}
Note: See TracBrowser for help on using the repository browser.