Fix compilation of variant values borrowings and NULL values conversions.

[GB.JIT]
* BUG: Fix compilation of variant values borrowings.
* BUG: Fix NULL values conversions.
This commit is contained in:
gambas 2018-08-10 13:53:20 +02:00
parent 5df6553247
commit 3966bfbca7
2 changed files with 13 additions and 2 deletions

View file

@ -226,7 +226,7 @@ enum
#define BORROW_s(_val) ({ GB_STRING _v = (_val); if ((_v).type == GB_T_STRING) GB.RefString(_v.value.addr); _v; })
#define BORROW_o(_val) ({ GB_OBJECT _v = (_val); GB.Ref(_v.value); _v; })
#define BORROW_v(_val) ({ GB_VARIANT _v = (_val); GB.BorrowValue(&_v); _v; })
#define BORROW_v(_val) ({ GB_VARIANT _v = (_val); GB.BorrowValue((GB_VALUE *)&_v); _v; })
#define RELEASE_s(_val) ({ GB_STRING _v = (_val); if ((_v).type == GB_T_STRING) GB.FreeString(&_v.value.addr); _v; })
#define RELEASE_o(_val) ({ GB_OBJECT _v = (_val); GB.Unref(&_v.value); _v; })
@ -390,6 +390,11 @@ enum
#define CONV_o_O(_val, _class) CONV(_val, o, o, CLASS(_class))
#define GET_NULL_o() ({ GB_OBJECT temp; temp.type = GB_T_OBJECT; temp.value = NULL; temp; })
#define GET_NULL_v() ({ GB_VARIANT temp; temp.type = GB_T_VARIANT; temp.value.type = GB_T_NULL; temp; })
#define GET_NULL_s() GET_CSTRING("", 0, 0)
#define GET_NULL_d() ({ GB_DATE temp; temp.type = GB_T_DATE; temp.value.date = 0; temp.value.time = 0; temp; })
#define PUSH_GOSUB(_label) ({ \
GB_VALUE_GOSUB *_p = (GB_VALUE_GOSUB *)sp; \
_p->type = GB_T_VOID; \

View file

@ -485,7 +485,13 @@ static char *get_conv_format(TYPE src, TYPE dest)
if (src == T_NULL)
{
if (dest == T_OBJECT)
return "GET_OBJECT(NULL, GB_T_OBJECT)";
return "GET_NULL_o()";
else if (dest == T_VARIANT)
return "GET_NULL_v()";
else if (dest == T_DATE)
return "GET_NULL_d()";
else if (dest == T_STRING || dest == T_CSTRING)
return "GET_NULL_s()";
else
{
sprintf(buffer, "GET_OBJECT(NULL, CLASS(%p))", (CLASS *)dest);