diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-09-02 14:08:30 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-02 14:08:30 +0200 |
| commit | a54dce007d0d1fb8f21f73468c25e026e3b3d5c6 (patch) | |
| tree | 2f93d6b15e0d55ddeb60fc74a86e9bc70912552b /pkg | |
| parent | 08c91ab698c91dc4b8fbc597c03ac1ca10eb403c (diff) | |
sys: allow custom size for PtrType
This is required to support ptr64 type.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/compiler/types.go | 6 |
1 files changed, 4 insertions, 2 deletions
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, |
