Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nested types inside of the <Module> type #111435

Merged
merged 2 commits into from
Jan 16, 2025
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
2 changes: 1 addition & 1 deletion src/coreclr/ildasm/dasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ mdToken ResolveReflectionNotation(BYTE* dataPtr,
if(mAsmRefs)
{
mdToken tkResScope = 0;
mdToken tk=TokenFromRid(mdtAssemblyRef,1), tkmax=TokenFromRid(mdtAssemblyRef,mAsmRefs);
mdToken tk=TokenFromRid(1, mdtAssemblyRef), tkmax=TokenFromRid(mAsmRefs, mdtAssemblyRef);
LPCSTR szAsmRefName;
// these are dummies
const void* pPKT, *pHash;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/md/compiler/filtermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "stdafx.h"
#include "filtermanager.h"

#define IsGlobalTypeDef(td) ((td) == TokenFromRid(mdtTypeDef, 1))
#define IsGlobalTypeDef(td) ((td) == COR_GLOBAL_PARENT_TOKEN)

//*****************************************************************************
// Walk up to the containing tree and
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/md/compiler/regmeta_emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ HRESULT RegMeta::_SetImplements( // S_OK or error.

i++;

IfFailGo(UpdateENCLog(TokenFromRid(mdtInterfaceImpl, iInterfaceImpl)));
IfFailGo(UpdateENCLog(TokenFromRid(iInterfaceImpl, mdtInterfaceImpl)));
}
ErrExit:

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/md/runtime/metamodelro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ CMiniMd::CommonGetCustomAttributeByNameEx(
IfFailGo(GetCustomAttributeRecord(ridStart, &pRec));
IfFailGo(getValueOfCustomAttribute(pRec, reinterpret_cast<const BYTE **>(ppData), pcbData));
if (ptkCA)
*ptkCA = TokenFromRid(mdtCustomAttribute, ridStart);
*ptkCA = TokenFromRid(ridStart, mdtCustomAttribute);
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,7 @@ HRESULT Assembly::GetDebuggingCustomAttributes(DWORD *pdwFlags)
ULONG size;
BYTE *blob;
IMDInternalImport* mdImport = GetPEAssembly()->GetMDImport();
mdAssembly asTK = TokenFromRid(mdtAssembly, 1);
mdAssembly asTK = TokenFromRid(1, mdtAssembly);

HRESULT hr = mdImport->GetCustomAttributeByName(asTK,
DEBUGGABLE_ATTRIBUTE_TYPE,
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/vm/clsload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3461,6 +3461,12 @@ VOID ClassLoader::AddAvailableClassHaveLock(
if (SUCCEEDED(pMDImport->GetNestedClassProps(classdef, &enclosing))) {
// nested type

if (enclosing == COR_GLOBAL_PARENT_TOKEN)
{
// Types nested in the <module> class can't be found by lookup.
return;
}

COUNT_T classEntryIndex = RidFromToken(enclosing) - 1;
_ASSERTE(RidFromToken(enclosing) < RidFromToken(classdef));
if (classEntries->GetCount() > classEntryIndex)
Expand Down
Loading