]> Cypherpunks repositories - gostls13.git/commit
go/ast: import AST changes supporting typeparams from dev.go2go
authorRob Findley <rfindley@google.com>
Wed, 21 Oct 2020 18:36:21 +0000 (14:36 -0400)
committerRobert Findley <rfindley@google.com>
Thu, 22 Oct 2020 17:41:44 +0000 (17:41 +0000)
commita10fe9f6e750454c9f4fcae7f86bab0c9cca43c7
treea664def85a37c3acd553b06adcb5c8c33285b156
parent7a8a720c800bb296c9f23a4c91bf2005f3221a93
go/ast: import AST changes supporting typeparams from dev.go2go

Minimal changes are made to existing types in go/ast to support type
parameters. Namely:
 + FieldList is overloaded to hold type parameter lists. In this case,
   the field name becomes the type identifier, and the field type
   becomes the constraint.
 + FuncType and TypeSpec gain a TParams FieldList.
 + CallExpr gains a 'Brackets' flag, signaling that it uses '[]' rather
   than '()', representing a generic type expression with type
   parameters.

Modifications from dev.go2go: the 'UseBrackets' field was removed from
ast.File, as this support is no longer necessary.

Change-Id: I21fd7390f1800dece3c14e6ec015fb2419e9fc52
Reviewed-on: https://go-review.googlesource.com/c/go/+/264181
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
src/go/ast/ast.go
src/go/ast/example_test.go
src/go/ast/walk.go