mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Properly throw error on Dispose call on using for immutable values
This commit is contained in:
parent
dfbf7a2792
commit
f8d4d0ded0
2 changed files with 5 additions and 7 deletions
|
@ -4566,17 +4566,11 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
|
||||||
(!isSkipCall))
|
(!isSkipCall))
|
||||||
{
|
{
|
||||||
bool skipMutCheck = false;
|
bool skipMutCheck = false;
|
||||||
if (prevBindResult.mPrevVal != NULL)
|
if ((prevBindResult.mPrevVal != NULL) && (prevBindResult.mPrevVal->mSkipMutCheck))
|
||||||
{
|
{
|
||||||
// If we are binding a delegate, then we will end up making a copy of the target anyway
|
// If we are binding a delegate, then we will end up making a copy of the target anyway
|
||||||
// so we don't need to do a mutability check
|
// so we don't need to do a mutability check
|
||||||
skipMutCheck = true;
|
skipMutCheck = true;
|
||||||
// auto bindResult = prevBindResult.mPrevVal;
|
|
||||||
// if ((bindResult->mOrigTarget) &&
|
|
||||||
// ((bindResult->mOrigTarget.mType->IsVar()) || (bindResult->mOrigTarget.mType->IsPointer())))
|
|
||||||
// {
|
|
||||||
// skipMutCheck = true;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PushThis(targetSrc, target, moduleMethodInstance.mMethodInstance, irArgs, skipMutCheck);
|
PushThis(targetSrc, target, moduleMethodInstance.mMethodInstance, irArgs, skipMutCheck);
|
||||||
|
@ -8104,6 +8098,7 @@ bool BfExprEvaluator::CanBindDelegate(BfDelegateBindExpression* delegateBindExpr
|
||||||
methodGenericArguments = &delegateBindExpr->mGenericArgs->mGenericArgs;
|
methodGenericArguments = &delegateBindExpr->mGenericArgs->mGenericArgs;
|
||||||
|
|
||||||
BfFunctionBindResult bindResult;
|
BfFunctionBindResult bindResult;
|
||||||
|
bindResult.mSkipMutCheck = true; // Allow operating on copies
|
||||||
mFunctionBindResult = &bindResult;
|
mFunctionBindResult = &bindResult;
|
||||||
SetAndRestoreValue<bool> ignoreError(mModule->mIgnoreErrors, true);
|
SetAndRestoreValue<bool> ignoreError(mModule->mIgnoreErrors, true);
|
||||||
DoInvocation(delegateBindExpr->mTarget, delegateBindExpr, args, methodGenericArguments);
|
DoInvocation(delegateBindExpr->mTarget, delegateBindExpr, args, methodGenericArguments);
|
||||||
|
@ -8505,6 +8500,7 @@ void BfExprEvaluator::Visit(BfDelegateBindExpression* delegateBindExpr)
|
||||||
}
|
}
|
||||||
|
|
||||||
BfFunctionBindResult bindResult;
|
BfFunctionBindResult bindResult;
|
||||||
|
bindResult.mSkipMutCheck = true; // Allow operating on copies
|
||||||
mFunctionBindResult = &bindResult;
|
mFunctionBindResult = &bindResult;
|
||||||
DoInvocation(delegateBindExpr->mTarget, delegateBindExpr, args, methodGenericArguments);
|
DoInvocation(delegateBindExpr->mTarget, delegateBindExpr, args, methodGenericArguments);
|
||||||
mFunctionBindResult = NULL;
|
mFunctionBindResult = NULL;
|
||||||
|
|
|
@ -219,6 +219,7 @@ public:
|
||||||
BfIRValue mFunc;
|
BfIRValue mFunc;
|
||||||
BfMethodInstance* mMethodInstance;
|
BfMethodInstance* mMethodInstance;
|
||||||
bool mSkipThis;
|
bool mSkipThis;
|
||||||
|
bool mSkipMutCheck;
|
||||||
bool mWantsArgs;
|
bool mWantsArgs;
|
||||||
bool mCheckedMultipleMethods;
|
bool mCheckedMultipleMethods;
|
||||||
SizedArray<BfIRValue, 2> mIRArgs;
|
SizedArray<BfIRValue, 2> mIRArgs;
|
||||||
|
@ -227,6 +228,7 @@ public:
|
||||||
BfFunctionBindResult()
|
BfFunctionBindResult()
|
||||||
{
|
{
|
||||||
mMethodInstance = NULL;
|
mMethodInstance = NULL;
|
||||||
|
mSkipMutCheck = false;
|
||||||
mWantsArgs = false;
|
mWantsArgs = false;
|
||||||
mSkipThis = false;
|
mSkipThis = false;
|
||||||
mCheckedMultipleMethods = false;
|
mCheckedMultipleMethods = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue