Add object and string concatenation

Fixes #232
This commit is contained in:
Alexander Batalov 2023-02-10 09:27:10 +03:00
parent 33141672ed
commit c14f671a0d
1 changed files with 15 additions and 0 deletions

View File

@ -1491,6 +1491,21 @@ static void opAdd(Program* program)
break;
}
break;
// Sonora folks use "object + string" concatenation for debug purposes.
case VALUE_TYPE_PTR:
switch (value[0].opcode) {
case VALUE_TYPE_STRING:
case VALUE_TYPE_DYNAMIC_STRING:
strings[0] = programGetString(program, value[0].opcode, value[0].integerValue);
tempString = (char*)internal_malloc_safe(strlen(strings[0]) + 80, __FILE__, __LINE__);
snprintf(tempString, strlen(strings[0]) + 80, "%p", value[1].pointerValue);
strcat(tempString, strings[0]);
programStackPushString(program, tempString);
internal_free_safe(tempString, __FILE__, __LINE__);
break;
}
}
}