]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/syntax: provide BadExpr where needed, call correct error handler
authorRobert Griesemer <gri@golang.org>
Sat, 10 Oct 2020 00:42:41 +0000 (17:42 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 12 Oct 2020 18:01:22 +0000 (18:01 +0000)
commite0cb80e4d10bb9967d70ff1a0d7e66c9d8af21cf
treeeedf02e0d50f0c8a6bf9f092311bf0a38d7fc674
parentaeae46a7e51921b6af1dc1400bdc341fc1e568b0
cmd/compile/internal/syntax: provide BadExpr where needed, call correct error handler

- For "if" statements without a condition, provide a BadExpr rather than nil
  (clients expect IfStmt.Cond != nil since the parser is taking care of
  reporting a missing condition).

- For 3-index slice expressions, also provide BadExpr where an index is
  required but missing.

- Declare a parser-local error method to hide the embedded error method
  so we don't use it by mistake.

Accidentally found while adjusting prototype parser to work for generics.

Change-Id: Iacc211cc60869be05efe9ae630d65dff1dac00a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/261218
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/syntax/parser.go