Skip to content

Commit

Permalink
Fix: docs for ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored and m-kus committed Feb 17, 2021
1 parent edda875 commit 2089362
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion internal/contractparser/docstring/entrypoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion internal/contractparser/docstring/get_type_expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion internal/contractparser/meta/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
}
}
}

Expand Down

0 comments on commit 2089362

Please sign in to comment.