aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/nodes.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2017-03-24 16:23:21 -0700
committerRobert Griesemer <gri@golang.org>2017-03-25 21:01:49 +0000
commitd1f5e5f48249c120c9eed301ed07d546c5c65698 (patch)
treeb7624e0df40b2338e2f7484fdc37902682759f5f /src/cmd/compile/internal/syntax/nodes.go
parentecc6a81617477ddfa961f44e309707a4f864104a (diff)
downloadgo-d1f5e5f48249c120c9eed301ed07d546c5c65698.tar.gz
go-d1f5e5f48249c120c9eed301ed07d546c5c65698.zip
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>
Diffstat (limited to 'src/cmd/compile/internal/syntax/nodes.go')
-rw-r--r--src/cmd/compile/internal/syntax/nodes.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/nodes.go b/src/cmd/compile/internal/syntax/nodes.go
index 4fb50b1f4a..ac9cc67451 100644
--- a/src/cmd/compile/internal/syntax/nodes.go
+++ b/src/cmd/compile/internal/syntax/nodes.go
@@ -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