Add new_value_expr().

This simplifies creating a new expression for an arbitrary value object.
This commit is contained in:
Bill Currie 2012-12-23 19:29:50 +09:00
parent 42ba0c9d54
commit b295524385
2 changed files with 16 additions and 0 deletions

View file

@ -356,6 +356,13 @@ expr_t *new_temp_def_expr (struct type_s *type);
*/
expr_t *new_nil_expr (void);
/** Create a new value expression node.
\param value The value to put in the expression node.
\return The new value expression.
*/
expr_t *new_value_expr (ex_value_t *value);
/** Create a new symbol expression node from a name.
\param name The name for the symbol.

View file

@ -496,6 +496,15 @@ new_nil_expr (void)
return e;
}
expr_t *
new_value_expr (ex_value_t *value)
{
expr_t *e = new_expr ();
e->type = ex_value;
e->e.value = value;
return e;
}
expr_t *
new_name_expr (const char *name)
{