-
Notifications
You must be signed in to change notification settings - Fork 42
/
types.go
68 lines (47 loc) · 1.97 KB
/
types.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Package types mimics the https://golang.org/pkg/go/types/ package.
// It also contains some extra utility functions, they're defined in ext.go file.
package types
// Implements reports whether a given type implements the specified interface.
func Implements(typ Type, iface *Interface) bool { return false }
// Identical reports whether x and y are identical types. Receivers of Signature types are ignored.
func Identical(x, y Type) bool { return false }
// A Type represents a type of Go. All types implement the Type interface.
type Type interface {
// Underlying returns the underlying type of a type.
Underlying() Type
// String returns a string representation of a type.
String() string
}
type (
// An Array represents an array type.
Array struct{}
// A Slice represents a slice type.
Slice struct{}
// A Pointer represents a pointer type.
Pointer struct{}
// An Interface represents an interface type.
Interface struct{}
// A struct represents a struct type.
Struct struct{}
)
// NewArray returns a new array type for the given element type and length.
// A negative length indicates an unknown length.
func NewArray(elem Type, len int) *Array { return nil }
// Elem returns element type of array.
func (*Array) Elem() Type { return nil }
// NewSlice returns a new slice type for the given element type.
func NewSlice(elem Type) *Slice { return nil }
// Elem returns element type of slice.
func (*Slice) Elem() Type { return nil }
// Len returns the length of array.
// A negative result indicates an unknown length.
func (*Array) Len() int { return 0 }
// NewPointer returns a new pointer type for the given element (base) type.
func NewPointer(elem Type) *Pointer { return nil }
// Elem returns the element type for the given pointer.
func (*Pointer) Elem() Type { return nil }
func (*Struct) NumFields() int { return 0 }
func (*Struct) Field(i int) *Var { return nil }
type Var struct{}
func (*Var) Embedded() bool { return false }
func (*Var) Type() Type { return nil }