mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Consolidate behavior for assigning enum types
This makes sure that assigning values to enum-typed variables are consistent. Same enum is always valid, different enum is always invalid (without casting) and assigning `int` creates a warning if there is no casting. There are new test cases to ensure this behavior doesn't break in the future.
This commit is contained in:
parent
82efb1d262
commit
ad6e2e82a9
27 changed files with 185 additions and 29 deletions
|
@ -610,7 +610,7 @@ static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_functio
|
|||
case GDScriptParser::Node::SUBSCRIPT: {
|
||||
const GDScriptParser::SubscriptNode *sub = static_cast<const GDScriptParser::SubscriptNode *>(par->default_value);
|
||||
if (sub->is_constant) {
|
||||
if (sub->datatype.kind == GDScriptParser::DataType::ENUM_VALUE) {
|
||||
if (sub->datatype.kind == GDScriptParser::DataType::ENUM) {
|
||||
def_val = sub->get_datatype().to_string();
|
||||
} else if (sub->reduced) {
|
||||
const Variant::Type vt = sub->reduced_value.get_type();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue