aboutsummaryrefslogtreecommitdiffstats
path: root/sys/decl.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-09-19 19:42:00 +0200
committerGitHub <noreply@github.com>2016-09-19 19:42:00 +0200
commitd18f8aa3669db8a7c2a9d235aa720bce8041f329 (patch)
tree56195536ec22d1414e7614403dc2757d9d76d4ca /sys/decl.go
parent0c97d70213a4fbc6d8d57626c18b603f2a281047 (diff)
parentf41935d53ff6271e8c2a9022f41b99ccee9b634b (diff)
Merge pull request #73 from xairy/ranged_arrays
Allow range sized arrays
Diffstat (limited to 'sys/decl.go')
-rw-r--r--sys/decl.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/decl.go b/sys/decl.go
index a9f9d1ad3..2cc8f22e5 100644
--- a/sys/decl.go
+++ b/sys/decl.go
@@ -236,21 +236,27 @@ func (t FilenameType) Align() uintptr {
return 1
}
+type ArrayKind int
+
+const (
+ ArrayRandLen ArrayKind = iota
+ ArrayRangeLen
+)
+
type ArrayType struct {
TypeCommon
- Type Type
- Len uintptr // 0 if variable-length, unused for now
+ Type Type
+ Kind ArrayKind
+ RangeBegin uintptr
+ RangeEnd uintptr
}
func (t ArrayType) Size() uintptr {
- if t.Len == 0 {
- return 0 // for trailing embed arrays
- }
- return t.Len * t.Type.Size()
+ panic("should not be called")
}
func (t ArrayType) Align() uintptr {
- return t.Type.Align()
+ panic("should not be called")
}
type PtrType struct {