53 const char *sa =
a.s ?
a.s :
"";
54 const char *sb =
b.s ?
b.s :
"";
55 size_t la = strlen(sa);
56 size_t lb = strlen(sb);
57 char *
buf = (
char *)malloc(la + lb + 1);
59 fprintf(stderr,
"Runtime error: out of memory during string concatenation\n");
63 memcpy(
buf + la, sb, lb);
77 fprintf(stderr,
"Runtime type error: ADD expects both numbers, both strings, or both arrays, got %s and %s\n",
78 value_type_name(
a.type), value_type_name(
b.type));
Tagged union representing a Fun value.
Value array_concat(const Value *av, const Value *bv)
Concatenate two array Values.
void free_value(Value v)
Free dynamic storage owned by a Value.
Value make_float(double v)
Construct a Value representing a double-precision float.
Value make_int(int64_t v)
Construct a Value representing a 64-bit integer.