mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[cexpr] Allow untyped result values
If the result object type pointer is null, then the parsed result type and value pointers are written directly to the result object rather than testing the parsed result type against the object type and copying the parsed result value data to the location of the object value. It is then up to the caller to check the type and copy the value data.
This commit is contained in:
parent
7e16822f21
commit
0dab26ce8f
1 changed files with 15 additions and 8 deletions
|
@ -186,7 +186,7 @@ arg_expr
|
|||
exprval_t *
|
||||
cexpr_assign_value (exprval_t *dst, const exprval_t *src, exprctx_t *context)
|
||||
{
|
||||
binop_t *binop;
|
||||
binop_t *binop = 0;
|
||||
if (!dst || !src) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -194,17 +194,24 @@ cexpr_assign_value (exprval_t *dst, const exprval_t *src, exprctx_t *context)
|
|||
*(exprval_t **) dst->value = (exprval_t *) src;
|
||||
return dst;
|
||||
}
|
||||
binop = cexpr_find_cast (dst->type, src->type);
|
||||
if (dst->type) {
|
||||
binop = cexpr_find_cast (dst->type, src->type);
|
||||
}
|
||||
if (binop && binop->op) {
|
||||
binop->func (dst, src, dst, context);
|
||||
} else {
|
||||
if (dst->type != src->type) {
|
||||
cexpr_error (context,
|
||||
"type mismatch in expression result: %s = %s",
|
||||
dst->type->name, src->type->name);
|
||||
return dst;
|
||||
if (!dst->type) {
|
||||
dst->type = src->type;
|
||||
dst->value = src->value;
|
||||
} else {
|
||||
if (dst->type != src->type) {
|
||||
cexpr_error (context,
|
||||
"type mismatch in expression result: %s = %s",
|
||||
dst->type->name, src->type->name);
|
||||
return dst;
|
||||
}
|
||||
memcpy (dst->value, src->value, dst->type->size);
|
||||
}
|
||||
memcpy (dst->value, src->value, dst->type->size);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue