]> Cypherpunks repositories - gostls13.git/commit
go/printer: don't crash if ast.FuncType.Params is nil
authorRobert Griesemer <gri@golang.org>
Fri, 27 Jul 2012 00:09:11 +0000 (17:09 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 27 Jul 2012 00:09:11 +0000 (17:09 -0700)
commita7c74d52dc49a6b6e448e301165a76bf3fb0a3c7
tree157c4b81e242f325a1bb5101aaa40265941ce844
parent55f0c8b2cddff16de2bf101ec997bf96813615d4
go/printer: don't crash if ast.FuncType.Params is nil

The go/ast comment for FuncType.Params says that the field may be nil.
Make sure the printer accepts such a value. The go/parser always sets
the field (to provide parenthesis position information), but a program
creating a Go AST from scatch may not.

Added corresponding test case.

Fixes #3870.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6448060
src/pkg/go/printer/nodes.go
src/pkg/go/printer/printer_test.go