ILSpy Plugin corrections/enhancements
Posted: Thu Apr 21, 2022 10:27 am
Fabrice,
Thanks for the updates.
The ILSpy 7 version has a small problem.
See the decompiled code for an operator in the __Usual Type
This code disassembles to a SWITCH expression, which we do not support (yet) in X#.
If I disable the C# 8 Switch Expression support then it is decompiled into the correct code:
Robert
Thanks for the updates.
The ILSpy 7 version has a small problem.
See the decompiled code for an operator in the __Usual Type
Code: Select all
/// <summary>This operator is used in code generated by the compiler when needed.</summary>
[DebuggerStepThrough];
PUBLIC STATIC OPERATOR IMPLICIT(u AS __Usual ) AS Logic
IF (u:IsNull) .OR. (!u:_initialized)
RETURN false
ENDIF
RETURN u:_usualType SWITCH__UsualType.Logic => u:_logicValue,
__UsualType.Long => u:_intValue != 0,
__UsualType.Int64 => u:_i64Value != 0,
__UsualType.Currency => u:_currencyValue != 0,
__UsualType.Decimal => u:_decimalValue != 0m,
_ => THROW __Usual.ConversionError(8u, TYPEOF(Logic), u),
END OPERATOR
If I disable the C# 8 Switch Expression support then it is decompiled into the correct code:
Code: Select all
/// <summary>This operator is used in code generated by the compiler when needed.</summary>
[DebuggerStepThrough];
PUBLIC STATIC OPERATOR IMPLICIT(u AS __Usual ) AS Logic
IF (u:IsNull) .OR. (!u:_initialized)
RETURN false
ENDIF
SWITCH u:_usualType
CASE __UsualType.Logic
RETURN u:_logicValue
CASE __UsualType.Long
RETURN u:_intValue != 0
CASE __UsualType.Int64
RETURN u:_i64Value != 0
CASE __UsualType.Currency
RETURN u:_currencyValue != 0
CASE __UsualType.Decimal
RETURN u:_decimalValue != 0m
OTHERWISE
THROW __Usual.ConversionError(8u, TYPEOF(Logic), u)
END SWITCH
END OPERATOR
Robert