Skip to content

Commit

Permalink
runtime conversion of enum type to PhpValue
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmisek committed Sep 8, 2020
1 parent e848e2b commit 08476e2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Peachpie.Runtime/Dynamic/ConvertExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,12 @@ public static Expression BindToValue(Expression expr)
if (source == typeof(uint)) return Expression.Call(typeof(PhpValue).GetMethod("Create", Cache.Types.Long), Expression.Convert(expr, typeof(long)));
if (source == typeof(ulong)) return Expression.Call(typeof(PhpValue).GetMethod("Create", Cache.Types.UInt64), expr);

if (source.IsEnum)
{
// (PhpValue)(int)enum
return BindToValue(Expression.Convert(expr, source.GetEnumUnderlyingType()));
}

throw new NotImplementedException(source.FullName);
}
else if (
Expand Down

0 comments on commit 08476e2

Please sign in to comment.