Skip to content

Commit 5accde1

Browse files
committed
fix: Don't write comma for RPCs with no parameters.
1 parent 56c1d58 commit 5accde1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/dart/godot_dart_build/lib/src/godot_script_generator.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,10 @@ class GodotScriptAnnotationGenerator
330330
for (final method in rpcMethods) {
331331
var methodSignature = method.getDisplayString(withNullability: true);
332332
String withIdParam;
333-
if (method.parameters.where((p) => p.isNamed).isNotEmpty) {
333+
if (method.parameters.isEmpty) {
334+
withIdParam =
335+
'${methodSignature.substring(0, methodSignature.length - 1)}{int? peerId})';
336+
} else if (method.parameters.where((p) => p.isNamed).isNotEmpty) {
334337
withIdParam =
335338
'${methodSignature.substring(0, methodSignature.length - 2)}, int? peerId})';
336339
} else {

0 commit comments

Comments
 (0)