aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2016-10-11 14:24:25 +0200
committerAndrey Konovalov <andreyknvl@google.com>2016-10-11 20:09:19 +0200
commit78f79fee9374b8e322a0362a01e1e711ff8b9248 (patch)
tree169d357e024f99ad7e2a5e57f848569a7658c7dc /sys
parent6dd64c7a7036beb5607afbd066b7018aef958de7 (diff)
Refactor & improve len type handling
Diffstat (limited to 'sys')
-rw-r--r--sys/decl.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/sys/decl.go b/sys/decl.go
index 275bbb380..ba38399ba 100644
--- a/sys/decl.go
+++ b/sys/decl.go
@@ -25,6 +25,7 @@ type Type interface {
Default() uintptr
Size() uintptr
Align() uintptr
+ InnerType() Type // returns inner type for PtrType
}
func IsPad(t Type) bool {
@@ -83,6 +84,10 @@ func (t ResourceType) Align() uintptr {
return t.Desc.Type.Align()
}
+func (t ResourceType) InnerType() Type {
+ return t
+}
+
type FileoffType struct {
TypeCommon
TypeSize uintptr
@@ -97,6 +102,10 @@ func (t FileoffType) Align() uintptr {
return t.Size()
}
+func (t FileoffType) InnerType() Type {
+ return t
+}
+
type BufferKind int
const (
@@ -136,6 +145,10 @@ func (t BufferType) Align() uintptr {
return 1
}
+func (t BufferType) InnerType() Type {
+ return t
+}
+
type VmaType struct {
TypeCommon
}
@@ -148,6 +161,10 @@ func (t VmaType) Align() uintptr {
return t.Size()
}
+func (t VmaType) InnerType() Type {
+ return t
+}
+
type LenType struct {
TypeCommon
TypeSize uintptr
@@ -163,6 +180,10 @@ func (t LenType) Align() uintptr {
return t.Size()
}
+func (t LenType) InnerType() Type {
+ return t
+}
+
type FlagsType struct {
TypeCommon
TypeSize uintptr
@@ -177,6 +198,10 @@ func (t FlagsType) Align() uintptr {
return t.Size()
}
+func (t FlagsType) InnerType() Type {
+ return t
+}
+
type ConstType struct {
TypeCommon
TypeSize uintptr
@@ -192,6 +217,10 @@ func (t ConstType) Align() uintptr {
return t.Size()
}
+func (t ConstType) InnerType() Type {
+ return t
+}
+
type StrConstType struct {
TypeCommon
TypeSize uintptr
@@ -206,6 +235,10 @@ func (t StrConstType) Align() uintptr {
return t.Size()
}
+func (t StrConstType) InnerType() Type {
+ return t
+}
+
type IntKind int
const (
@@ -232,6 +265,10 @@ func (t IntType) Align() uintptr {
return t.Size()
}
+func (t IntType) InnerType() Type {
+ return t
+}
+
type FilenameType struct {
TypeCommon
}
@@ -244,6 +281,10 @@ func (t FilenameType) Align() uintptr {
return 1
}
+func (t FilenameType) InnerType() Type {
+ return t
+}
+
type ArrayKind int
const (
@@ -270,6 +311,10 @@ func (t ArrayType) Align() uintptr {
return t.Type.Align()
}
+func (t ArrayType) InnerType() Type {
+ return t
+}
+
type PtrType struct {
TypeCommon
Type Type
@@ -284,6 +329,10 @@ func (t PtrType) Align() uintptr {
return t.Size()
}
+func (t PtrType) InnerType() Type {
+ return t.Type.InnerType()
+}
+
type StructType struct {
TypeCommon
Fields []Type
@@ -316,6 +365,10 @@ func (t *StructType) Align() uintptr {
return align
}
+func (t *StructType) InnerType() Type {
+ return t
+}
+
type UnionType struct {
TypeCommon
Options []Type
@@ -345,6 +398,10 @@ func (t *UnionType) Align() uintptr {
return align
}
+func (t *UnionType) InnerType() Type {
+ return t
+}
+
type Dir int
const (