summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2022-11-22 23:09:30 +0100
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-02-07 14:30:16 +0100
commit826e54fa7356a16f67730f08e4a6fcc8c33c6622 (patch)
tree41a48c14ec1787163462327ff3507e745bd27050 /modules
parent3f02cf7ced320f25ac5f4f72d7a57d98296bfcd1 (diff)
Some code simplifications
1. `number_width` isn't used later 2. `return_type` is used only once 3. AudioServer::get_singleton()->get_channel_count() always returns a channel_count of 1 or larger 4. negative `aa->backward` conditional 5. `current_canvas` == `find_world_2d()->get_canvas()` 6. identical if `render_shadows`
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index cd1dcf9a78..602d07d9a7 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -1576,11 +1576,8 @@ void GDScriptAnalyzer::resolve_function_body(GDScriptParser::FunctionNode *p_fun
resolve_suite(p_function->body);
- GDScriptParser::DataType return_type = p_function->body->get_datatype();
-
- if (!p_function->get_datatype().is_hard_type() && return_type.is_set()) {
+ if (!p_function->get_datatype().is_hard_type() && p_function->body->get_datatype().is_set()) {
// Use the suite inferred type if return isn't explicitly set.
- return_type.type_source = GDScriptParser::DataType::INFERRED;
p_function->set_datatype(p_function->body->get_datatype());
} else if (p_function->get_datatype().is_hard_type() && (p_function->get_datatype().kind != GDScriptParser::DataType::BUILTIN || p_function->get_datatype().builtin_type != Variant::NIL)) {
if (!p_function->body->has_return && (p_is_lambda || p_function->identifier->name != GDScriptLanguage::get_singleton()->strings._init)) {