Support for handling null when creating evalvalues

This commit is contained in:
Deukhoofd 2019-08-25 12:41:37 +02:00
parent 29b2df793d
commit cb1273b92e
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,8 @@ namespace PorygonSharp.EvalValues
{
public static EvalValue CreateValue(object o)
{
if (o == null)
return new EvalValue(CreateNilEvalValue());
var type = o.GetType();
if (type.IsEnum && !type.IsGenericParameter)
{
@ -64,6 +66,8 @@ namespace PorygonSharp.EvalValues
return new EvalValue(ptr);
}
[DllImport("libPorygonLang", EntryPoint = "CreateNilEvalValue",CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr CreateNilEvalValue();
[DllImport("libPorygonLang", EntryPoint = "CreateIntegerEvalValue",CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr CreateIntegerEvalValue(long l);
[DllImport("libPorygonLang", EntryPoint = "CreateFloatEvalValue",CallingConvention = CallingConvention.Cdecl)]

Binary file not shown.