mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
[qfcc] Add a function to create typed zero expressions
Sometimes, nil's untyped 0 isn't really suitable.
This commit is contained in:
parent
deb03ca27a
commit
0d639510e3
2 changed files with 16 additions and 0 deletions
|
@ -562,6 +562,15 @@ expr_t *new_args_expr (void);
|
||||||
*/
|
*/
|
||||||
expr_t *new_value_expr (ex_value_t *value);
|
expr_t *new_value_expr (ex_value_t *value);
|
||||||
|
|
||||||
|
/** Create a new typed zero value expression node.
|
||||||
|
|
||||||
|
Similar to new_nil_expr, but is 0 of a specific type.
|
||||||
|
|
||||||
|
\param type The type to use for the zero.
|
||||||
|
\return The new value expression.
|
||||||
|
*/
|
||||||
|
expr_t *new_zero_expr (struct type_s *type);
|
||||||
|
|
||||||
/** Create a new symbol expression node from a name.
|
/** Create a new symbol expression node from a name.
|
||||||
|
|
||||||
\param name The name for the symbol.
|
\param name The name for the symbol.
|
||||||
|
|
|
@ -772,6 +772,13 @@ new_value_expr (ex_value_t *value)
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expr_t *
|
||||||
|
new_zero_expr (type_t *type)
|
||||||
|
{
|
||||||
|
pr_type_t zero[type_size (type)] = {};
|
||||||
|
return new_value_expr (new_type_value (type, zero));
|
||||||
|
}
|
||||||
|
|
||||||
expr_t *
|
expr_t *
|
||||||
new_name_expr (const char *name)
|
new_name_expr (const char *name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue