提交 e99734f9 编写于 作者: J Jared Parsons

Minor updates

上级 9f437a83
......@@ -333,7 +333,6 @@ CompilationTestData testData
{
var mainImage = mainOutput.Value.Assembly;
var mainPdb = mainOutput.Value.Pdb;
var emitData = new EmitData();
_emitData.MainModule = new ModuleData(
mainCompilation.Assembly.Identity,
mainCompilation.Options.OutputKind,
......@@ -342,8 +341,8 @@ CompilationTestData testData
inMemoryModule: true);
_emitData.MainModulePdb = mainPdb;
_emitData.AllModuleData = dependencies;
_emitData.AllModuleData.Insert(0, emitData.MainModule);
CreateAssemblyManager(_emitData, dependencies, emitData.MainModule);
_emitData.AllModuleData.Insert(0, _emitData.MainModule);
CreateAssemblyManager(_emitData, dependencies, _emitData.MainModule);
}
else
{
......
......@@ -125,10 +125,12 @@ public void AddModuleData(IEnumerable<ModuleData> modules)
{
foreach (var module in modules)
{
// If the module is already added then nothing else to do
ModuleData other;
if (_fullNameToModuleDataMap.TryGetValue(module.FullName, out other))
bool fullMatch;
if (TryGetMatchingByFullName(module.Id, out other, out fullMatch))
{
if (!_preloadedSet.Contains(module.SimpleName) && other.Mvid != module.Mvid)
if (!fullMatch)
{
throw new Exception($"Two modules of name {other.FullName} have different MVID");
}
......@@ -146,6 +148,38 @@ public void AddModuleData(IEnumerable<ModuleData> modules)
}
}
/// <summary>
/// Return the subset of IDs passed in which are not currently tracked by this instance.
/// </summary>
public List<ModuleDataId> GetMissing(IEnumerable<ModuleDataId> moduleIds)
{
var list = new List<ModuleDataId>();
foreach (var id in moduleIds)
{
ModuleData other;
bool fullMatch;
if (!TryGetMatchingByFullName(id, out other, out fullMatch) || !fullMatch)
{
list.Add(id);
}
}
return list;
}
private bool TryGetMatchingByFullName(ModuleDataId id, out ModuleData moduleData, out bool fullMatch)
{
if (_fullNameToModuleDataMap.TryGetValue(id.FullName, out moduleData))
{
fullMatch = _preloadedSet.Contains(id.SimpleName) || id.Mvid == moduleData.Mvid;
return true;
}
moduleData = null;
fullMatch = false;
return false;
}
private ImmutableArray<byte> GetModuleBytesByName(string moduleName)
{
ModuleData data;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册