[gccgo] Change location of cast

Message ID mcrmxs16kod.fsf@google.com
State New
Headers show

Commit Message

Ian Taylor Sept. 2, 2010, 12:41 a.m.
This small gccgo patch changes the location of a cast T(v) from the
start of the type to the left parenthesis.  This is mainly for
convenience of the testsuite, and should be just as good if not better
for humans.

Ian

Patch

diff -r 21b3034688ff go/parse.cc
--- a/go/parse.cc	Wed Sep 01 17:38:32 2010 -0700
+++ b/go/parse.cc	Wed Sep 01 17:39:58 2010 -0700
@@ -2503,6 +2503,7 @@ 
 	ret = this->composite_lit(ret->type(), ret->location());
       else if (this->peek_token()->is_op(OPERATOR_LPAREN))
 	{
+	  source_location loc = this->location();
 	  this->advance_token();
 	  Expression* expr = this->expression(PRECEDENCE_NORMAL, false, true,
 					      NULL);
@@ -2512,7 +2513,7 @@ 
 	    this->advance_token();
 	  if (expr->is_error_expression())
 	    return expr;
-	  ret = Expression::make_cast(ret->type(), expr, ret->location());
+	  ret = Expression::make_cast(ret->type(), expr, loc);
 	}
     }