Skip to content

Commit

Permalink
api: Generate enum consts with Values funcs
Browse files Browse the repository at this point in the history
This patch ensures enum types are generated with Values functions
that make it trivial to discover all values for a given enum.
  • Loading branch information
akutz committed Apr 24, 2024
1 parent c385285 commit 11470bf
Show file tree
Hide file tree
Showing 2 changed files with 4,008 additions and 55 deletions.
5 changes: 5 additions & 0 deletions gen/vim_wsdl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@ def dump(io)
io.print "const (\n"
enums.each { |e| e.dump(io) }
io.print ")\n\n"

io.print "func(e %1$s) Values() []%1$s {\n\treturn[]%1$s{\n" % ucfirstName
enums.each { |e| io.print("\t\t%s,\n" % e.var_name()) }
io.print "\t}\n}\n\n"

end

def dump_init(io)
Expand Down
Loading

0 comments on commit 11470bf

Please sign in to comment.