mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Local static local method referencing of locals
This commit is contained in:
parent
c8ba4a9e42
commit
9d2a22da4b
1 changed files with 9 additions and 4 deletions
|
@ -21485,8 +21485,7 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
|
||||||
wantsVisitBody = false;
|
wantsVisitBody = false;
|
||||||
if (methodInstance->IsOrInUnspecializedVariation())
|
if (methodInstance->IsOrInUnspecializedVariation())
|
||||||
wantsVisitBody = false;
|
wantsVisitBody = false;
|
||||||
if ((methodDeclaration != NULL) && (methodDeclaration->mStaticSpecifier != NULL))
|
bool allowCapture = (methodDeclaration == NULL) || (methodDeclaration->mStaticSpecifier == NULL);
|
||||||
wantsVisitBody = false;
|
|
||||||
|
|
||||||
if (wantsVisitBody)
|
if (wantsVisitBody)
|
||||||
{
|
{
|
||||||
|
@ -21562,7 +21561,7 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
|
||||||
|
|
||||||
std::multiset<BfClosureCapturedEntry> capturedEntries;
|
std::multiset<BfClosureCapturedEntry> capturedEntries;
|
||||||
|
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto varMethodState = declMethodState;
|
auto varMethodState = declMethodState;
|
||||||
|
|
||||||
|
@ -21582,6 +21581,12 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
|
||||||
auto localVar = varMethodState->mLocals[localIdx];
|
auto localVar = varMethodState->mLocals[localIdx];
|
||||||
if ((localVar->mReadFromId >= closureState.mCaptureStartAccessId) || (localVar->mWrittenToId >= closureState.mCaptureStartAccessId))
|
if ((localVar->mReadFromId >= closureState.mCaptureStartAccessId) || (localVar->mWrittenToId >= closureState.mCaptureStartAccessId))
|
||||||
{
|
{
|
||||||
|
if (!allowCapture)
|
||||||
|
{
|
||||||
|
if ((!localVar->mIsStatic) && (!localVar->mConstValue))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (localVar->mIsThis)
|
if (localVar->mIsThis)
|
||||||
{
|
{
|
||||||
// We can only set mutating if our owning type is mutating
|
// We can only set mutating if our owning type is mutating
|
||||||
|
@ -21602,7 +21607,7 @@ BfModuleMethodInstance BfModule::GetLocalMethodInstance(BfLocalMethod* localMeth
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((localVar->mConstValue) || (localVar->mResolvedType->IsValuelessType()))
|
if ((localVar->mConstValue) || (localVar->mIsStatic) || (localVar->mResolvedType->IsValuelessType()))
|
||||||
{
|
{
|
||||||
closureState.mConstLocals.push_back(*localVar);
|
closureState.mConstLocals.push_back(*localVar);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue