You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user