mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Added Compiler.Align
This commit is contained in:
parent
ec4ccb2e9c
commit
8aef7275d0
5 changed files with 55 additions and 13 deletions
|
@ -6086,6 +6086,17 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8*
|
|||
else
|
||||
_Fail("Comptime return types can only be set on methods declared with a 'var' return type");
|
||||
}
|
||||
else if (checkFunction->mFunctionKind == CeFunctionKind_Align)
|
||||
{
|
||||
int32 typeId = *(int32*)((uint8*)stackPtr);
|
||||
int32 align = *(int32*)((uint8*)stackPtr + sizeof(int32));
|
||||
if ((mCurEmitContext == NULL) || (mCurEmitContext->mType == NULL) || (mCurEmitContext->mType->mTypeId != typeId))
|
||||
{
|
||||
_Fail("This type cannot be modified in this context");
|
||||
return false;
|
||||
}
|
||||
mCurEmitContext->mAlign = BF_MAX(mCurEmitContext->mAlign, align);
|
||||
}
|
||||
else if (checkFunction->mFunctionKind == CeFunctionKind_EmitTypeBody)
|
||||
{
|
||||
int32 typeId = *(int32*)((uint8*)stackPtr);
|
||||
|
@ -9297,6 +9308,10 @@ void CeMachine::CheckFunctionKind(CeFunction* ceFunction)
|
|||
{
|
||||
ceFunction->mFunctionKind = CeFunctionKind_SetReturnType;
|
||||
}
|
||||
else if (methodDef->mName == "Comptime_Align")
|
||||
{
|
||||
ceFunction->mFunctionKind = CeFunctionKind_Align;
|
||||
}
|
||||
else if (methodDef->mName == "Comptime_EmitTypeBody")
|
||||
{
|
||||
ceFunction->mFunctionKind = CeFunctionKind_EmitTypeBody;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue