From: Wolfgang (Blub) Bumiller Date: Sat, 18 Aug 2012 17:42:38 +0000 (+0200) Subject: move the member-of check for '.' to after applying the previous dot operators so... X-Git-Tag: 0.1-rc1~186 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d88e3e8f2416ddcb314a7e52391d70bbeb36c082;p=xonotic%2Fgmqcc.git move the member-of check for '.' to after applying the previous dot operators so we don't need parens around 'a.b' of 'a.b.c = x' --- diff --git a/data/functions.qc b/data/functions.qc index 241be83..7e479c1 100644 --- a/data/functions.qc +++ b/data/functions.qc @@ -22,7 +22,7 @@ void() main = { pawn2 = spawn(); pawn.other = pawn2; - (pawn.other).vis = 0; + pawn.other.vis = 0; if (!visible(pawn.other)) print("Yes\n"); diff --git a/parser.c b/parser.c index 5fb8765..3608171 100644 --- a/parser.c +++ b/parser.c @@ -1167,6 +1167,21 @@ static ast_expression* parser_expression_leave(parser_t *parser, bool stopatcomm if (op->id == opid1(',') && !parens && stopatcomma) break; + if (sy.ops_count && !sy.ops[sy.ops_count-1].paren) + olast = &operators[sy.ops[sy.ops_count-1].etype-1]; + + while (olast && ( + (op->prec < olast->prec) || + (op->assoc == ASSOC_LEFT && op->prec <= olast->prec) ) ) + { + if (!parser_sy_pop(parser, &sy)) + goto onerr; + if (sy.ops_count && !sy.ops[sy.ops_count-1].paren) + olast = &operators[sy.ops[sy.ops_count-1].etype-1]; + else + olast = NULL; + } + if (op->id == opid1('.')) { /* for gmqcc standard: open up the namespace of the previous type */ ast_expression *prevex = sy.out[sy.out_count-1].out; @@ -1185,21 +1200,6 @@ static ast_expression* parser_expression_leave(parser_t *parser, bool stopatcomm gotmemberof = true; } - if (sy.ops_count && !sy.ops[sy.ops_count-1].paren) - olast = &operators[sy.ops[sy.ops_count-1].etype-1]; - - while (olast && ( - (op->prec < olast->prec) || - (op->assoc == ASSOC_LEFT && op->prec <= olast->prec) ) ) - { - if (!parser_sy_pop(parser, &sy)) - goto onerr; - if (sy.ops_count && !sy.ops[sy.ops_count-1].paren) - olast = &operators[sy.ops[sy.ops_count-1].etype-1]; - else - olast = NULL; - } - if (op->id == opid1('(')) { if (wantop) { DEBUGSHUNTDO(printf("push (\n"));