For the moment, go back to the non-optimised (non-cached) access methods to symbol properties

This commit is contained in:
Adrian Conlon 2024-06-25 19:41:21 +01:00
parent ddef969d34
commit 060481e4df
8 changed files with 14 additions and 65 deletions

View File

@ -8,20 +8,13 @@
public class File(Parser container) : NamedSection(container)
{
[SectionProperty("size")]
public int Size { get; private set; }
public int Size => this.TakeInteger("size");
[SectionProperty("mtime", hexadecimal: true)]
public long ModificationTime { get; private set; }
public long ModificationTime => this.TakeLong("mtime");
[SectionReference("mod")]
public Symbols.Module Module => this.TakeModuleReference();
public override void Parse(IDictionary<string, string> entries)
{
base.Parse(entries);
this.Size = this.TakeInteger("size");
this.ModificationTime = this.TakeLong("mtime");
}
}
}
}

View File

@ -7,18 +7,12 @@
public class IdentifiableSection : Section
{
[SectionProperty("id")]
public int ID { get; private set; }
public int ID => this.TakeInteger("id");
protected IdentifiableSection(Parser container)
: base(container)
{}
public override void Parse(IDictionary<string, string> entries)
{
base.Parse(entries);
this.ID = this.TakeInteger("id");
}
#region Foreign key constraints
#region Generic FK access

View File

@ -11,23 +11,16 @@
public Symbols.File File => this.TakeFileReference();
[SectionProperty("line")]
public int LineNumber { get; private set; }
public int LineNumber => this.TakeInteger("line");
[SectionReference("type")]
public Symbols.Type Type => this.TakeTypeReference();
[SectionProperty("count")]
public int? Count { get; private set; }
public int? Count => this.MaybeTakeInteger("count");
[SectionReferences("span")]
public List<Span> Spans => this.TakeSpanReferences();
public override void Parse(IDictionary<string, string> entries)
{
base.Parse(entries);
this.LineNumber = this.TakeInteger("line");
this.Count = this.MaybeTakeInteger("count");
}
}
}
}

View File

@ -7,16 +7,10 @@
public class NamedSection : IdentifiableSection
{
[SectionProperty("name")]
public string? Name { get; private set; }
public string? Name => this.TakeString("name");
protected NamedSection(Parser container)
: base(container) { }
public override void Parse(IDictionary<string, string> entries)
{
base.Parse(entries);
this.Name = this.TakeString("name");
}
}
}
}

View File

@ -16,7 +16,7 @@
public string? Type => this.MaybeTakeString("type");
[SectionProperty("size")]
public int Size { get; private set; }
public int Size => this.TakeInteger("size");
[SectionReference("parent")]
public Scope? Parent => this.MaybeTakeParentReference();
@ -40,12 +40,6 @@
[SectionReferences("span")]
public List<Span> Spans => this.TakeSpanReferences();
public override void Parse(IDictionary<string, string> entries)
{
base.Parse(entries);
this.Size = this.TakeInteger("size");
}
}
}
}

View File

@ -8,10 +8,10 @@
public class Segment(Parser container) : NamedSection(container)
{
[SectionProperty("start", hexadecimal: true)]
public int Start { get; private set; }
public int Start => this.TakeInteger("start");
[SectionProperty("size", hexadecimal: true)]
public int Size { get; private set; }
public int Size => this.TakeInteger("size");
[SectionEnumeration("addrsize")]
public string AddressSize => this.TakeString("addrsize");
@ -23,15 +23,7 @@
public string OName => this.TakeString("oname");
[SectionProperty("ooffs")]
public int? OOFFS { get; private set; } // ?? Offsets, perhaps?
public override void Parse(IDictionary<string, string> entries)
{
base.Parse(entries);
this.Start = this.TakeInteger("start");
this.Size = this.TakeInteger("size");
this.OOFFS = this.MaybeTakeInteger("ooffs");
}
public int? OOFFS => this.MaybeTakeInteger("ooffs"); // ?? Offsets, perhaps?
}
}
}

View File

@ -11,20 +11,13 @@
public Symbols.Segment Segment => this.TakeSegmentReference();
[SectionProperty("start")]
public int Start { get; private set; }
public int Start => this.TakeInteger("start");
[SectionProperty("size")]
public int Size { get; private set; }
public int Size => this.TakeInteger("size");
[SectionReference("type")]
public Symbols.Type Type => this.TakeTypeReference();
public override void Parse(IDictionary<string, string> entries)
{
base.Parse(entries);
this.Start = this.TakeInteger("start");
this.Size = this.TakeInteger("size");
}
}
}
}

View File

@ -13,7 +13,7 @@
public string AddressSize => this.TakeString("addrsize");
[SectionProperty("size")]
public int? Size { get; private set; }
public int? Size => this.MaybeTakeInteger("size");
[SectionReference("scope")]
public Symbols.Scope Scope => this.TakeScopeReference();
@ -25,7 +25,7 @@
public List<Line> References => this.TakeLineReferences("ref"); // Guess
[SectionProperty("val", hexadecimal: true)]
public int Value { get; private set; }
public int Value => this.TakeInteger("val");
[SectionReference("seg")]
public Symbols.Segment Segment => this.TakeSegmentReference();
@ -36,10 +36,6 @@
public override void Parse(IDictionary<string, string> entries)
{
base.Parse(entries);
this.Value = this.TakeInteger("val");
this.Size = this.MaybeTakeInteger("size");
if (this.Type is "lab")
{
this._container?.AddLabel(this);