diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-05-13 18:52:46 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-05-14 19:28:01 +0200 |
| commit | 16c881ad8573b0bb87e8bfb0c71cba90b701e9a9 (patch) | |
| tree | a84c9d82daad525899e1a66ed2e25b3078792504 /pkg | |
| parent | eea28fee309680462752ef7709f1a94178dce44d (diff) | |
pkg/compiler: generate complex len targets
Change the generated format for len type to support multiple path elements.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/compiler/types.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/compiler/types.go b/pkg/compiler/types.go index d2d3380a6..6d9211686 100644 --- a/pkg/compiler/types.go +++ b/pkg/compiler/types.go @@ -220,9 +220,13 @@ var typeLen = &typeDesc{ case "bitsize": bitSize = 1 } + path := []string{args[0].Ident} + for _, col := range args[0].Colon { + path = append(path, col.Ident) + } return &prog.LenType{ IntTypeCommon: base, - Buf: args[0].Ident, + Path: path, BitSize: bitSize, } }, @@ -346,6 +350,9 @@ var typeCsum = &typeDesc{ if len(args) > 2 && genCsumKind(args[1]) != prog.CsumPseudo { comp.error(args[2].Pos, "only pseudo csum can have proto") } + if len(args[0].Colon) != 0 { + comp.error(args[0].Colon[0].Pos, "path expressions are not implemented for csum") + } }, Gen: func(comp *compiler, t *ast.Type, args []*ast.Type, base prog.IntTypeCommon) prog.Type { var proto uint64 |
