]> Cypherpunks.ru repositories - gostls13.git/commit
go/parser: add a SkipObjectResolution mode to bypass object resolution
authorRob Findley <rfindley@google.com>
Mon, 29 Mar 2021 20:03:51 +0000 (16:03 -0400)
committerRobert Findley <rfindley@google.com>
Fri, 16 Apr 2021 21:20:31 +0000 (21:20 +0000)
commit02a2ff47ef6004a59e4d688c7c93198778c36bcf
treeb6b535aba3f09bb6e8bbb69af8dd7ea9811dba4a
parentb91f8a4c0b0b9be44b24b445cbf2955050a55b69
go/parser: add a SkipObjectResolution mode to bypass object resolution

Parser object resolution is an auxiliary feature in which the parser
attempts to resolve identifiers to their declarations. In functionality,
it significantly overlaps with go/types and in fact cannot be correctly
computed at parse-time without type information (for example, it is
generally not possible to resolve k in the composite lit c{k: v}). Due
to these limitations, it is of limited utility and rarely used.

Now that object resolution is isolated as a post-processing pass, it is
trivial to offer a parser mode that skips it entirely. This CL adds that
mode.

Fixes #45104

Change-Id: I5a2c05437e298964ad2039e1ff98e63d6efbd1af
Reviewed-on: https://go-review.googlesource.com/c/go/+/306149
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/parser/interface.go
src/go/parser/parser.go