mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Fixed some struct-init-detection code
This commit is contained in:
parent
cc47080e96
commit
f869bb3978
2 changed files with 61 additions and 1 deletions
|
@ -3586,7 +3586,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int fieldIdx = -1;
|
int fieldIdx = mResultLocalVarField - 1;
|
||||||
if (fieldIdx == -1)
|
if (fieldIdx == -1)
|
||||||
{
|
{
|
||||||
mResultLocalVarField = minMergedDataIdx + 1;
|
mResultLocalVarField = minMergedDataIdx + 1;
|
||||||
|
|
60
IDEHelper/Tests/src/StructInit.bf
Normal file
60
IDEHelper/Tests/src/StructInit.bf
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
namespace Tests
|
||||||
|
{
|
||||||
|
class StructInit
|
||||||
|
{
|
||||||
|
struct StructA
|
||||||
|
{
|
||||||
|
public int mA0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct StructB
|
||||||
|
{
|
||||||
|
public int mB0;
|
||||||
|
public int mB1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct StructC
|
||||||
|
{
|
||||||
|
public StructA mSA;
|
||||||
|
public StructB mSB;
|
||||||
|
|
||||||
|
public this()
|
||||||
|
{
|
||||||
|
mSA.mA0 = 1;
|
||||||
|
mSB.mB0 = 2;
|
||||||
|
mSB.mB1 = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct StructD
|
||||||
|
{
|
||||||
|
public StructC mSC;
|
||||||
|
public int mD0;
|
||||||
|
|
||||||
|
public this()
|
||||||
|
{
|
||||||
|
mSC.mSA.mA0 = 1;
|
||||||
|
mSC.mSB.mB0 = 2;
|
||||||
|
mSC.mSB.mB1 = 3;
|
||||||
|
mD0 = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct StructE
|
||||||
|
{
|
||||||
|
public StructD mSD;
|
||||||
|
public int[3] mE0;
|
||||||
|
|
||||||
|
public this()
|
||||||
|
{
|
||||||
|
mSD.mSC.mSA.mA0 = 1;
|
||||||
|
mSD.mSC.mSB.mB0 = 2;
|
||||||
|
mSD.mSC.mSB.mB1 = 3;
|
||||||
|
mSD.mD0 = 4;
|
||||||
|
mE0[0] = 5;
|
||||||
|
mE0[1] = 6;
|
||||||
|
mE0[2] = 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue