Commit b5e1ae46 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: don't crash when reporting some syntax errors

Fixes #19667.

Change-Id: Iaa71e2020af123c1bd3ac25e0b760956688e8bdf
Reviewed-on: https://go-review.googlesource.com/38458
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 2ae79d07
......@@ -341,6 +341,9 @@ func (p *printer) printNode(n Node) {
func (p *printer) printRawNode(n Node) {
switch n := n.(type) {
case nil:
// we should not reach here but don't crash
// expressions and types
case *Name:
p.print(_Name, n.Value) // _Name requires actual value following immediately
......
// errorcheck
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Make sure we don't crash when reporting this error.
package p
func f() {
if err := http.ListenAndServe(
} // ERROR "unexpected }, expecting expression"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment