Skip to content

Commit 660aae9

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

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
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 {
@@ -339,7 +342,7 @@ class GodotScriptAnnotationGenerator
339342
}
340343
buffer.write(withIdParam);
341344
buffer.writeln('{');
342-
buffer.writeln(' final args = [');
345+
buffer.writeln(' final args = <Variant>[');
343346
for (final arg in method.parameters) {
344347
buffer.write('Variant(${arg.name}),');
345348
}

0 commit comments

Comments
 (0)