SELF -> @self (looks better (IMO:)) and make sure the .self def gets

generatoed and used when @self is seen
This commit is contained in:
Bill Currie 2002-05-18 00:30:14 +00:00
parent 967d39541a
commit e11e2f3718
4 changed files with 12 additions and 1 deletions

View file

@ -134,6 +134,7 @@ expr_t *new_temp_def_expr (type_t *type);
expr_t *new_bind_expr (expr_t *e1, expr_t *e2); expr_t *new_bind_expr (expr_t *e1, expr_t *e2);
expr_t *new_name_expr (const char *name); expr_t *new_name_expr (const char *name);
expr_t *new_def_expr (def_t *def); expr_t *new_def_expr (def_t *def);
expr_t *new_self_expr (void);
void inc_users (expr_t *e); void inc_users (expr_t *e);
void convert_name (expr_t *e); void convert_name (expr_t *e);

View file

@ -468,6 +468,15 @@ new_def_expr (def_t *def)
return e; return e;
} }
expr_t *
new_self_expr (void)
{
def_t *def = PR_GetDef (&type_entity, ".self", 0, &numpr_globals);
PR_DefInitialized (def);
return new_def_expr (def);
}
expr_t * expr_t *
append_expr (expr_t *block, expr_t *e) append_expr (expr_t *block, expr_t *e)
{ {

View file

@ -262,7 +262,6 @@ static keyword_t keywords[] = {
{"enum", ENUM, 0, 0, PROG_ID_VERSION}, {"enum", ENUM, 0, 0, PROG_ID_VERSION},
{"typedef", TYPEDEF, 0, 0, PROG_ID_VERSION}, {"typedef", TYPEDEF, 0, 0, PROG_ID_VERSION},
{"super", SUPER, 0, 0, PROG_VERSION}, {"super", SUPER, 0, 0, PROG_VERSION},
{"SELF", SELF, 0, 0, PROG_VERSION},
{"@class", CLASS, 0, 0, PROG_VERSION}, {"@class", CLASS, 0, 0, PROG_VERSION},
{"@defs", DEFS, 0, 0, PROG_VERSION}, {"@defs", DEFS, 0, 0, PROG_VERSION},
@ -275,6 +274,7 @@ static keyword_t keywords[] = {
{"@protocol", PROTOCOL, 0, 0, PROG_VERSION}, {"@protocol", PROTOCOL, 0, 0, PROG_VERSION},
{"@public", PUBLIC, 0, 0, PROG_VERSION}, {"@public", PUBLIC, 0, 0, PROG_VERSION},
{"@selector", SELECTOR, 0, 0, PROG_VERSION}, {"@selector", SELECTOR, 0, 0, PROG_VERSION},
{"@self", SELF, 0, 0, PROG_VERSION},
}; };
static const char * static const char *

View file

@ -781,6 +781,7 @@ expr
| expr INCOP { $$ = incop_expr ($2, $1, 1); } | expr INCOP { $$ = incop_expr ($2, $1, 1); }
| obj_expr { $$ = $1; } | obj_expr { $$ = $1; }
| NAME { $$ = new_name_expr ($1); } | NAME { $$ = new_name_expr ($1); }
| SELF { $$ = new_self_expr (); }
| const { $$ = $1; } | const { $$ = $1; }
| '(' expr ')' { $$ = $2; $$->paren = 1; } | '(' expr ')' { $$ = $2; $$->paren = 1; }
; ;