More expression docs.

This commit is contained in:
Bill Currie 2011-01-03 16:19:05 +09:00
parent 5627e43465
commit 02f78e46f8
2 changed files with 22 additions and 5 deletions

View file

@ -487,14 +487,14 @@ expr_t *new_bind_expr (expr_t *e1, expr_t *e2);
/** Create a reference to the global <code>.self</code> entity variable.
This is used for <code>@self</code>.
This is used for <code>\@self</code>.
\return A new expression referencing the <code>.self</code> def.
*/
expr_t *new_self_expr (void);
/** Create a reference to the <code>.this</code> entity field.
This is used for <code>@this</code>.
This is used for <code>\@this</code>.
\return A new expression referencing the <code>.this</code> def.
*/
expr_t *new_this_expr (void);
@ -547,6 +547,14 @@ void inc_users (expr_t *e);
decremented.
*/
void dec_users (expr_t *e);
/** Convert a name to an expression of the appropriate type.
Converts the expression in-place. If the exprssion is not a name
expression (ex_name), no converision takes place.
\param e The expression to convert.
*/
void convert_name (expr_t *e);
expr_t *append_expr (expr_t *block, expr_t *e);
@ -584,9 +592,12 @@ expr_t *cast_expr (struct type_s *t, expr_t *e);
void init_elements (struct def_s *def, expr_t *eles);
expr_t *error (expr_t *e, const char *fmt, ...) __attribute__((format(printf, 2,3)));
expr_t *warning (expr_t *e, const char *fmt, ...) __attribute__((format(printf, 2,3)));
expr_t *notice (expr_t *e, const char *fmt, ...) __attribute__((format(printf, 2,3)));
expr_t *error (expr_t *e, const char *fmt, ...)
__attribute__((format(printf, 2,3)));
expr_t *warning (expr_t *e, const char *fmt, ...)
__attribute__((format(printf, 2,3)));
expr_t *notice (expr_t *e, const char *fmt, ...)
__attribute__((format(printf, 2,3)));
const char *get_op_string (int op);

View file

@ -141,16 +141,20 @@ convert_name (expr_t *e)
expr_t *new;
class_t *class;
/// Convert name to enum (integer constant).
new = get_enum (name);
if (new)
goto convert;
/// Convert name to class.
class = get_class (name, 0);
if (class) {
e->type = ex_def;
e->e.def = class_pointer_def (class);
return;
}
/// Convert name to def.
d = get_def (NULL, name, current_scope, st_none);
if (d) {
if (d->global) {
@ -162,6 +166,8 @@ convert_name (expr_t *e)
e->e.def = d;
return;
}
/// Convert name to a class ivar in a message body.
new = class_ivar_expr (current_class, name);
if (new)
goto convert;