summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gdscript_editor.cpp')
-rw-r--r--modules/gdscript/gdscript_editor.cpp43
1 files changed, 13 insertions, 30 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 73661855b4..372a726d71 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -912,7 +912,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
}
} break;
case GDScriptParser::DataType::NATIVE: {
- StringName type = GDScriptParser::get_real_class_name(base_type.native_type);
+ StringName type = base_type.native_type;
if (!ClassDB::class_exists(type)) {
return;
}
@@ -1326,10 +1326,7 @@ static bool _guess_expression_type(GDScriptParser::CompletionContext &p_context,
native_type.kind = GDScriptParser::DataType::NATIVE;
native_type.native_type = native_type.script_type->get_instance_base_type();
if (!ClassDB::class_exists(native_type.native_type)) {
- native_type.native_type = String("_") + native_type.native_type;
- if (!ClassDB::class_exists(native_type.native_type)) {
- native_type.kind = GDScriptParser::DataType::UNRESOLVED;
- }
+ native_type.kind = GDScriptParser::DataType::UNRESOLVED;
}
}
}
@@ -1765,9 +1762,8 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context,
base_type = GDScriptParser::DataType();
break;
}
- StringName real_native = GDScriptParser::get_real_class_name(base_type.native_type);
MethodInfo info;
- if (ClassDB::get_method_info(real_native, p_context.current_function->identifier->name, &info)) {
+ if (ClassDB::get_method_info(base_type.native_type, p_context.current_function->identifier->name, &info)) {
for (const PropertyInfo &E : info.arguments) {
if (E.name == p_identifier) {
r_type = _type_from_property(E);
@@ -1836,13 +1832,12 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context,
}
// Check ClassDB.
- StringName class_name = GDScriptParser::get_real_class_name(p_identifier);
- if (ClassDB::class_exists(class_name) && ClassDB::is_class_exposed(class_name)) {
+ if (ClassDB::class_exists(p_identifier) && ClassDB::is_class_exposed(p_identifier)) {
r_type.type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;
r_type.type.kind = GDScriptParser::DataType::NATIVE;
r_type.type.native_type = p_identifier;
r_type.type.is_constant = true;
- r_type.type.is_meta_type = !Engine::get_singleton()->has_singleton(class_name);
+ r_type.type.is_meta_type = !Engine::get_singleton()->has_singleton(p_identifier);
r_type.value = Variant();
}
@@ -1951,7 +1946,7 @@ static bool _guess_identifier_type_from_base(GDScriptParser::CompletionContext &
}
} break;
case GDScriptParser::DataType::NATIVE: {
- StringName class_name = GDScriptParser::get_real_class_name(base_type.native_type);
+ StringName class_name = base_type.native_type;
if (!ClassDB::class_exists(class_name)) {
return false;
}
@@ -2113,11 +2108,10 @@ static bool _guess_method_return_type_from_base(GDScriptParser::CompletionContex
}
} break;
case GDScriptParser::DataType::NATIVE: {
- StringName native = GDScriptParser::get_real_class_name(base_type.native_type);
- if (!ClassDB::class_exists(native)) {
+ if (!ClassDB::class_exists(base_type.native_type)) {
return false;
}
- MethodBind *mb = ClassDB::get_method(native, p_method);
+ MethodBind *mb = ClassDB::get_method(base_type.native_type, p_method);
if (mb) {
r_type = _type_from_property(mb->get_return_info());
return true;
@@ -2209,7 +2203,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
base_type = base_type.class_type->base_type;
} break;
case GDScriptParser::DataType::NATIVE: {
- StringName class_name = GDScriptParser::get_real_class_name(base_type.native_type);
+ StringName class_name = base_type.native_type;
if (!ClassDB::class_exists(class_name)) {
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
break;
@@ -2592,7 +2586,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
break;
}
- StringName class_name = GDScriptParser::get_real_class_name(native_type.native_type);
+ StringName class_name = native_type.native_type;
if (!ClassDB::class_exists(class_name)) {
break;
}
@@ -2821,7 +2815,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
}
} break;
case GDScriptParser::DataType::NATIVE: {
- StringName class_name = GDScriptParser::get_real_class_name(base_type.native_type);
+ StringName class_name = base_type.native_type;
if (!ClassDB::class_exists(class_name)) {
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
break;
@@ -2873,11 +2867,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
StringName parent = ClassDB::get_parent_class(class_name);
if (parent != StringName()) {
- if (String(parent).begins_with("_")) {
- base_type.native_type = String(parent).substr(1);
- } else {
- base_type.native_type = parent;
- }
+ base_type.native_type = parent;
} else {
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
}
@@ -2931,18 +2921,11 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
}
::Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol, const String &p_path, Object *p_owner, LookupResult &r_result) {
- //before parsing, try the usual stuff
+ // Before parsing, try the usual stuff
if (ClassDB::class_exists(p_symbol)) {
r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
r_result.class_name = p_symbol;
return OK;
- } else {
- String under_prefix = "_" + p_symbol;
- if (ClassDB::class_exists(under_prefix)) {
- r_result.type = ScriptLanguage::LookupResult::RESULT_CLASS;
- r_result.class_name = p_symbol;
- return OK;
- }
}
for (int i = 0; i < Variant::VARIANT_MAX; i++) {