source: dev/trunk/abdev/BasicCompiler_Common/Overload.cpp@ 318

Last change on this file since 318 was 206, checked in by dai_9181, 17 years ago

コード全体のリファクタリングを実施

File size: 1.7 KB
RevLine 
[206]1#include "stdafx.h"
2
[4]3#include "../BasicCompiler_Common/common.h"
4
5#ifdef _AMD64_
6#include "../BasicCompiler64/opcode.h"
7#else
[5]8#include "../BasicCompiler32/opcode.h"
[4]9#endif
10
[206]11const UserProc *OverloadSolutionWithStrParam(
[50]12 const char *name,
[206]13 std::vector<const UserProc *> &subs,
[50]14 const char *Parameter,
[75]15 const char *ObjectName){
[4]16
[50]17 // オーバーロードの解決
[4]18
[50]19 //オーバーロードされていないとき
20 if( subs.size() == 1 ) return subs[0];
[4]21
22
[50]23 ////////////////////////
24 // パラメータをセット
25 ////////////////////////
[4]26
[71]27 ParamImpl *pobj_parameter=0;
[28]28
[50]29 char MethodName[VN_SIZE];
[206]30 if( !SplitMemberName( name, NULL, MethodName ) ) lstrcpy( MethodName, name );
[64]31/*
[50]32 //メソッドの場合は静的かどうかを調べる
33 bool isStatic = false;
[75]34 CClass *pClass = subs[0]->GetParentClassPtr();
[50]35 if( pClass ){
36 isStatic = pClass->IsExistStaticMethod( MethodName );
37 }
[64]38*/
[50]39 //パラメータオブジェクトを生成
[71]40 pobj_parameter=new ParamImpl(Parameter);
[4]41
42
[206]43 const UserProc *pUserProc = pobj_parameter->OverloadSolution(name,subs);
[4]44
45
[50]46 //パラメータオブジェクトを破棄
47 delete pobj_parameter;
48 pobj_parameter=0;
49
[75]50 return pUserProc;
[4]51}
[206]52const UserProc *OverloadSolution(
[50]53 const char *name,
[206]54 std::vector<const UserProc *> &subs,
[75]55 const Parameters &params,
56 const Type &returnType ){
[4]57
[50]58 // オーバーロードの解決
[4]59
[50]60 //オーバーロードされていないとき
61 if( subs.size() == 1 ) return subs[0];
[4]62
63
[75]64 ParamImpl *pobj_Parameter=new ParamImpl( params );
65 if( !returnType.IsNull() ){
66 pobj_Parameter->SetReturnType( returnType );
67 }
[4]68
[206]69 const UserProc *pUserProc = pobj_Parameter->OverloadSolution(name,subs);
[4]70
[50]71 delete pobj_Parameter;
72
[75]73 return pUserProc;
[4]74}
Note: See TracBrowser for help on using the repository browser.