-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
type_anon.go
46 lines (36 loc) · 1.19 KB
/
type_anon.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package swift
import (
"io"
"github.com/blacktop/go-macho/types"
)
// Flags for anonymous type context descriptors. These values are used as the
// kindSpecificFlags of the ContextDescriptorFlags for the anonymous context.
type AnonymousContextDescriptorFlags uint16
const (
// Whether this anonymous context descriptor is followed by its
// mangled name, which can be used to match the descriptor at runtime.
HasMangledName = 0
)
func (f AnonymousContextDescriptorFlags) HasMangledName() bool {
return types.ExtractBits(uint64(f), HasMangledName, 1) != 0
}
type Anonymous struct {
TargetAnonymousContextDescriptor
GenericContext *GenericContext
MangledContextName string
}
type TargetAnonymousContextDescriptor struct {
TargetContextDescriptor
}
func (tacd TargetAnonymousContextDescriptor) HasMangledName() bool {
return AnonymousContextDescriptorFlags(tacd.Flags.KindSpecific()).HasMangledName()
}
func (tacd TargetAnonymousContextDescriptor) Size() int64 {
return tacd.TargetContextDescriptor.Size()
}
func (tacd *TargetAnonymousContextDescriptor) Read(r io.Reader, addr uint64) error {
if err := tacd.TargetContextDescriptor.Read(r, addr); err != nil {
return err
}
return nil
}