]> Cypherpunks repositories - gostls13.git/commit
go/parser: make sure we have a valid AST when 'if' condition is missing
authorRobert Griesemer <gri@golang.org>
Fri, 18 May 2018 03:56:11 +0000 (23:56 -0400)
committerRobert Griesemer <gri@golang.org>
Fri, 18 May 2018 16:01:32 +0000 (16:01 +0000)
commitdb37e1600fb2fc698b14e745005c4cf44251d2a9
tree379fb5de04ddc7e35c73d7caa0915141545bf100
parent8a16c71067ca2cfd09281a82ee150a408095f0bc
go/parser: make sure we have a valid AST when 'if' condition is missing

This prevents a crash in go/types due to a nil condition in an 'if'
statement. There's more we can do to make go/types more robust but
this will address the immediate cause and also makes sure that the
parser returns a valid AST in this case.

Fixes #25438.

Change-Id: Ie55dc2c722352a5ecb17af6a16983741e8a8b515
Reviewed-on: https://go-review.googlesource.com/113735
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/go/parser/parser.go
src/go/types/testdata/issues.src