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