From bd72bd4d6854f281d7f999ab41330063766fa6e9 Mon Sep 17 00:00:00 2001 From: Duncan Sparks Date: Sun, 23 Aug 2020 09:01:23 -0700 Subject: [PATCH] Fix redundant check in binding_generator.py --- binding_generator.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/binding_generator.py b/binding_generator.py index 9b54b22c..b4bfc2a5 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -291,24 +291,22 @@ def generate_class_header(used_classes, c, use_template_get_node): source.append(vararg_templates) - if use_template_get_node: + if use_template_get_node and class_name == "Node": # Extra definition for template get_node that calls the renamed get_node_internal; has a default template parameter for backwards compatibility. - if class_name == "Node": - source.append("\ttemplate ") - source.append("\tT *get_node(const NodePath path) const {") - source.append("\t\treturn Object::cast_to(get_node_internal(path));") - source.append("\t}") + source.append("\ttemplate ") + source.append("\tT *get_node(const NodePath path) const {") + source.append("\t\treturn Object::cast_to(get_node_internal(path));") + source.append("\t}") source.append("};") source.append("") # ...And a specialized version so we don't unnecessarily cast when using the default. - if class_name == "Node": - source.append("template <>") - source.append("inline Node *Node::get_node(const NodePath path) const {") - source.append("\treturn get_node_internal(path);") - source.append("}") - source.append("") + source.append("template <>") + source.append("inline Node *Node::get_node(const NodePath path) const {") + source.append("\treturn get_node_internal(path);") + source.append("}") + source.append("") else: source.append("};") source.append("")