fix warning

This commit is contained in:
xushiwei
2024-05-06 08:21:47 +08:00
parent 7223ff004a
commit 7f61989869
3 changed files with 10 additions and 2 deletions

View File

@@ -55,7 +55,7 @@ func main() {
if e == nil {
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
enc.Encode(doc)
check(enc.Encode(doc))
return
}
err = e
@@ -63,3 +63,9 @@ func main() {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
func check(err error) {
if err != nil {
panic(err)
}
}

View File

@@ -189,6 +189,7 @@ func (p *parser) newError(errMsg string) *ParseTypeError {
return &ParseTypeError{QualType: p.s.Source(), ErrMsg: errMsg}
}
// TODO(xsw): check expect results
func (p *parser) expect(tokExp token.Token) error {
p.next()
if p.tok != tokExp {
@@ -330,6 +331,7 @@ func (p *parser) parseFunc(pkg *types.Package, t types.Type, inFlags int) (ret t
if err != nil {
return
}
_ = inFlags
return ctypes.NewFunc(types.NewTuple(args...), results, variadic), nil
}

View File

@@ -74,7 +74,7 @@ func NewPointer(typ types.Type) types.Type {
}
case *types.Signature:
if gogen.IsCSignature(t) {
return types.NewSignature(nil, t.Params(), t.Results(), t.Variadic())
return types.NewSignatureType(nil, nil, nil, t.Params(), t.Results(), t.Variadic())
}
case *types.Named:
if typ == ValistTag {