Support for handling null when creating evalvalues
This commit is contained in:
parent
29b2df793d
commit
cb1273b92e
|
@ -10,6 +10,8 @@ namespace PorygonSharp.EvalValues
|
||||||
{
|
{
|
||||||
public static EvalValue CreateValue(object o)
|
public static EvalValue CreateValue(object o)
|
||||||
{
|
{
|
||||||
|
if (o == null)
|
||||||
|
return new EvalValue(CreateNilEvalValue());
|
||||||
var type = o.GetType();
|
var type = o.GetType();
|
||||||
if (type.IsEnum && !type.IsGenericParameter)
|
if (type.IsEnum && !type.IsGenericParameter)
|
||||||
{
|
{
|
||||||
|
@ -64,6 +66,8 @@ namespace PorygonSharp.EvalValues
|
||||||
return new EvalValue(ptr);
|
return new EvalValue(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport("libPorygonLang", EntryPoint = "CreateNilEvalValue",CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern IntPtr CreateNilEvalValue();
|
||||||
[DllImport("libPorygonLang", EntryPoint = "CreateIntegerEvalValue",CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("libPorygonLang", EntryPoint = "CreateIntegerEvalValue",CallingConvention = CallingConvention.Cdecl)]
|
||||||
internal static extern IntPtr CreateIntegerEvalValue(long l);
|
internal static extern IntPtr CreateIntegerEvalValue(long l);
|
||||||
[DllImport("libPorygonLang", EntryPoint = "CreateFloatEvalValue",CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("libPorygonLang", EntryPoint = "CreateFloatEvalValue",CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue