Skip to content

Instantly share code, notes, and snippets.

@vargaz
Created December 9, 2021 03:02
Show Gist options
  • Save vargaz/4bfce768ed19d283ddc31be124cc82a9 to your computer and use it in GitHub Desktop.
Save vargaz/4bfce768ed19d283ddc31be124cc82a9 to your computer and use it in GitHub Desktop.
diff --git a/src/mono/mono/metadata/sre-encode.c b/src/mono/mono/metadata/sre-encode.c
index 450b6f37d72..92a6376dba7 100644
--- a/src/mono/mono/metadata/sre-encode.c
+++ b/src/mono/mono/metadata/sre-encode.c
@@ -422,7 +422,7 @@ mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *
HANDLE_FUNCTION_ENTER ();
MonoDynamicTable *table;
- guint32 token, enclosing;
+ guint32 token;
MonoClass *klass;
/* if the type requires a typespec, we must try that first*/
@@ -446,11 +446,8 @@ mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *
goto leave;
}
- if (m_class_get_nested_in (klass)) {
- enclosing = mono_dynimage_encode_typedef_or_ref_full (assembly, m_class_get_byval_arg (m_class_get_nested_in (klass)), FALSE);
- /* get the typeref idx of the enclosing type */
- enclosing >>= MONO_TYPEDEFORREF_BITS;
- }
+ if (m_class_get_nested_in (klass))
+ mono_dynimage_encode_typedef_or_ref_full (assembly, m_class_get_byval_arg (m_class_get_nested_in (klass)), FALSE);
table = &assembly->tables [MONO_TABLE_TYPEREF];
token = MONO_TYPEDEFORREF_TYPEREF | (table->next_idx << MONO_TYPEDEFORREF_BITS); /* typeref */
g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment