1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed comptime with local mixin with composite param access

This commit is contained in:
Brian Fiete 2021-02-26 07:12:16 -08:00
parent 4575c64133
commit dd3485af0c
2 changed files with 14 additions and 1 deletions

View file

@ -3668,8 +3668,10 @@ BfTypedValue BfExprEvaluator::LoadLocal(BfLocalVariable* varDecl, bool allowRef)
else
{
BfTypedValueKind kind;
if ((varDecl->mResolvedType->IsComposite()) && (varDecl->IsParam()) && (mModule->mCurMethodState->mMixinState == NULL))
if ((varDecl->mResolvedType->IsComposite()) && (varDecl->mValue.IsArg()))
{
kind = varDecl->mIsReadOnly ? BfTypedValueKind_ReadOnlyAddr : BfTypedValueKind_Addr;
}
else
kind = BfTypedValueKind_Value;
localResult = BfTypedValue(varDecl->mValue, varDecl->mResolvedType, kind);

View file

@ -135,6 +135,16 @@ namespace Tests
public const let cVal1 = StrToValue("1.23");
}
[Comptime]
static int StrLenMixin(StringView str)
{
mixin test()
{
str.Length
}
return test!();
}
[Test]
public static void TestBasics()
{
@ -172,6 +182,7 @@ namespace Tests
Test.Assert([ConstEval]MethodB() == 1);
Test.Assert(MethodC() == 1753);
Test.Assert(StrLenMixin("ABCD") == 4);
}
}
}