Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@ public void AddModuleTokenForType(TypeDesc type, ModuleToken token)

public int GetModuleIndex(IEcmaModule module)
{
int moduleIndex = _moduleIndexLookup(module);
if (moduleIndex != 0 && !(module is Internal.TypeSystem.Ecma.MutableModule))
{
if (!_compilationModuleGroup.VersionsWithModule((ModuleDesc)module))
{
throw new InternalCompilerErrorException("Attempt to use token from a module not within the version bubble");
}
}
return _moduleIndexLookup(module);
}

Expand All @@ -316,7 +324,7 @@ public int GetModuleIndex(IEcmaModule module)
/// </summary>
private class DummyTypeInfo
{
public static DummyTypeInfo Instance = new DummyTypeInfo();
public static DummyTypeInfo Instance = new DummyTypeInfo();
}

private class TokenResolverProvider : ISignatureTypeProvider<DummyTypeInfo, ModuleTokenResolver>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,11 @@ public SignatureContext EmitFixup(NodeFactory factory, ReadyToRunFixupKind fixup
else
{
EmitByte((byte)(fixupKind | ReadyToRunFixupKind.ModuleOverride));
if (!(targetModule is Internal.TypeSystem.Ecma.MutableModule) && !factory.CompilationModuleGroup.VersionsWithModule((ModuleDesc)targetModule))
{
throw new InternalCompilerErrorException("Attempt to use token from a module not within the version bubble");
}

EmitUInt((uint)factory.ManifestMetadataTable.ModuleToIndex(targetModule));
return new SignatureContext(targetModule, outerContext.Resolver);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public static bool Equals(MethodWithToken methodWithToken1, MethodWithToken meth
return Equals(methodWithToken1.Method, methodWithToken2.Method)
&& Equals(methodWithToken1.OwningType, methodWithToken2.OwningType)
&& Equals(methodWithToken1.ConstrainedType, methodWithToken2.ConstrainedType)
&& Equals(methodWithToken1.Token.Module, methodWithToken2.Token.Module)
&& methodWithToken1.Unboxing == methodWithToken2.Unboxing;
}

Expand All @@ -152,7 +153,8 @@ public static bool Equals(FieldWithToken field1, FieldWithToken field2)
{
return field1 == null && field2 == null;
}
return RuntimeDeterminedTypeHelper.Equals(field1.Field, field2.Field);
return RuntimeDeterminedTypeHelper.Equals(field1.Field, field2.Field) &&
Equals(field1.Token.Module, field2.Token.Module);
}

public static int GetHashCode(Instantiation instantiation)
Expand Down
Loading