Skip to content

Commit c1efb32

Browse files
committed
Fix locals initialization with generic instance
- Now the generic type is instanciated. Not using the TypeSpec anymore.
1 parent 00cc119 commit c1efb32

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/CLR/Core/Execution.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,10 +1963,17 @@ HRESULT CLR_RT_ExecutionEngine::InitializeLocals(
19631963
// otherwise the comparison won't be possible
19641964
sig--;
19651965

1966-
if (!assembly->FindTypeSpec(sig, typeSpecIndex))
1967-
{
1968-
NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
1969-
}
1966+
// Parse the TypeSpec signature to get the instantiated element
1967+
CLR_RT_SignatureParser sp;
1968+
sp.Initialize_TypeSpec(assembly, sig);
1969+
1970+
CLR_RT_SignatureParser::Element element;
1971+
NANOCLR_CHECK_HRESULT(sp.Advance(element));
1972+
1973+
// element.Class and element.DataType represent the T
1974+
cls = element.Class;
1975+
dt = element.DataType;
1976+
19701977
goto done;
19711978

19721979
case DATATYPE_VAR:

0 commit comments

Comments
 (0)