mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02:21 +02:00
Fixed unqualified static lookups in mixins
This commit is contained in:
parent
9933e4a353
commit
a3020720c9
3 changed files with 10 additions and 3 deletions
|
@ -3114,7 +3114,7 @@ BfTypedValue BfExprEvaluator::LookupIdentifier(BfAstNode* refNode, const StringI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!thisValue)
|
if (!thisValue.HasType())
|
||||||
thisValue = BfTypedValue(mModule->mCurTypeInstance);
|
thisValue = BfTypedValue(mModule->mCurTypeInstance);
|
||||||
BfTypedValue result = LookupField(identifierNode, thisValue, findName, BfLookupFieldFlag_IsImplicitThis);
|
BfTypedValue result = LookupField(identifierNode, thisValue, findName, BfLookupFieldFlag_IsImplicitThis);
|
||||||
if (mPropDef != NULL)
|
if (mPropDef != NULL)
|
||||||
|
|
|
@ -12062,7 +12062,7 @@ BfTypedValue BfModule::GetThis()
|
||||||
if (checkMethodState->mMixinState != NULL)
|
if (checkMethodState->mMixinState != NULL)
|
||||||
{
|
{
|
||||||
BfTypedValue thisValue = checkMethodState->mMixinState->mTarget;
|
BfTypedValue thisValue = checkMethodState->mMixinState->mTarget;
|
||||||
if (thisValue)
|
if (thisValue.HasType())
|
||||||
{
|
{
|
||||||
checkMethodState->mMixinState->mLastTargetAccessId = useMethodState->GetRootMethodState()->mCurAccessId++;
|
checkMethodState->mMixinState->mLastTargetAccessId = useMethodState->GetRootMethodState()->mCurAccessId++;
|
||||||
if (!thisValue.mType->IsValueType())
|
if (!thisValue.mType->IsValueType())
|
||||||
|
|
|
@ -7,6 +7,7 @@ namespace Tests
|
||||||
class MixClass
|
class MixClass
|
||||||
{
|
{
|
||||||
public int mA = 100;
|
public int mA = 100;
|
||||||
|
public static int sA = 200;
|
||||||
|
|
||||||
public mixin MixA(var addTo)
|
public mixin MixA(var addTo)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +23,11 @@ namespace Tests
|
||||||
|
|
||||||
AddIt();
|
AddIt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static mixin MixC(var val)
|
||||||
|
{
|
||||||
|
val + sA
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -32,6 +38,7 @@ namespace Tests
|
||||||
Test.Assert(mc.mA == 110);
|
Test.Assert(mc.mA == 110);
|
||||||
mc.MixB!(10);
|
mc.MixB!(10);
|
||||||
Test.Assert(mc.mA == 120);
|
Test.Assert(mc.mA == 120);
|
||||||
|
Test.Assert(MixClass.MixC!(30) == 230);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue