1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-21 09:27:59 +02:00

Fixed static bitfields

This commit is contained in:
Brian Fiete 2022-02-11 09:44:41 -05:00
parent df604e6657
commit 3c74588e10
2 changed files with 12 additions and 9 deletions

View file

@ -147,6 +147,9 @@ namespace System
str.Append("public ");
else if (mProtection == .Protected)
str.Append("protected ");
if (fieldInfo.IsStatic)
str.Append("static ");
bool wantsMut = fieldInfo.Owner.IsStruct && !fieldInfo.IsStatic;
void TypeStr(String str, Type t)
{
@ -205,14 +208,14 @@ namespace System
{
if (pass == 0)
{
str.AppendF($"\t[Inline]\n\tset{(fieldInfo.Owner.IsStruct ? " mut" : "")}\n\t{{\n");
str.AppendF($"\t[Inline]\n\tset{(wantsMut ? " mut" : "")}\n\t{{\n");
}
else
break;
}
else
{
str.AppendF($"\t[Inline, {((pass == 0) ? "Checked" : "Unchecked")}]\n\tset{(fieldInfo.Owner.IsStruct ? " mut" : "")}\n\t{{\n");
str.AppendF($"\t[Inline, {((pass == 0) ? "Checked" : "Unchecked")}]\n\tset{(wantsMut ? " mut" : "")}\n\t{{\n");
if ((pass == 0) && (rangeCheckMin) && (rangeCheckMax))
str.AppendF($"\t\tRuntime.Assert((value >= {minVal}) && (value <= {maxVal}));\n");
else if ((pass == 0) && (rangeCheckMin))