widl: Remove EXPR_MEMBERPTR and implement it using EXPR_PPTR and EXPR_MEMBER instead.
This commit is contained in:
parent
cc3682cf12
commit
95ac84e20b
|
@ -539,8 +539,6 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
|
|||
case EXPR_SUB:
|
||||
case EXPR_AND:
|
||||
case EXPR_OR:
|
||||
case EXPR_MEMBERPTR:
|
||||
case EXPR_MEMBER:
|
||||
case EXPR_LOGOR:
|
||||
case EXPR_LOGAND:
|
||||
case EXPR_XOR:
|
||||
|
@ -562,8 +560,6 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
|
|||
case EXPR_SUB: fprintf(h, " - "); break;
|
||||
case EXPR_AND: fprintf(h, " & "); break;
|
||||
case EXPR_OR: fprintf(h, " | "); break;
|
||||
case EXPR_MEMBERPTR: fprintf(h, "->"); break;
|
||||
case EXPR_MEMBER: fprintf(h, "."); break;
|
||||
case EXPR_LOGOR: fprintf(h, " || "); break;
|
||||
case EXPR_LOGAND: fprintf(h, " && "); break;
|
||||
case EXPR_XOR: fprintf(h, " ^ "); break;
|
||||
|
@ -578,6 +574,21 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
|
|||
write_expr(h, e->u.ext, 1);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_MEMBER:
|
||||
if (brackets) fprintf(h, "(");
|
||||
if (e->ref->type == EXPR_PPTR)
|
||||
{
|
||||
write_expr(h, e->ref->ref, 1);
|
||||
fprintf(h, "->");
|
||||
}
|
||||
else
|
||||
{
|
||||
write_expr(h, e->ref, 1);
|
||||
fprintf(h, ".");
|
||||
}
|
||||
write_expr(h, e->u.ext, 1);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_COND:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_expr(h, e->ref, 1);
|
||||
|
|
|
@ -657,8 +657,8 @@ expr: aNUM { $$ = make_exprl(EXPR_NUM, $1); }
|
|||
| '-' expr %prec NEG { $$ = make_expr1(EXPR_NEG, $2); }
|
||||
| '&' expr %prec ADDRESSOF { $$ = make_expr1(EXPR_ADDRESSOF, $2); }
|
||||
| '*' expr %prec PPTR { $$ = make_expr1(EXPR_PPTR, $2); }
|
||||
| expr MEMBERPTR expr { $$ = make_expr2(EXPR_MEMBERPTR, $1, $3); }
|
||||
| expr '.' expr { $$ = make_expr2(EXPR_MEMBER, $1, $3); }
|
||||
| expr MEMBERPTR aIDENTIFIER { $$ = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, $1), make_exprs(EXPR_IDENTIFIER, $3)); }
|
||||
| expr '.' aIDENTIFIER { $$ = make_expr2(EXPR_MEMBER, $1, make_exprs(EXPR_IDENTIFIER, $3)); }
|
||||
| '(' type ')' expr %prec CAST { $$ = make_exprt(EXPR_CAST, $2, $4); }
|
||||
| tSIZEOF '(' type ')' { $$ = make_exprt(EXPR_SIZEOF, $3, NULL); }
|
||||
| expr '[' expr ']' { $$ = make_expr2(EXPR_ARRAY, $1, $3); }
|
||||
|
|
|
@ -357,7 +357,6 @@ static int compare_expr(const expr_t *a, const expr_t *b)
|
|||
case EXPR_DIV:
|
||||
case EXPR_SHL:
|
||||
case EXPR_SHR:
|
||||
case EXPR_MEMBERPTR:
|
||||
case EXPR_MEMBER:
|
||||
case EXPR_ARRAY:
|
||||
case EXPR_LOGOR:
|
||||
|
@ -3179,8 +3178,6 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
|
|||
case EXPR_SUB:
|
||||
case EXPR_AND:
|
||||
case EXPR_OR:
|
||||
case EXPR_MEMBERPTR:
|
||||
case EXPR_MEMBER:
|
||||
case EXPR_LOGOR:
|
||||
case EXPR_LOGAND:
|
||||
case EXPR_XOR:
|
||||
|
@ -3202,7 +3199,6 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
|
|||
case EXPR_SUB: fprintf(h, " - "); break;
|
||||
case EXPR_AND: fprintf(h, " & "); break;
|
||||
case EXPR_OR: fprintf(h, " | "); break;
|
||||
case EXPR_MEMBERPTR: fprintf(h, "->"); break;
|
||||
case EXPR_MEMBER: fprintf(h, "."); break;
|
||||
case EXPR_LOGOR: fprintf(h, " || "); break;
|
||||
case EXPR_LOGAND: fprintf(h, " && "); break;
|
||||
|
@ -3218,6 +3214,21 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
|
|||
write_struct_expr(h, e->u.ext, 1, fields, structvar);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_MEMBER:
|
||||
if (brackets) fprintf(h, "(");
|
||||
if (e->ref->type == EXPR_PPTR)
|
||||
{
|
||||
write_expr(h, e->ref->ref, 1);
|
||||
fprintf(h, "->");
|
||||
}
|
||||
else
|
||||
{
|
||||
write_expr(h, e->ref, 1);
|
||||
fprintf(h, ".");
|
||||
}
|
||||
write_expr(h, e->u.ext, 1);
|
||||
if (brackets) fprintf(h, ")");
|
||||
break;
|
||||
case EXPR_COND:
|
||||
if (brackets) fprintf(h, "(");
|
||||
write_struct_expr(h, e->ref, 1, fields, structvar);
|
||||
|
|
|
@ -161,7 +161,6 @@ enum expr_type
|
|||
EXPR_COND,
|
||||
EXPR_TRUEFALSE,
|
||||
EXPR_ADDRESSOF,
|
||||
EXPR_MEMBERPTR,
|
||||
EXPR_MEMBER,
|
||||
EXPR_ARRAY,
|
||||
EXPR_MOD,
|
||||
|
|
Loading…
Reference in New Issue