mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/syntax: always construct a correct syntax tree
- parser creates sensible nodes in case of syntax errors instead of nil - a new BadExpr node is used in places where we can't do better - fixed error message for incorrect type switch guard - minor cleanups Fixes #19663. Change-Id: I028394c6db9cba7371f0e417ebf93f594659786a Reviewed-on: https://go-review.googlesource.com/38653 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
ecc6a81617
commit
d1f5e5f482
6 changed files with 132 additions and 85 deletions
|
|
@ -125,6 +125,12 @@ type (
|
|||
aExpr()
|
||||
}
|
||||
|
||||
// Placeholder for an expression that failed to parse
|
||||
// correctly and where we can't provide a better node.
|
||||
BadExpr struct {
|
||||
expr
|
||||
}
|
||||
|
||||
// Value
|
||||
Name struct {
|
||||
Value string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue