source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/Overload.cpp@ 496

Last change on this file since 496 was 485, checked in by dai_9181, 17 years ago

プロジェクトのリネームが完了

File size: 1.8 KB
RevLine 
[206]1#include "stdafx.h"
2
[4]3#include "../BasicCompiler_Common/common.h"
4
5#ifdef _AMD64_
[485]6#include "../compiler_x64/opcode.h"
[4]7#else
[484]8#include "../compiler_x86/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 );
[424]31
[64]32/*
[50]33 //メソッドの場合は静的かどうかを調べる
34 bool isStatic = false;
[75]35 CClass *pClass = subs[0]->GetParentClassPtr();
[50]36 if( pClass ){
37 isStatic = pClass->IsExistStaticMethod( MethodName );
38 }
[64]39*/
[50]40 //パラメータオブジェクトを生成
[71]41 pobj_parameter=new ParamImpl(Parameter);
[4]42
[424]43 Type leftType;
44 GetTermType( ObjectName, leftType );
[4]45
[424]46 const UserProc *pUserProc = pobj_parameter->OverloadSolution( name, subs, leftType );
[4]47
48
[50]49 //パラメータオブジェクトを破棄
50 delete pobj_parameter;
51 pobj_parameter=0;
52
[75]53 return pUserProc;
[4]54}
[206]55const UserProc *OverloadSolution(
[50]56 const char *name,
[206]57 std::vector<const UserProc *> &subs,
[75]58 const Parameters &params,
[424]59 const Type &returnType,
60 const Type &leftType )
61{
[4]62
[50]63 // オーバーロードの解決
[4]64
[50]65 //オーバーロードされていないとき
66 if( subs.size() == 1 ) return subs[0];
[4]67
68
[75]69 ParamImpl *pobj_Parameter=new ParamImpl( params );
70 if( !returnType.IsNull() ){
71 pobj_Parameter->SetReturnType( returnType );
72 }
[4]73
[424]74 const UserProc *pUserProc = pobj_Parameter->OverloadSolution( name, subs, leftType);
[4]75
[50]76 delete pobj_Parameter;
77
[75]78 return pUserProc;
[4]79}
Note: See TracBrowser for help on using the repository browser.