1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 20:12:21 +02:00

fixed thiscall compile crash now hopefully

This commit is contained in:
EinBurgbauer 2021-05-20 17:19:18 +02:00
parent 8975b30e0f
commit 10c8196352
2 changed files with 18 additions and 3 deletions

View file

@ -1227,8 +1227,7 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
{ {
checkType = GetParamType(0); checkType = GetParamType(0);
//TODO(BCF): Breaks tests hasExplicitThis = true;
//hasExplicitThis = true;
} }
else else
checkType = GetOwner(); checkType = GetOwner();
@ -1236,7 +1235,7 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
} }
else else
{ {
if (hasExplicitThis) if (hasExplicitThis && paramIdx == 0)
{ {
// We already looked at this // We already looked at this
hasExplicitThis = false; hasExplicitThis = false;

View file

@ -130,6 +130,22 @@ namespace Tests
} }
} }
[CRepr]
struct StructCRepr
{
public int32 something = 1;
bool Run() => something == 1;
public static void Test()
{
StructCRepr sc = .();
function bool(StructCRepr this) func = => Run;
Test.Assert(func(sc));
}
}
public static int UseFunc0<T>(function int (T this, float f) func, T a, float b) public static int UseFunc0<T>(function int (T this, float f) func, T a, float b)
{ {
return func(a, b); return func(a, b);