mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Removed erroneous assertion in DoImplicitArgCapture
This commit is contained in:
parent
e2337e7ac1
commit
6c2d03c898
3 changed files with 17 additions and 4 deletions
|
@ -11481,7 +11481,6 @@ BfTypedValue BfExprEvaluator::DoImplicitArgCapture(BfAstNode* refNode, BfMethodI
|
||||||
return lookupVal;
|
return lookupVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BF_ASSERT(methodRefTarget.IsAddr());
|
|
||||||
if (paramType->IsComposite())
|
if (paramType->IsComposite())
|
||||||
return BfTypedValue(mModule->mBfIRBuilder->CreateInBoundsGEP(methodRefTarget.mValue, 0, dataIdx), paramType, true);
|
return BfTypedValue(mModule->mBfIRBuilder->CreateInBoundsGEP(methodRefTarget.mValue, 0, dataIdx), paramType, true);
|
||||||
return BfTypedValue(mModule->ExtractValue(methodRefTarget, dataIdx), paramType);
|
return BfTypedValue(mModule->ExtractValue(methodRefTarget, dataIdx), paramType);
|
||||||
|
|
|
@ -2627,9 +2627,11 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
|
||||||
BfMethodInstance* methodInstance = methodRefType->mMethodRef;
|
BfMethodInstance* methodInstance = methodRefType->mMethodRef;
|
||||||
|
|
||||||
String name = "_BF_MethodRef_";
|
String name = "_BF_MethodRef_";
|
||||||
|
|
||||||
|
if (methodInstance != NULL)
|
||||||
name += BfTypeUtils::HashEncode64(methodInstance->mIdHash).c_str();
|
name += BfTypeUtils::HashEncode64(methodInstance->mIdHash).c_str();
|
||||||
|
|
||||||
if (wantDIData)
|
if ((wantDIData) && (methodInstance != NULL))
|
||||||
{
|
{
|
||||||
auto typeDeclaration = methodInstance->GetOwner()->mTypeDef->mTypeDeclaration;
|
auto typeDeclaration = methodInstance->GetOwner()->mTypeDef->mTypeDeclaration;
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,14 @@ namespace Tests
|
||||||
return dlg(val[0]);
|
return dlg(val[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void TestWrap<T>(T del, bool b = false) where T : delegate void()
|
||||||
|
{
|
||||||
|
Action ac = scope () => {
|
||||||
|
del();
|
||||||
|
};
|
||||||
|
ac();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public static void TestBasics()
|
public static void TestBasics()
|
||||||
{
|
{
|
||||||
|
@ -78,6 +86,10 @@ namespace Tests
|
||||||
List<float> fList = scope .() { 1.2f, 2.3f };
|
List<float> fList = scope .() { 1.2f, 2.3f };
|
||||||
Test.Assert(DoOnListA(fList, (val) => val + 100) == 101.2f);
|
Test.Assert(DoOnListA(fList, (val) => val + 100) == 101.2f);
|
||||||
Test.Assert(DoOnListB((val) => val + 200, fList) == 201.2f);
|
Test.Assert(DoOnListB((val) => val + 200, fList) == 201.2f);
|
||||||
|
|
||||||
|
int a = 222;
|
||||||
|
TestWrap(() => { a += 100; });
|
||||||
|
Test.Assert(a == 322);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MethodRefHolder<T> where T : delegate int(int num)
|
struct MethodRefHolder<T> where T : delegate int(int num)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue