From f41935d53ff6271e8c2a9022f41b99ccee9b634b Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Thu, 15 Sep 2016 13:45:06 +0200 Subject: Allow range sized arrays --- sys/decl.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'sys/decl.go') diff --git a/sys/decl.go b/sys/decl.go index a447948bc..a87b51d91 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 { -- cgit mrf-deployment