...
Source file
src/go/types/basic.go
1
2
3
4
5
6
7 package types
8
9
10 type BasicKind int
11
12 const (
13 Invalid BasicKind = iota
14
15
16 Bool
17 Int
18 Int8
19 Int16
20 Int32
21 Int64
22 Uint
23 Uint8
24 Uint16
25 Uint32
26 Uint64
27 Uintptr
28 Float32
29 Float64
30 Complex64
31 Complex128
32 String
33 UnsafePointer
34
35
36 UntypedBool
37 UntypedInt
38 UntypedRune
39 UntypedFloat
40 UntypedComplex
41 UntypedString
42 UntypedNil
43
44
45 Byte = Uint8
46 Rune = Int32
47 )
48
49
50 type BasicInfo int
51
52
53 const (
54 IsBoolean BasicInfo = 1 << iota
55 IsInteger
56 IsUnsigned
57 IsFloat
58 IsComplex
59 IsString
60 IsUntyped
61
62 IsOrdered = IsInteger | IsFloat | IsString
63 IsNumeric = IsInteger | IsFloat | IsComplex
64 IsConstType = IsBoolean | IsNumeric | IsString
65 )
66
67
68 type Basic struct {
69 kind BasicKind
70 info BasicInfo
71 name string
72 }
73
74
75 func (b *Basic) Kind() BasicKind { return b.kind }
76
77
78 func (b *Basic) Info() BasicInfo { return b.info }
79
80
81 func (b *Basic) Name() string { return b.name }
82
83 func (b *Basic) Underlying() Type { return b }
84 func (b *Basic) String() string { return TypeString(b, nil) }
85
View as plain text