From 997ccc675b3dc049ad3ce922580397bd546956ea Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sat, 26 Oct 2019 15:31:00 +0200 Subject: pkg/compiler: define fileoff template Signed-off-by: Paul Chaignon --- pkg/compiler/testdata/errors.txt | 4 ++-- pkg/compiler/types.go | 16 ++-------------- 2 files changed, 4 insertions(+), 16 deletions(-) (limited to 'pkg') diff --git a/pkg/compiler/testdata/errors.txt b/pkg/compiler/testdata/errors.txt index 961de44b1..e0b003481 100644 --- a/pkg/compiler/testdata/errors.txt +++ b/pkg/compiler/testdata/errors.txt @@ -69,7 +69,7 @@ resource r6[int64be] ### int64be can't be resource base (int types can) resource r9["foo"] ### unexpected string "foo", expect type foo$7(a r0, a1 r2[opt]) -foo$8(a fileoff[a, b, c]) ### wrong number of arguments for type fileoff, expect no arguments +foo$8(a fileoff[a, b, int8]) ### template fileoff needs 0 arguments instead of 3 foo$9(a buffer[inout]) foo$10(a buffer[intout]) ### unexpected value intout for direction argument of ptr type, expect [in out inout] foo$11(a buffer["in"]) ### unexpected string "in" for direction argument of ptr type, expect [in out inout] @@ -95,7 +95,7 @@ foo$33(a int8, b ptr[in, csum[a, pseudo, 1, int32]]) foo$34(a int32["foo"]) ### unexpected string "foo" for range argument of int32 type, expect int foo$35(a ptr[in, s3[opt]]) ### s3 can't be marked as opt foo$36(a const[1:2]) ### unexpected ':' -foo$39(a fileoff:1) ### unexpected ':' +foo$39(a fileoff:1) ### type alias fileoff with ':' foo$40(a len["a"]) ### unexpected string "a" for len target argument of len type, expect identifier foo$41(a vma[C1:C2]) foo$43(a ptr[in, string[1]]) ### unexpected int 1, string arg must be a string literal or string flags diff --git a/pkg/compiler/types.go b/pkg/compiler/types.go index 5bed71324..903c0957e 100644 --- a/pkg/compiler/types.go +++ b/pkg/compiler/types.go @@ -348,19 +348,6 @@ var typeArgFlags = &typeArg{ }, } -var typeFileoff = &typeDesc{ - Names: []string{"fileoff"}, - CanBeArgRet: canBeArg, - CantBeOpt: true, - NeedBase: true, - Gen: func(comp *compiler, t *ast.Type, args []*ast.Type, base prog.IntTypeCommon) prog.Type { - return &prog.IntType{ - IntTypeCommon: base, - Kind: prog.IntFileoff, - } - }, -} - var typeVMA = &typeDesc{ Names: []string{"vma", "vma64"}, CanBeArgRet: canBeArg, @@ -915,6 +902,8 @@ type bool32 int32[0:1] type bool64 int64[0:1] type boolptr intptr[0:1] +type fileoff[BASE] BASE + type filename string[filename] filename = "", "." @@ -935,7 +924,6 @@ func init() { typeLen, typeConst, typeFlags, - typeFileoff, typeVMA, typeCsum, typeProc, -- cgit mrf-deployment