Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions JsonGenerator/source/header_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ def compute_prefix(log, converter, obj, suffix=None):
else:
raise CppParseError(method, "property method must have one parameter")

elif not event_params:
elif not event_params: # method is not related to notifications
var_type = ResolveTypedef(method.retval.type)

if var_type and ((isinstance(var_type.Type(), CppParser.Integer) and (var_type.Type().size == "long")) or not verify):
Expand Down Expand Up @@ -1381,6 +1381,10 @@ def compute_prefix(log, converter, obj, suffix=None):
obj["@originalname"] = method.name
varsidx = 0

return_value = ConvertParameter(method.retval)
if return_value["type"] != "null":
raise CppParseError(method, "%s: JSON-RPC notification method must not have a return value" % method.name)

if len(method.vars) > 0:
for v in method.vars[1:]:
if v.meta.is_index:
Expand Down Expand Up @@ -1437,7 +1441,7 @@ def MaybeWarning():
retvals = BuildResult(method.vars[varsidx:], method=method)

if retvals and retvals["type"] != "null":
raise CppParseError(method, "output parameters are invalid for JSON-RPC events")
raise CppParseError(method, "%s: JSON-RPC notification method must not have output parameters" % method.name)

if method.retval.meta.is_deprecated:
obj["deprecated"] = True
Expand Down
9 changes: 8 additions & 1 deletion ProxyStubGenerator/CppParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,13 +1404,20 @@ def Enumerator(self, name):
return None


class ReturnValue(Identifier):
def __init__(self, parent_block, parent, string, valid_specifiers, tags_allowed=True):
Identifier.__init__(self, parent_block, parent, string, valid_specifiers, tags_allowed)
self.parser_file = CurrentFile()
self.parser_line = CurrentLine()


# Holds functions
class Function(Block, Name):
def __init__(self, parent_block, name, ret_type, valid_specifiers=["static", "extern", "inline"]):
self.specifiers = []
Block.__init__(self, parent_block, name if name else self.name)
Name.__init__(self, parent_block, self.name)
self.retval = Identifier(self, self, ret_type, valid_specifiers, False)
self.retval = ReturnValue(self, self, ret_type, valid_specifiers, False)
self.omit = False
self.stub = False
self.is_excluded = False
Expand Down
Loading