Skip to content

Commit

Permalink
remvoe static set. Its not supported by C#
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim8y committed Mar 9, 2024
1 parent 3a7e785 commit 7f9bac9
Showing 1 changed file with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,13 @@ private void ConvertIdentifierNameAssignment(SemanticModel model, IdentifierName
if (withinConstructor && property.SetMethod == null)
{
IFieldSymbol[] fields = property.ContainingType.GetAllMembers().OfType<IFieldSymbol>().ToArray();
if (Symbol.IsStatic)
{
IFieldSymbol backingField = Array.Find(fields, p => SymbolEqualityComparer.Default.Equals(p.AssociatedSymbol, property))!;
byte backingFieldIndex = _context.AddStaticField(backingField);
if (!_inline) AccessSlot(OpCode.LDARG, 0);
AccessSlot(OpCode.STSFLD, backingFieldIndex);
}
else
{
fields = fields.Where(p => !p.IsStatic).ToArray();
int backingFieldIndex = Array.FindIndex(fields, p => SymbolEqualityComparer.Default.Equals(p.AssociatedSymbol, property));
AccessSlot(OpCode.LDARG, 0);
Push(backingFieldIndex);
AddInstruction(OpCode.ROT);
AddInstruction(OpCode.SETITEM);
}

fields = fields.Where(p => !p.IsStatic).ToArray();
int backingFieldIndex = Array.FindIndex(fields, p => SymbolEqualityComparer.Default.Equals(p.AssociatedSymbol, property));
AccessSlot(OpCode.LDARG, 0);
Push(backingFieldIndex);
AddInstruction(OpCode.ROT);
AddInstruction(OpCode.SETITEM);
}
else if (property.SetMethod != null)
{
Expand Down

0 comments on commit 7f9bac9

Please sign in to comment.