From d6a02db8ad4907f8de8a216c40fb083d8525d8e6 Mon Sep 17 00:00:00 2001 From: Mikhail Tishin Date: Thu, 4 Jan 2024 17:32:11 +0300 Subject: [PATCH] Fix static method generation in built-in structs (#329) --- Generator/Generator/BuiltinGen.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Generator/Generator/BuiltinGen.swift b/Generator/Generator/BuiltinGen.swift index 5186a001e..4d8471f81 100644 --- a/Generator/Generator/BuiltinGen.swift +++ b/Generator/Generator/BuiltinGen.swift @@ -379,7 +379,15 @@ func generateBuiltinMethods (_ p: Printer, p ("@discardableResult /* 1: \(m.name) */ ") } - p ("public\(isStruct ? "" : " final") func \(escapeSwift (snakeToCamel(m.name))) (\(args))\(retSig)") { + let keyword: String + if m.isStatic { + keyword = " static" + } else if !isStruct { + keyword = " final" + } else { + keyword = "" + } + p ("public\(keyword) func \(escapeSwift (snakeToCamel(m.name))) (\(args))\(retSig)") { generateMethodCall (p, typeName: typeName, methodToCall: ptrName, godotReturnType: m.returnType, isStatic: m.isStatic, arguments: m.arguments, kind: .methodCall) }