aboutsummaryrefslogtreecommitdiffhomepage
path: root/cgo
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-08-03 16:24:47 +0200
committerAyke <[email protected]>2022-08-04 12:18:32 +0200
commitc7a23183e822b9eebb639902414a0e08a09fbba0 (patch)
tree894a03fe2f4980a728c8401604d8a2c17503fde5 /cgo
parentf936125658e8aef885a0e31d8fc343859defe63c (diff)
downloadtinygo-c7a23183e822b9eebb639902414a0e08a09fbba0.tar.gz
tinygo-c7a23183e822b9eebb639902414a0e08a09fbba0.zip
all: format code according to Go 1.19 rules
Go 1.19 started reformatting code in a way that makes it more obvious how it will be rendered on pkg.go.dev. It gets it almost right, but not entirely. Therefore, I had to modify some of the comments so that they are formatted correctly.
Diffstat (limited to 'cgo')
-rw-r--r--cgo/cgo.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/cgo/cgo.go b/cgo/cgo.go
index 42914a11a..e1be8ab49 100644
--- a/cgo/cgo.go
+++ b/cgo/cgo.go
@@ -493,15 +493,15 @@ func (p *cgoPackage) makeUnionField(typ *elaboratedTypeInfo) *ast.StructType {
// createUnionAccessor creates a function that returns a typed pointer to a
// union field for each field in a union. For example:
//
-// func (union *C.union_1) unionfield_d() *float64 {
-// return (*float64)(unsafe.Pointer(&union.$union))
-// }
+// func (union *C.union_1) unionfield_d() *float64 {
+// return (*float64)(unsafe.Pointer(&union.$union))
+// }
//
// Where C.union_1 is defined as:
//
-// type C.union_1 struct{
-// $union uint64
-// }
+// type C.union_1 struct{
+// $union uint64
+// }
//
// The returned pointer can be used to get or set the field, or get the pointer
// to a subfield.
@@ -617,9 +617,9 @@ func (p *cgoPackage) createUnionAccessor(field *ast.Field, typeName string) {
// createBitfieldGetter creates a bitfield getter function like the following:
//
-// func (s *C.struct_foo) bitfield_b() byte {
-// return (s.__bitfield_1 >> 5) & 0x1
-// }
+// func (s *C.struct_foo) bitfield_b() byte {
+// return (s.__bitfield_1 >> 5) & 0x1
+// }
func (p *cgoPackage) createBitfieldGetter(bitfield bitfieldInfo, typeName string) {
// The value to return from the getter.
// Not complete: this is just an expression to get the complete field.
@@ -729,15 +729,15 @@ func (p *cgoPackage) createBitfieldGetter(bitfield bitfieldInfo, typeName string
// createBitfieldSetter creates a bitfield setter function like the following:
//
-// func (s *C.struct_foo) set_bitfield_b(value byte) {
-// s.__bitfield_1 = s.__bitfield_1 ^ 0x60 | ((value & 1) << 5)
-// }
+// func (s *C.struct_foo) set_bitfield_b(value byte) {
+// s.__bitfield_1 = s.__bitfield_1 ^ 0x60 | ((value & 1) << 5)
+// }
//
// Or the following:
//
-// func (s *C.struct_foo) set_bitfield_c(value byte) {
-// s.__bitfield_1 = s.__bitfield_1 & 0x3f | (value << 6)
-// }
+// func (s *C.struct_foo) set_bitfield_c(value byte) {
+// s.__bitfield_1 = s.__bitfield_1 & 0x3f | (value << 6)
+// }
func (p *cgoPackage) createBitfieldSetter(bitfield bitfieldInfo, typeName string) {
// The full field with all bitfields.
var field ast.Expr = &ast.SelectorExpr{