Strip "get_" prefix from engine getters · godot-rust/gdext@d36a144 (original) (raw)

`@@ -176,6 +176,69 @@ pub(crate) fn is_excluded_from_default_params(class_name: Option<&TyName>, godot

`

176

176

`}

`

177

177

`}

`

178

178

``

``

179

`+

#[rustfmt::skip]

`

``

180

`+

pub(crate) fn keeps_get_prefix(class_name: &TyName, method: &ClassMethod) -> bool {

`

``

181

`+

// Also list those which have default parameters and can be called with 0 arguments. Those are anyway

`

``

182

`+

// excluded at the moment, but this is more robust if the outer logic changes.

`

``

183

+

``

184

`+

match (class_name.godot_ty.as_str(), method.name.as_str()) {

`

``

185

`+

// For Object

`

``

186

`+

// https://docs.godotengine.org/en/stable/classes/class_object.html#methods

`

``

187

`+

| ("Object", "get_class")

`

``

188

`+

| ("Object", "get_instance_id") // currently removed, but would be shadowed by Gd::instance_id().

`

``

189

`+

| ("Object", "get_script")

`

``

190

`+

| ("Object", "get_script_instance")

`

``

191

`+

// The following ones often have slight variations with parameters, so it's more consistent to have get_signal_list() and

`

``

192

`+

// get_signal_connection_list(signal). This may change in the future.

`

``

193

`+

| ("Object", "get_incoming_connections")

`

``

194

`+

| ("Object", "get_meta_list")

`

``

195

`+

| ("Object", "get_method_list")

`

``

196

`+

| ("Object", "get_property_list")

`

``

197

`+

| ("Object", "get_signal_list")

`

``

198

+

``

199

`+

// For Node

`

``

200

`+

// https://docs.godotengine.org/en/stable/classes/class_node.html#methods

`

``

201

`+

// TODO get_child_count?

`

``

202

+

``

203

`+

// https://docs.godotengine.org/en/stable/classes/class_fileaccess.html#methods

`

``

204

`+

| ("FileAccess", "get_16")

`

``

205

`+

| ("FileAccess", "get_32")

`

``

206

`+

| ("FileAccess", "get_64")

`

``

207

`+

| ("FileAccess", "get_8")

`

``

208

`+

| ("FileAccess", "get_as_text")

`

``

209

`+

| ("FileAccess", "get_csv_line")

`

``

210

`+

| ("FileAccess", "get_double")

`

``

211

`+

| ("FileAccess", "get_error") // If this has side effects, should definitely keep prefix. Not clear.

`

``

212

`+

| ("FileAccess", "get_float")

`

``

213

`+

| ("FileAccess", "get_line")

`

``

214

`+

| ("FileAccess", "get_open_error")

`

``

215

`+

| ("FileAccess", "get_pascal_string")

`

``

216

`+

| ("FileAccess", "get_real")

`

``

217

`+

| ("FileAccess", "get_var")

`

``

218

+

``

219

`+

// https://docs.godotengine.org/en/stable/classes/class_streampeer.html#methods

`

``

220

`+

// do for 8,16,32,64 and u*

`

``

221

`+

| ("StreamPeer", "get_16")

`

``

222

`+

| ("StreamPeer", "get_32")

`

``

223

`+

| ("StreamPeer", "get_64")

`

``

224

`+

| ("StreamPeer", "get_8")

`

``

225

`+

| ("StreamPeer", "get_double")

`

``

226

`+

| ("StreamPeer", "get_float")

`

``

227

`+

| ("StreamPeer", "get_string")

`

``

228

`+

| ("StreamPeer", "get_u16")

`

``

229

`+

| ("StreamPeer", "get_u32")

`

``

230

`+

| ("StreamPeer", "get_u64")

`

``

231

`+

| ("StreamPeer", "get_u8")

`

``

232

`+

| ("StreamPeer", "get_utf8_string")

`

``

233

`+

| ("StreamPeer", "get_var")

`

``

234

+

``

235

`+

// Others that conflict with a verb:

`

``

236

`+

| ("AnimationPlayer", "get_queue")

`

``

237

+

``

238

`+

=> true, _ => false,

`

``

239

`+

}

`

``

240

`+

}

`

``

241

+

179

242

`` /// True if builtin method is excluded. Does NOT check for type exclusion; use [is_builtin_type_deleted] for that.

``

180

243

`pub(crate) fn is_builtin_deleted(_class_name: &TyName, method: &BuiltinClassMethod) -> bool {

`

181

244

`// Currently only deleted if codegen.

`