cgo: fixes panic when FuncType.Results is nil (#3136)

* cgo: fixes panic when FuncType.Results is nil

FuncType.Results can be nil. This fixes the comparison and backfills
relevant tests.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Co-authored-by: Ayke <aykevanlaethem@gmail.com>
This commit is contained in:
Crypt Keeper
2022-09-27 01:08:23 +08:00
committed by GitHub
parent fca2de21b1
commit 725864d8dc
2 changed files with 81 additions and 0 deletions
+3
View File
@@ -948,6 +948,9 @@ func (p *cgoPackage) isEquivalentAST(a, b ast.Node) bool {
if !ok {
return false
}
if node == nil || b == nil {
return node == b
}
if len(node.List) != len(b.List) {
return false
}