|
@@ -296,7 +296,7 @@ ScriptInstance *GDScript::instance_create(Object *p_this) {
|
|
|
if (top->native.is_valid()) {
|
|
|
if (!ClassDB::is_parent_class(p_this->get_class_name(), top->native->get_name())) {
|
|
|
if (ScriptDebugger::get_singleton()) {
|
|
|
- GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
|
|
|
+ GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'");
|
|
|
}
|
|
|
ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be instanced in object of type '" + p_this->get_class() + "'" + ".");
|
|
|
}
|
|
@@ -533,6 +533,14 @@ void GDScript::_set_subclass_path(Ref<GDScript> &p_sc, const String &p_path) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+String GDScript::_get_debug_path() const {
|
|
|
+ if ((get_path().empty() || get_path().find("::") != -1) && !get_name().empty()) {
|
|
|
+ return get_name() + " (" + get_path().get_slice("::", 0) + ")";
|
|
|
+ } else {
|
|
|
+ return get_path();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
Error GDScript::reload(bool p_keep_state) {
|
|
|
GDScriptLanguage::singleton->lock.lock();
|
|
|
bool has_instances = instances.size();
|
|
@@ -560,7 +568,7 @@ Error GDScript::reload(bool p_keep_state) {
|
|
|
Error err = parser.parse(source, basedir, false, path);
|
|
|
if (err) {
|
|
|
if (ScriptDebugger::get_singleton()) {
|
|
|
- GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), parser.get_error_line(), "Parser Error: " + parser.get_error());
|
|
|
+ GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), parser.get_error_line(), "Parser Error: " + parser.get_error());
|
|
|
}
|
|
|
_err_print_error("GDScript::reload", path.empty() ? "built-in" : (const char *)path.utf8().get_data(), parser.get_error_line(), ("Parse Error: " + parser.get_error()).utf8().get_data(), ERR_HANDLER_SCRIPT);
|
|
|
ERR_FAIL_V(ERR_PARSE_ERROR);
|
|
@@ -574,7 +582,7 @@ Error GDScript::reload(bool p_keep_state) {
|
|
|
if (err) {
|
|
|
if (can_run) {
|
|
|
if (ScriptDebugger::get_singleton()) {
|
|
|
- GDScriptLanguage::get_singleton()->debug_break_parse(get_path(), compiler.get_error_line(), "Parser Error: " + compiler.get_error());
|
|
|
+ GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), compiler.get_error_line(), "Parser Error: " + compiler.get_error());
|
|
|
}
|
|
|
_err_print_error("GDScript::reload", path.empty() ? "built-in" : (const char *)path.utf8().get_data(), compiler.get_error_line(), ("Compile Error: " + compiler.get_error()).utf8().get_data(), ERR_HANDLER_SCRIPT);
|
|
|
ERR_FAIL_V(ERR_COMPILATION_FAILED);
|