Repository: dotnet/runtime
File: src/coreclr/vm/callstubgenerator.cpp (C++)

Code before:

    return strcmp(typeName, "CLong") == 0 || strcmp(typeName, "CULong") == 0 || strcmp(typeName, "NFloat") == 0;
}

void CallStubGenerator::ComputeCallStub(MetaSig &sig, PCODE *pRoutines, MethodDesc *pMD)
{
    bool rewriteMetaSigFromExplicitThisToHasThis = false;
    bool unmanagedThisCallConv = false;

    bool hasUnmanagedCallConv = false;
    CorInfoCallConvExtension unmanagedCallConv = CorInfoCallConvExtension::C;

    if (pMD != NULL && (pMD->IsPInvoke()))
    {
        PInvoke::GetCallingConvention_IgnoreErrors(pMD, &unmanagedCallConv, NULL);
        hasUnmanagedCallConv = true;
    }
    else if (pMD != NULL && pMD->HasUnmanagedCallersOnlyAttribute())
    {
        if (CallConv::TryGetCallingConventionFromUnmanagedCallersOnly(pMD, &unmanagedCallConv))
        {
            if (sig.GetCallingConvention() == IMAGE_CEE_CS_CALLCONV_VARARG)
            {
                unmanagedCallConv = CorInfoCallConvExtension::C;
            }
            unmanagedCallConv = unmanagedCallConv;
        }
        else
        {
            unmanagedCallConv = CallConv::GetDefaultUnmanagedCallingConvention();
        }
        hasUnmanagedCallConv = true;
    }
    else
    {
        switch (sig.GetCallingConvention())
        {
            case IMAGE_CEE_CS_CALLCONV_THISCALL:
                unmanagedCallConv = CorInfoCallConvExtension::Thiscall;
                hasUnmanagedCallConv = true;
                break;
            case IMAGE_CEE_CS_CALLCONV_UNMANAGED:
                unmanagedCallConv = GetUnmanagedCallConvExtension(&sig);
                hasUnmanagedCallConv = true;
                break;
        }
    }

    if (hasUnmanagedCallConv)
    {
        switch (unmanagedCallConv)

Review comment (refactor):
This assignment is redundant as 'unmanagedCallConv' is being assigned to itself. This appears to be a logic error or leftover from refactoring. Either remove this line or assign the intended value.
```suggestion

```

Code after:

    return strcmp(typeName, "CLong") == 0 || strcmp(typeName, "CULong") == 0 || strcmp(typeName, "NFloat") == 0;
}

void CallStubGenerator::ComputeCallStub(MetaSig &sig, PCODE *pRoutines, MethodDesc *pMD)
{
    bool rewriteMetaSigFromExplicitThisToHasThis = false;
    bool unmanagedThisCallConv = false;

    bool hasUnmanagedCallConv = false;
    CorInfoCallConvExtension unmanagedCallConv = CorInfoCallConvExtension::C;

    if (pMD != NULL && (pMD->IsPInvoke()))
    {
        PInvoke::GetCallingConvention_IgnoreErrors(pMD, &unmanagedCallConv, NULL);
        hasUnmanagedCallConv = true;
    }
    else if (pMD != NULL && pMD->HasUnmanagedCallersOnlyAttribute())
    {
        if (CallConv::TryGetCallingConventionFromUnmanagedCallersOnly(pMD, &unmanagedCallConv))
        {
            if (sig.GetCallingConvention() == IMAGE_CEE_CS_CALLCONV_VARARG)
            {
                unmanagedCallConv = CorInfoCallConvExtension::C;
            }
        }
        else
        {
            unmanagedCallConv = CallConv::GetDefaultUnmanagedCallingConvention();
        }
        hasUnmanagedCallConv = true;
    }
    else
    {
        switch (sig.GetCallingConvention())
        {
            case IMAGE_CEE_CS_CALLCONV_THISCALL:
                unmanagedCallConv = CorInfoCallConvExtension::Thiscall;
                hasUnmanagedCallConv = true;
                break;
            case IMAGE_CEE_CS_CALLCONV_UNMANAGED:
                unmanagedCallConv = GetUnmanagedCallConvExtension(&sig);
                hasUnmanagedCallConv = true;
                break;
        }
    }

    if (hasUnmanagedCallConv)
    {
        switch (unmanagedCallConv)
        {