From 2089362335144a16ef6098769f298fb247b3d052 Mon Sep 17 00:00:00 2001 From: Artem Date: Wed, 17 Feb 2021 17:39:42 +0300 Subject: [PATCH] Fix: docs for ticket --- internal/contractparser/docstring/entrypoints.go | 4 +++- internal/contractparser/docstring/get_type_expr.go | 2 +- internal/contractparser/meta/data.go | 12 +++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/internal/contractparser/docstring/entrypoints.go b/internal/contractparser/docstring/entrypoints.go index f3b4211dd..dfb961bf5 100644 --- a/internal/contractparser/docstring/entrypoints.go +++ b/internal/contractparser/docstring/entrypoints.go @@ -142,7 +142,7 @@ func handleType(dd *dsData, bPath string, md meta.Metadata) (string, error) { i := len(dd.typedef) switch md[bPath].Type { - case consts.TypeTuple, consts.TypeEnum, consts.TypeUnion: + case consts.TypeTuple, consts.TypeEnum, consts.TypeUnion, consts.TICKET: return handleTupleEnumUnion(dd, bPath, i, md) case consts.TypeNamedTuple, consts.TypeNamedEnum, consts.TypeNamedUnion: return handleNamed(dd, bPath, i, md) @@ -204,6 +204,8 @@ func getSuffix(dd *dsData, bPath string, md meta.Metadata) (string, error) { return "_item", nil case consts.PAIR: return fmt.Sprintf("_arg%d", dd.arg), nil + case consts.TICKET: + return fmt.Sprintf("_typ%d", dd.arg), nil case consts.OR: return fmt.Sprintf("_var%d", dd.arg), nil case consts.OPTION: diff --git a/internal/contractparser/docstring/get_type_expr.go b/internal/contractparser/docstring/get_type_expr.go index 852491506..31c41f6a8 100644 --- a/internal/contractparser/docstring/get_type_expr.go +++ b/internal/contractparser/docstring/get_type_expr.go @@ -78,7 +78,7 @@ func getComplexExpr(dd *dsData, bPath string, md meta.Metadata) (string, error) node := md[bPath] switch node.Prim { - case consts.PAIR, consts.OR, consts.LAMBDA, consts.MAP, consts.BIGMAP: + case consts.PAIR, consts.OR, consts.LAMBDA, consts.MAP, consts.BIGMAP, consts.TICKET: varName, err := handleType(dd, bPath, md) if err != nil { return "", err diff --git a/internal/contractparser/meta/data.go b/internal/contractparser/meta/data.go index d8988a75c..3010c8aa0 100644 --- a/internal/contractparser/meta/data.go +++ b/internal/contractparser/meta/data.go @@ -251,7 +251,8 @@ func parseNodeMetadata(v gjson.Result, parent node.Node, path, inheritedName str args = append(args, parseNodeMetadata(arr[i], n, argPath, "", metadata)) } - if n.Is(consts.PAIR) || n.Is(consts.OR) { + switch { + case n.Is(consts.PAIR) || n.Is(consts.OR): res := internalNode{ Node: &n, InternalArgs: args, @@ -265,6 +266,15 @@ func parseNodeMetadata(v gjson.Result, parent node.Node, path, inheritedName str finishParseMetadata(metadata, path, res) return res } + case n.Is(consts.TICKET): + m := metadata[path] + for _, a := range args { + m.Args = append(m.Args, a.Node.Path) + } + return internalNode{ + Node: &n, + InternalArgs: args, + } } }