aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-05-17 12:02:30 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-05-17 12:02:30 +0200
commit031c7941d7bd97b4acbf9bcd2513ed695b387ff2 (patch)
treed64f385075a30115dd950a8e2d714e22eef5e18b /pkg/compiler
parent90c54c496b268f0977517448e8f7de54e93b975d (diff)
pkg/compiler: add optional builtin template
type optional[T] [ val T void void ] [varlen]
Diffstat (limited to 'pkg/compiler')
-rw-r--r--pkg/compiler/testdata/all.txt1
-rw-r--r--pkg/compiler/types.go5
2 files changed, 6 insertions, 0 deletions
diff --git a/pkg/compiler/testdata/all.txt b/pkg/compiler/testdata/all.txt
index d451f5a60..69ad6d181 100644
--- a/pkg/compiler/testdata/all.txt
+++ b/pkg/compiler/testdata/all.txt
@@ -102,6 +102,7 @@ struct_with_void1 {
f1 int8
f2 array[void5]
f3 int64
+ f4 optional[int8]
}
foo$void0(a ptr[in, void0])
diff --git a/pkg/compiler/types.go b/pkg/compiler/types.go
index 825071324..97f7d18c4 100644
--- a/pkg/compiler/types.go
+++ b/pkg/compiler/types.go
@@ -744,6 +744,11 @@ type boolptr intptr[0:1]
type filename string[filename]
filename = "", "."
+
+type optional[T] [
+ val T
+ void void
+] [varlen]
`
func init() {