1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Support System.Compiler values in comptime, SetReturnType, Enum helpers

This commit is contained in:
Brian Fiete 2022-06-23 11:53:21 -07:00
parent 0e86b5c49d
commit 2a55b5c7bb
14 changed files with 341 additions and 63 deletions

View file

@ -329,8 +329,15 @@ public:
mCeFunction = NULL;
mRefCount = 0;
}
~CeFunctionInfo();
BfTypeInstance* GetOwner()
{
if (mMethodInstance != NULL)
return mMethodInstance->GetOwner();
return mMethodRef.mTypeInstance;
}
};
class CeCallEntry
@ -440,6 +447,7 @@ enum CeFunctionKind
CeFunctionKind_Method_GetParamInfo,
CeFunctionKind_Method_GetGenericArg,
CeFunctionKind_SetReturnType,
CeFunctionKind_EmitTypeBody,
CeFunctionKind_EmitAddInterface,
CeFunctionKind_EmitMethodEntry,
@ -1050,6 +1058,7 @@ public:
Kind mKind;
BfAstNode* mRefNode;
BfFieldInstance* mFieldInstance;
BfType* mOrigCalleeType;
public:
CeCallSource(BfAstNode* refNode)
@ -1057,6 +1066,7 @@ public:
mKind = Kind_Unknown;
mRefNode = refNode;
mFieldInstance = NULL;
mOrigCalleeType = NULL;
}
CeCallSource()
@ -1064,6 +1074,7 @@ public:
mKind = Kind_Unknown;
mRefNode = NULL;
mFieldInstance = NULL;
mOrigCalleeType = NULL;
}
};
@ -1135,7 +1146,7 @@ public:
BfIRValue CreateConstant(BfModule* module, uint8* ptr, BfType* type, BfType** outType = NULL);
BfIRValue CreateAttribute(BfAstNode* targetSrc, BfModule* module, BfIRConstHolder* constHolder, BfCustomAttribute* customAttribute, addr_ce ceAttrAddr = 0);
bool Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* startFramePtr, BfType*& returnType);
bool Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* startFramePtr, BfType*& returnType, BfType*& castReturnType);
BfTypedValue Call(CeCallSource callSource, BfModule* module, BfMethodInstance* methodInstance, const BfSizedArray<BfIRValue>& args, CeEvalFlags flags, BfType* expectingType);
};