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

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