Skip to content

Commit d0c9d5b

Browse files
authored
Use vararg argument in string only methods (utopia-rise#857)
1 parent b11d438 commit d0c9d5b

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

kt/api-generator/src/main/kotlin/godot/codegen/generation/rule/MethodRule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ class StringOnlyRule : GodotApiRule<EnrichedClassTask>(), BaseMethodeRule {
287287
append(".asCachedNodePath()")
288288
}
289289
}
290-
if (method.isVararg && isNotEmpty()) append("")
290+
if (method.isVararg && isNotEmpty()) append("*args")
291291
}
292292

293293
addStatement("return·${method.name}($arguments)")

kt/godot-library/godot-api-library/src/main/kotlin/godot/api/ClassDB.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ public object ClassDB : Object() {
577577
`class`: String,
578578
method: String,
579579
vararg args: Any?,
580-
): Any? = classCallStatic(`class`.asCachedStringName(), method.asCachedStringName(), )
580+
): Any? = classCallStatic(`class`.asCachedStringName(), method.asCachedStringName(), *args)
581581

582582
/**
583583
* Returns an array with the names all the integer constants of [class] or its ancestry.

kt/godot-library/godot-api-library/src/main/kotlin/godot/api/Node.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,7 +2686,7 @@ public open class Node : Object() {
26862686
* (`get_multiplayer().peer.get_connection_status() == CONNECTION_CONNECTED`).
26872687
*/
26882688
public final fun rpc(method: String, vararg args: Any?): Error =
2689-
rpc(method.asCachedStringName(), )
2689+
rpc(method.asCachedStringName(), *args)
26902690

26912691
/**
26922692
* Sends a [rpc] to a specific peer identified by [peerId] (see [MultiplayerPeer.setTargetPeer]).
@@ -2700,7 +2700,7 @@ public open class Node : Object() {
27002700
peerId: Long,
27012701
method: String,
27022702
vararg args: Any?,
2703-
): Error = rpcId(peerId, method.asCachedStringName(), )
2703+
): Error = rpcId(peerId, method.asCachedStringName(), *args)
27042704

27052705
/**
27062706
* This function is similar to [Object.callDeferred] except that the call will take place when the
@@ -2710,7 +2710,7 @@ public open class Node : Object() {
27102710
* called.
27112711
*/
27122712
public final fun callDeferredThreadGroup(method: String, vararg args: Any?): Any? =
2713-
callDeferredThreadGroup(method.asCachedStringName(), )
2713+
callDeferredThreadGroup(method.asCachedStringName(), *args)
27142714

27152715
/**
27162716
* Similar to [callDeferredThreadGroup], but for setting properties.
@@ -2724,7 +2724,7 @@ public open class Node : Object() {
27242724
* the call will become deferred. Otherwise, the call will go through directly.
27252725
*/
27262726
public final fun callThreadSafe(method: String, vararg args: Any?): Any? =
2727-
callThreadSafe(method.asCachedStringName(), )
2727+
callThreadSafe(method.asCachedStringName(), *args)
27282728

27292729
/**
27302730
* Similar to [callThreadSafe], but for setting properties.

kt/godot-library/godot-api-library/src/main/kotlin/godot/api/SceneTree.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ public open class SceneTree : MainLoop() {
764764
group: String,
765765
method: String,
766766
vararg args: Any?,
767-
) = callGroupFlags(flags, group.asCachedStringName(), method.asCachedStringName(), )
767+
) = callGroupFlags(flags, group.asCachedStringName(), method.asCachedStringName(), *args)
768768

769769
/**
770770
* Calls [Object.notification] with the given [notification] to all nodes inside this tree added
@@ -809,7 +809,7 @@ public open class SceneTree : MainLoop() {
809809
group: String,
810810
method: String,
811811
vararg args: Any?,
812-
) = callGroup(group.asCachedStringName(), method.asCachedStringName(), )
812+
) = callGroup(group.asCachedStringName(), method.asCachedStringName(), *args)
813813

814814
/**
815815
* Calls [Object.notification] with the given [notification] to all nodes inside this tree added

kt/godot-library/godot-api-library/src/main/kotlin/godot/api/TreeItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ public open class TreeItem internal constructor() : Object() {
12171217
* comma separated list.
12181218
*/
12191219
public final fun callRecursive(method: String, vararg args: Any?) =
1220-
callRecursive(method.asCachedStringName(), )
1220+
callRecursive(method.asCachedStringName(), *args)
12211221

12221222
public enum class TreeCellMode(
12231223
`value`: Long,

kt/godot-library/godot-core-library/src/main/kotlin/gen/godot/api/Object.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ public open class Object : KtObject() {
14001400
* each call.
14011401
*/
14021402
public final fun emitSignal(signal: String, vararg args: Any?): Error =
1403-
emitSignal(signal.asCachedStringName(), )
1403+
emitSignal(signal.asCachedStringName(), *args)
14041404

14051405
/**
14061406
* Calls the [method] on the object and returns the result. This method supports a variable number
@@ -1423,7 +1423,7 @@ public open class Object : KtObject() {
14231423
* each call.
14241424
*/
14251425
public final fun call(method: String, vararg args: Any?): Any? =
1426-
call(method.asCachedStringName(), )
1426+
call(method.asCachedStringName(), *args)
14271427

14281428
/**
14291429
* Calls the [method] on the object during idle time. Always returns `null`, **not** the method's
@@ -1470,7 +1470,7 @@ public open class Object : KtObject() {
14701470
* ```
14711471
*/
14721472
public final fun callDeferred(method: String, vararg args: Any?): Any? =
1473-
callDeferred(method.asCachedStringName(), )
1473+
callDeferred(method.asCachedStringName(), *args)
14741474

14751475
/**
14761476
* Assigns [value] to the given [property], at the end of the current frame. This is equivalent to

0 commit comments

Comments
 (0)