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

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

・LexicalAnalyzer::AnalyzeParameterの第二パラメータをstringからStringsに変更した。
・UserProc::SetParamsAndReturnTypeメソッド内で行っているパラメータ解析処理をLexicalAnalyzer::AnalyzeParameterメソッドを使用したコードに書き直した。

File size: 1.2 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    Jenga::Common::Strings parameterStrings;
12    SplitParameter( paramStr, parameterStrings );
13    ActiveBasic::Compiler::LexicalAnalyzer::AnalyzeParameter( params, parameterStrings, sourceIndex );
14
15    // 動的パラメータを作る
16    dynamicParams = params;
17    dynamicParams.insert( dynamicParams.begin(), new Parameter( "_System_LocalThis", Type( DEF_PTR_VOID ) ) );
18
19    if( IsFunction() )
20    {
21        // 戻り値を取得
22        if( !compiler.StringToType( returnTypeName, returnType ) )
23        {
24            compiler.errorMessenger.Output(3,returnTypeName,sourceIndex);
25        }
26    }
27}
28
29bool Delegate::IsSimilar( const Delegate &dgt ) const
30{
31    if( this->Params().Equals( dgt.Params(), true ) )           // パラメータが等しい、もしくは反変
32    {
33        if( this->returnType.Equals( dgt.returnType ) )
34        {
35            // 戻り値が等しい
36            return true;
37        }
38        else if( this->returnType.IsCovariant( dgt.returnType ) )
39        {
40            // 戻り値が共変
41            return true;
42        }
43    }
44    return false;
45}
Note: See TracBrowser for help on using the repository browser.