You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
GDScript: Remove some unnecessary booleans
Co-authored-by: HolonProduction <holonproduction@gmail.com>
This commit is contained in:
@@ -48,29 +48,27 @@ public:
|
||||
Vector<GDScriptDataType> container_element_types;
|
||||
|
||||
enum Kind {
|
||||
UNINITIALIZED,
|
||||
VARIANT, // Can be any type.
|
||||
BUILTIN,
|
||||
NATIVE,
|
||||
SCRIPT,
|
||||
GDSCRIPT,
|
||||
};
|
||||
|
||||
Kind kind = UNINITIALIZED;
|
||||
Kind kind = VARIANT;
|
||||
|
||||
bool has_type = false;
|
||||
Variant::Type builtin_type = Variant::NIL;
|
||||
StringName native_type;
|
||||
Script *script_type = nullptr;
|
||||
Ref<Script> script_type_ref;
|
||||
|
||||
bool is_type(const Variant &p_variant, bool p_allow_implicit_conversion = false) const {
|
||||
if (!has_type) {
|
||||
return true; // Can't type check
|
||||
}
|
||||
_FORCE_INLINE_ bool has_type() const { return kind != VARIANT; }
|
||||
|
||||
bool is_type(const Variant &p_variant, bool p_allow_implicit_conversion = false) const {
|
||||
switch (kind) {
|
||||
case UNINITIALIZED:
|
||||
break;
|
||||
case VARIANT: {
|
||||
return true;
|
||||
} break;
|
||||
case BUILTIN: {
|
||||
Variant::Type var_type = p_variant.get_type();
|
||||
bool valid = builtin_type == var_type;
|
||||
@@ -182,7 +180,7 @@ public:
|
||||
}
|
||||
|
||||
bool can_contain_object() const {
|
||||
if (has_type && kind == BUILTIN) {
|
||||
if (kind == BUILTIN) {
|
||||
switch (builtin_type) {
|
||||
case Variant::ARRAY:
|
||||
if (has_container_element_type(0)) {
|
||||
@@ -236,7 +234,6 @@ public:
|
||||
|
||||
bool operator==(const GDScriptDataType &p_other) const {
|
||||
return kind == p_other.kind &&
|
||||
has_type == p_other.has_type &&
|
||||
builtin_type == p_other.builtin_type &&
|
||||
native_type == p_other.native_type &&
|
||||
(script_type == p_other.script_type || script_type_ref == p_other.script_type_ref) &&
|
||||
@@ -249,7 +246,6 @@ public:
|
||||
|
||||
void operator=(const GDScriptDataType &p_other) {
|
||||
kind = p_other.kind;
|
||||
has_type = p_other.has_type;
|
||||
builtin_type = p_other.builtin_type;
|
||||
native_type = p_other.native_type;
|
||||
script_type = p_other.script_type;
|
||||
|
||||
Reference in New Issue
Block a user