Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Remove multi-module and auto-discovery features
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Jan 3, 2018
1 parent 132d7f5 commit eec7036
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 52 deletions.
7 changes: 0 additions & 7 deletions src/Common/src/TypeSystem/Common/TypeSystemContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ public virtual ModuleDesc ResolveAssembly(AssemblyName name, bool throwIfNotFoun
return null;
}

public virtual ModuleDesc ResolveModule(AssemblyName name, bool throwIfNotFound = true)
{
if (throwIfNotFound)
throw new NotSupportedException();
return null;
}

//
// Array types
//
Expand Down
11 changes: 0 additions & 11 deletions src/Common/src/TypeSystem/Ecma/EcmaModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ protected override IEntityHandleObject CreateValueFromKey(EntityHandle handle)
item = _module;
break;

case HandleKind.ModuleReference:
item = _module.ResolveModuleReference((ModuleReferenceHandle)handle);
break;

default:
throw new BadImageFormatException("Unknown metadata token type: " + handle.Kind);
}
Expand Down Expand Up @@ -483,13 +479,6 @@ private Object ResolveAssemblyReference(AssemblyReferenceHandle handle)
return Context.ResolveAssembly(an);
}

private Object ResolveModuleReference(ModuleReferenceHandle handle)
{
ModuleReference moduleReference = _metadataReader.GetModuleReference(handle);
string name = _metadataReader.GetString(moduleReference.Name);
return Context.ResolveModule(new AssemblyName(name));
}

private Object ResolveExportedType(ExportedTypeHandle handle)
{
ExportedType exportedType = _metadataReader.GetExportedType(handle);
Expand Down
26 changes: 0 additions & 26 deletions src/ILVerify/src/SimpleTypeSystemContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class SimpleTypeSystemContext : MetadataTypeSystemContext
// cache from simple name to EcmaModule
private readonly Dictionary<string, EcmaModule> _modules = new Dictionary<string, EcmaModule>(StringComparer.OrdinalIgnoreCase);

internal EcmaModule _inferredSystemModule;

public SimpleTypeSystemContext(IResolver resolver)
{
_resolver = resolver;
Expand All @@ -35,11 +33,6 @@ public override ModuleDesc ResolveAssembly(AssemblyName name, bool throwIfNotFou
return GetModule(name, throwIfNotFound);
}

public override ModuleDesc ResolveModule(AssemblyName name, bool throwIfNotFound = true)
{
return GetModule(name, throwIfNotFound);
}

protected override RuntimeInterfacesAlgorithm GetRuntimeInterfacesAlgorithmForNonPointerArrayType(ArrayType type)
{
if (_arrayOfTRuntimeInterfacesAlgorithm == null)
Expand Down Expand Up @@ -79,15 +72,8 @@ private EcmaModule CreateModule(AssemblyName name)
}

EcmaModule module = EcmaModule.Create(this, peReader);

MetadataReader metadataReader = module.MetadataReader;

if (this.SystemModule == null && IsSystemModule(metadataReader))
{
Debug.Assert(_inferredSystemModule is null);
_inferredSystemModule = module;
}

StringHandle nameHandle = metadataReader.IsAssembly
? metadataReader.GetAssemblyDefinition().Name
: metadataReader.GetModuleDefinition().Name;
Expand All @@ -100,17 +86,5 @@ private EcmaModule CreateModule(AssemblyName name)

return module;
}

private bool IsSystemModule(MetadataReader metadataReader)
{
if (metadataReader.AssemblyReferences.Count > 0)
{
return false;
}

// TODO check for System.Object too

return true;
}
}
}
9 changes: 1 addition & 8 deletions src/ILVerify/src/Verifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,7 @@ public VerificationResult Verify(AssemblyName moduleToVerify)
{
if (_typeSystemContext.SystemModule is null)
{
if (_typeSystemContext._inferredSystemModule != null)
{
_typeSystemContext.SetSystemModule(_typeSystemContext._inferredSystemModule);
}
else
{
throw new VerifierException("No system module specified");
}
return new VerificationResult() { NumErrors = 1, Message = "No system module specified" };
}

EcmaModule module = _typeSystemContext.GetModule(moduleToVerify);
Expand Down

0 comments on commit eec7036

Please sign in to comment.