diff options
author | jfrijters <jfrijters> | 2010-06-18 10:57:18 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2010-06-18 10:57:18 +0400 |
commit | 236e6bb12e360c272694d2dedd861ea7ed5240df (patch) | |
tree | 6946eea37f64c5554f1a0f9fb72938e7bdbba88d /reflect/Metadata | |
parent | fc0251533f4fbb83a77812739285eaeadf366575 (diff) |
Since referenced assembly identities can change (if they're an AssemblyBuilder), we have to postpone creating an AssemblyRef record until save time.
Note that we also take into account the possibility of having multiple assemblies with the same identity and collapse those into a single record. This is to support circular ref scenarios where you load a previous version of an assembly while generating a newer version (with the same identity). A future patch will enable this.
Diffstat (limited to 'reflect/Metadata')
-rw-r--r-- | reflect/Metadata/Tables.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/reflect/Metadata/Tables.cs b/reflect/Metadata/Tables.cs index b6ba2586..c1977b19 100644 --- a/reflect/Metadata/Tables.cs +++ b/reflect/Metadata/Tables.cs @@ -1991,6 +1991,27 @@ namespace IKVM.Reflection.Metadata internal int HashValue; } + internal int FindOrAddRecord(Record rec) + { + for (int i = 0; i < rowCount; i++) + { + if (records[i].Name == rec.Name + && records[i].MajorVersion == rec.MajorVersion + && records[i].MinorVersion == rec.MinorVersion + && records[i].BuildNumber == rec.BuildNumber + && records[i].RevisionNumber == rec.RevisionNumber + && records[i].Flags == rec.Flags + && records[i].PublicKeyOrToken == rec.PublicKeyOrToken + && records[i].Culture == rec.Culture + && records[i].HashValue == rec.HashValue + ) + { + return i + 1; + } + } + return AddRecord(rec); + } + internal override void Read(MetadataReader mr) { for (int i = 0; i < records.Length; i++) |