This commit is contained in:
parent
e3ee0fed4c
commit
4f0b0f8ba0
|
|
@ -8268,7 +8268,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
|
||||
private bool EmitBox(IExpressionNode from, Type LocalType)
|
||||
{
|
||||
if ((from.type.is_value_type || from.type.is_generic_parameter) && !(from is SemanticTree.INullConstantNode) && (LocalType == TypeFactory.ObjectType || TypeIsInterface(LocalType)))
|
||||
if ((from.type.is_value_type || from.type.is_generic_parameter) && !(from is SemanticTree.INullConstantNode) && (LocalType == TypeFactory.ObjectType || TypeIsInterface(LocalType) || LocalType == TypeFactory.EnumType))
|
||||
{
|
||||
il.Emit(OpCodes.Box, helper.GetTypeReference(from.type).tp);//упаковка
|
||||
return true;
|
||||
|
|
|
|||
12
TestSuite/enum10.pas
Normal file
12
TestSuite/enum10.pas
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
type
|
||||
Days = (mon,Tue,Wed,Thi,Fri,Sat,Sun);
|
||||
|
||||
procedure MyPrint(obj: object);
|
||||
begin
|
||||
assert(obj.ToString() = 'Fri');
|
||||
end;
|
||||
begin
|
||||
var en: System.Enum;
|
||||
en := fri;
|
||||
MyPrint(en);
|
||||
end.
|
||||
Loading…
Reference in a new issue