[PATCH] Pass pratt parsed token to expr parser functions to fix expr locus

Mark Wielaard mark@klomp.org
Thu Jul 29 10:55:38 GMT 2021


Hi Joel,

On Thu, 2021-07-29 at 09:25 +0800, The Other via Gcc-rust wrote:
> I think the core idea of this patch (fixing locations) is very
> important and useful.
> 
> But isn’t it overkill to pass the token in instead of just the
> location? You can avoid a fairly expensive shared_ptr copy by doing
> so. 

I hadn't even noticed it was a smart pointer. At least the abstraction
works transparently. My idea was that the code might want to double
check/assert it was the correct token (as it does in the case the
parser function is called directly and it has to consume the first
token itself).

But yes, things might be even simpler by passing the location directly.
I'll try to rewrite the code tonight to pass a location and see how
that looks.

Thanks,

Mark


More information about the Gcc-rust mailing list