Skip to content

Commit

Permalink
Also Optionaltype in events
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaszm committed Jun 18, 2024
1 parent 6651b26 commit bd746cc
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions JsonGenerator/source/rpc_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,31 @@ def EmitEvent(emit, root, event, params_type, legacy = False):
emit.Line("%s %s;" % (params.cpp_type, names.params))

if params.properties and params.do_create:
for p in event.params.properties:
for p in params.properties:
if p.optional and (params_type == "native"):
emit.Line("if (%s.IsSet() == true) {" % (p.local_name))
emit.Indent()

emit.Line("%s.%s = %s;" % (names.params, p.cpp_name, p.local_name))
if p.schema.get("opaque"):
emit.Line("%s.%s.SetQuoted(false);" % (names.params, p.cpp_name))

if p.optional and (params_type == "native"):
emit.Unindent()
emit.Line("}")
else:
emit.Line("%s = %s;" % (names.params, event.params.local_name))
if params.optional and (params_type == "native"):
emit.Line("if (%s.IsSet() == true) {" % (params.local_name))
emit.Indent()

emit.Line("%s = %s;" % (names.params, params.local_name))
if params.schema.get("opaque"):
emit.Line("%s.SetQuoted(false);" % names.params)

if params.optional and (params_type == "native"):
emit.Unindent()
emit.Line("}")

emit.Line()

parameters = [ ]
Expand Down

0 comments on commit bd746cc

Please sign in to comment.