From a54dce007d0d1fb8f21f73468c25e026e3b3d5c6 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 2 Sep 2017 14:08:30 +0200 Subject: sys: allow custom size for PtrType This is required to support ptr64 type. --- pkg/compiler/types.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/compiler/types.go b/pkg/compiler/types.go index de663f61e..d83f986f3 100644 --- a/pkg/compiler/types.go +++ b/pkg/compiler/types.go @@ -79,12 +79,13 @@ var typePtr = &typeDesc{ Args: []namedArg{{"direction", typeArgDir}, {"type", typeArgType}}, Gen: func(comp *compiler, t *ast.Type, args []*ast.Type, base sys.IntTypeCommon) sys.Type { base.ArgDir = sys.DirIn // pointers are always in - base.TypeSize = comp.ptrSize + size := comp.ptrSize if t.Ident == "ptr64" { - base.TypeSize = 8 + size = 8 } return &sys.PtrType{ TypeCommon: base.TypeCommon, + TypeSize: size, Type: comp.genType(args[1], "", genDir(args[0]), false), } }, @@ -375,6 +376,7 @@ var typeBuffer = &typeDesc{ Gen: func(comp *compiler, t *ast.Type, args []*ast.Type, base sys.IntTypeCommon) sys.Type { return &sys.PtrType{ TypeCommon: base.TypeCommon, + TypeSize: comp.ptrSize, Type: &sys.BufferType{ TypeCommon: genCommon("", "", genDir(args[0]), false), Kind: sys.BufferBlobRand, -- cgit mrf-deployment