diff options
author | Ayke van Laethem <[email protected]> | 2021-09-22 21:51:19 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-09-27 15:47:12 +0200 |
commit | 49dd2ce3933e9460c3dc04797b5f30134f48dd39 (patch) | |
tree | d0bda5814b1c0e28d9923ff65cbed3b38953f6fb /cgo/libclang.go | |
parent | 7df8e8db42c30be37c2b763b1ebc63dbfa751119 (diff) | |
download | tinygo-49dd2ce3933e9460c3dc04797b5f30134f48dd39.tar.gz tinygo-49dd2ce3933e9460c3dc04797b5f30134f48dd39.zip |
all: fix staticcheck warnings
This is a loose collection of small fixes flagged by staticcheck:
- dead code
- regexp expressions not using backticks (`foobar` / "foobar")
- redundant types of slice and map initializers
- misc other fixes
Not all of these seem very useful to me, but in particular dead code is
nice to fix. I've fixed them all just so that if there are problems,
they aren't hidden in the noise of less useful issues.
Diffstat (limited to 'cgo/libclang.go')
-rw-r--r-- | cgo/libclang.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cgo/libclang.go b/cgo/libclang.go index 8e9af8a08..22ce68cdd 100644 --- a/cgo/libclang.go +++ b/cgo/libclang.go @@ -203,7 +203,7 @@ func tinygo_clang_globals_visitor(c, parent C.GoCXCursor, client_data C.CXClient if resultType.kind != C.CXType_Void { fn.results = &ast.FieldList{ List: []*ast.Field{ - &ast.Field{ + { Type: p.makeASTType(resultType, pos), }, }, @@ -775,7 +775,7 @@ func tinygo_clang_struct_visitor(c, parent C.GoCXCursor, client_data C.CXClientD } *inBitfield = false field.Names = []*ast.Ident{ - &ast.Ident{ + { NamePos: pos, Name: name, Obj: &ast.Object{ @@ -796,8 +796,12 @@ func tinygo_clang_enum_visitor(c, parent C.GoCXCursor, client_data C.CXClientDat pos := p.getCursorPosition(c) value := C.tinygo_clang_getEnumConstantDeclValue(c) p.constants[name] = constantInfo{ - expr: &ast.BasicLit{pos, token.INT, strconv.FormatInt(int64(value), 10)}, - pos: pos, + expr: &ast.BasicLit{ + ValuePos: pos, + Kind: token.INT, + Value: strconv.FormatInt(int64(value), 10), + }, + pos: pos, } return C.CXChildVisit_Continue } |