aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-01-23 15:02:47 +0100
committerAndrey Konovalov <andreyknvl@google.com>2017-01-23 18:13:06 +0100
commitb323c5aaa9b926ba43a9c5435b62b4fce992ff94 (patch)
tree2620c3928f0b1b27f401565eb3d162dd2f254b11 /sys
parentcd23722cf2dabd28d83fa321c3cbf50a956d3fb7 (diff)
prog: add FieldName to Type
FieldName() is the name of the struct field or union option with this type. TypeName() is now always the name of the type.
Diffstat (limited to 'sys')
-rw-r--r--sys/decl.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/decl.go b/sys/decl.go
index a495ffd4a..3c98d1038 100644
--- a/sys/decl.go
+++ b/sys/decl.go
@@ -29,6 +29,7 @@ const (
type Type interface {
Name() string
+ FieldName() string
Dir() Dir
Optional() bool
Default() uintptr
@@ -49,6 +50,7 @@ func IsPad(t Type) bool {
type TypeCommon struct {
TypeName string
+ FldName string // for struct fields and named args
ArgDir Dir
IsOptional bool
}
@@ -57,6 +59,10 @@ func (t *TypeCommon) Name() string {
return t.TypeName
}
+func (t *TypeCommon) FieldName() string {
+ return t.FldName
+}
+
func (t *TypeCommon) Optional() bool {
return t.IsOptional
}