diff options
author | Robert Griesemer <gri@golang.org> | 2017-03-24 16:23:21 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2017-03-25 21:01:49 +0000 |
commit | d1f5e5f48249c120c9eed301ed07d546c5c65698 (patch) | |
tree | b7624e0df40b2338e2f7484fdc37902682759f5f /src/cmd/compile/internal/syntax/nodes.go | |
parent | ecc6a81617477ddfa961f44e309707a4f864104a (diff) | |
download | go-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.go | 6 |
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 |