diff options
author | Dmitrii Maganov <vonagam@gmail.com> | 2022-12-22 22:43:36 +0200 |
---|---|---|
committer | Dmitrii Maganov <vonagam@gmail.com> | 2023-01-06 01:10:04 +0200 |
commit | a1d06749f18c3f47c6443ece2ec625d8ee5f1761 (patch) | |
tree | 542a407dd9c60c76c3f2acf1a76f06cf44b1dfde /modules/gdscript/gdscript_editor.cpp | |
parent | 1d14c054a12dacdc193b589e4afb0ef319ee2aae (diff) |
Unify typing of variables, constants and parameters in GDScript
Diffstat (limited to 'modules/gdscript/gdscript_editor.cpp')
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 8027c41a8c..6f8b90bd06 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -683,37 +683,37 @@ static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_functio arghint += par->identifier->name.operator String() + ": " + par->get_datatype().to_string(); } - if (par->default_value) { + if (par->initializer) { String def_val = "<unknown>"; - switch (par->default_value->type) { + switch (par->initializer->type) { case GDScriptParser::Node::LITERAL: { - const GDScriptParser::LiteralNode *literal = static_cast<const GDScriptParser::LiteralNode *>(par->default_value); + const GDScriptParser::LiteralNode *literal = static_cast<const GDScriptParser::LiteralNode *>(par->initializer); def_val = literal->value.get_construct_string(); } break; case GDScriptParser::Node::IDENTIFIER: { - const GDScriptParser::IdentifierNode *id = static_cast<const GDScriptParser::IdentifierNode *>(par->default_value); + const GDScriptParser::IdentifierNode *id = static_cast<const GDScriptParser::IdentifierNode *>(par->initializer); def_val = id->name.operator String(); } break; case GDScriptParser::Node::CALL: { - const GDScriptParser::CallNode *call = static_cast<const GDScriptParser::CallNode *>(par->default_value); + const GDScriptParser::CallNode *call = static_cast<const GDScriptParser::CallNode *>(par->initializer); if (call->is_constant && call->reduced) { def_val = call->function_name.operator String() + call->reduced_value.operator String(); } } break; case GDScriptParser::Node::ARRAY: { - const GDScriptParser::ArrayNode *arr = static_cast<const GDScriptParser::ArrayNode *>(par->default_value); + const GDScriptParser::ArrayNode *arr = static_cast<const GDScriptParser::ArrayNode *>(par->initializer); if (arr->is_constant && arr->reduced) { def_val = arr->reduced_value.operator String(); } } break; case GDScriptParser::Node::DICTIONARY: { - const GDScriptParser::DictionaryNode *dict = static_cast<const GDScriptParser::DictionaryNode *>(par->default_value); + const GDScriptParser::DictionaryNode *dict = static_cast<const GDScriptParser::DictionaryNode *>(par->initializer); if (dict->is_constant && dict->reduced) { def_val = dict->reduced_value.operator String(); } } break; case GDScriptParser::Node::SUBSCRIPT: { - const GDScriptParser::SubscriptNode *sub = static_cast<const GDScriptParser::SubscriptNode *>(par->default_value); + const GDScriptParser::SubscriptNode *sub = static_cast<const GDScriptParser::SubscriptNode *>(par->initializer); if (sub->is_constant) { if (sub->datatype.kind == GDScriptParser::DataType::ENUM) { def_val = sub->get_datatype().to_string(); @@ -1856,9 +1856,9 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context, } break; case GDScriptParser::SuiteNode::Local::PARAMETER: - if (local.parameter->default_value) { - last_assign_line = local.parameter->default_value->end_line; - last_assigned_expression = local.parameter->default_value; + if (local.parameter->initializer) { + last_assign_line = local.parameter->initializer->end_line; + last_assigned_expression = local.parameter->initializer; } is_function_parameter = true; break; @@ -1939,12 +1939,12 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context, if ((!id_type.is_set() || id_type.is_variant()) && parameter->get_datatype().is_hard_type()) { id_type = parameter->get_datatype(); } - if (parameter->default_value) { + if (parameter->initializer) { GDScriptParser::CompletionContext c = p_context; c.current_function = parent_function; c.current_class = base_type.class_type; c.base = nullptr; - if (_guess_expression_type(c, parameter->default_value, r_type)) { + if (_guess_expression_type(c, parameter->initializer, r_type)) { return true; } } |