Skip to content

Commit

Permalink
Merge pull request #88211 from bitwise-aiden/ba-default-arg-hints
Browse files Browse the repository at this point in the history
Add fallback argument hints for default values
  • Loading branch information
akien-mga committed Feb 12, 2024
2 parents 106efa4 + 7ffc246 commit c8b3e39
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/gdscript/gdscript_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,18 +778,24 @@ static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_functio
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();
} else {
def_val = call->function_name.operator String() + (call->arguments.is_empty() ? "()" : "(...)");
}
} break;
case GDScriptParser::Node::ARRAY: {
const GDScriptParser::ArrayNode *arr = static_cast<const GDScriptParser::ArrayNode *>(par->initializer);
if (arr->is_constant && arr->reduced) {
def_val = arr->reduced_value.operator String();
} else {
def_val = arr->elements.is_empty() ? "[]" : "[...]";
}
} break;
case GDScriptParser::Node::DICTIONARY: {
const GDScriptParser::DictionaryNode *dict = static_cast<const GDScriptParser::DictionaryNode *>(par->initializer);
if (dict->is_constant && dict->reduced) {
def_val = dict->reduced_value.operator String();
} else {
def_val = dict->elements.is_empty() ? "{}" : "{...}";
}
} break;
case GDScriptParser::Node::SUBSCRIPT: {
Expand Down

0 comments on commit c8b3e39

Please sign in to comment.