aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/compiler/testdata/errors.txt4
-rw-r--r--pkg/compiler/types.go6
2 files changed, 9 insertions, 1 deletions
diff --git a/pkg/compiler/testdata/errors.txt b/pkg/compiler/testdata/errors.txt
index d5a596457..68c9895bf 100644
--- a/pkg/compiler/testdata/errors.txt
+++ b/pkg/compiler/testdata/errors.txt
@@ -133,6 +133,10 @@ s6 {
f1 int8
} [align_foo] ### bad struct s6 alignment foo
+s7 {
+ f1 ptr64[in, int32]
+}
+
u3 [
f1 int8
f2 int32
diff --git a/pkg/compiler/types.go b/pkg/compiler/types.go
index 710bc1b60..de663f61e 100644
--- a/pkg/compiler/types.go
+++ b/pkg/compiler/types.go
@@ -74,11 +74,15 @@ var typeInt = &typeDesc{
}
var typePtr = &typeDesc{
- Names: []string{"ptr"},
+ Names: []string{"ptr", "ptr64"},
CanBeArg: true,
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
+ if t.Ident == "ptr64" {
+ base.TypeSize = 8
+ }
return &sys.PtrType{
TypeCommon: base.TypeCommon,
Type: comp.genType(args[1], "", genDir(args[0]), false),