summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/io/resource_loader.cpp5
-rw-r--r--editor/project_export.cpp6
-rw-r--r--main/tests/test_gdscript.cpp24
-rw-r--r--modules/gdscript/gdscript_functions.cpp7
-rw-r--r--modules/gdscript/gdscript_parser.cpp16
5 files changed, 47 insertions, 11 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 5d85634895..7471ab4241 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -277,6 +277,11 @@ RES ResourceLoader::_load(const String &p_path, const String &p_original_path, c
ERR_FAIL_COND_V_MSG(found, RES(), "Failed loading resource: " + p_path + ".");
+#ifdef TOOLS_ENABLED
+ FileAccessRef file_check = FileAccess::create(FileAccess::ACCESS_RESOURCES);
+ ERR_FAIL_COND_V_MSG(!file_check->file_exists(p_path), RES(), "Resource file not found: " + p_path + ".");
+#endif
+
ERR_FAIL_V_MSG(RES(), "No loader found for resource: " + p_path + ".");
}
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index d01ea49d66..8245264e0d 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -1178,11 +1178,13 @@ ProjectExportDialog::ProjectExportDialog() {
// Patch packages.
VBoxContainer *patch_vb = memnew(VBoxContainer);
+ sections->add_child(patch_vb);
+ patch_vb->set_name(TTR("Patches"));
+
// FIXME: Patching support doesn't seem properly implemented yet, so we hide it.
// The rest of the code is still kept for now, in the hope that it will be made
// functional and reactivated.
- //sections->add_child(patch_vb);
- patch_vb->set_name(TTR("Patches"));
+ patch_vb->hide();
patches = memnew(Tree);
patch_vb->add_child(patches);
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 729c5f99cf..a6ef0e9cf4 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -671,6 +671,30 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
incr += 2;
} break;
+ case GDScriptFunction::OPCODE_ASSIGN_TYPED_BUILTIN: {
+
+ txt += " assign typed builtin (";
+ txt += Variant::get_type_name((Variant::Type)code[ip + 1]);
+ txt += ") ";
+ txt += DADDR(2);
+ txt += " = ";
+ txt += DADDR(3);
+ incr += 4;
+
+ } break;
+ case GDScriptFunction::OPCODE_ASSIGN_TYPED_NATIVE: {
+ Variant className = func.get_constant(code[ip + 1]);
+ GDScriptNativeClass *nc = Object::cast_to<GDScriptNativeClass>(className.operator Object *());
+
+ txt += " assign typed native (";
+ txt += nc->get_name().operator String();
+ txt += ") ";
+ txt += DADDR(2);
+ txt += " = ";
+ txt += DADDR(3);
+ incr += 4;
+
+ } break;
case GDScriptFunction::OPCODE_CAST_TO_SCRIPT: {
txt += " cast ";
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index e0e95f259e..01d62a1c62 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -2057,12 +2057,13 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
mi.return_val.type = Variant::BOOL;
return mi;
} break;
- case FUNC_MAX: {
+ default: {
ERR_FAIL_V(MethodInfo());
} break;
}
#endif
-
- return MethodInfo();
+ MethodInfo mi;
+ mi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
+ return mi;
}
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 4a28114a7d..0a1eda37ca 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -8192,11 +8192,14 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
if (lh_type.has_type && rh_type.may_yield && op->arguments[1]->type == Node::TYPE_OPERATOR) {
_add_warning(GDScriptWarning::FUNCTION_MAY_YIELD, op->line, _find_function_name(static_cast<OperatorNode *>(op->arguments[1])));
}
-#endif // DEBUG_ENABLED
bool type_match = check_types;
+#endif // DEBUG_ENABLED
if (check_types && !_is_type_compatible(lh_type, rh_type)) {
+#ifdef DEBUG_ENABLED
type_match = false;
+#endif // DEBUG_ENABLED
+
// Try supertype test
if (_is_type_compatible(rh_type, lh_type)) {
_mark_line_as_unsafe(op->line);
@@ -8227,7 +8230,9 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
op->arguments.write[1] = convert_call;
+#ifdef DEBUG_ENABLED
type_match = true; // Since we are converting, the type is matching
+#endif // DEBUG_ENABLED
}
#ifdef DEBUG_ENABLED
if (lh_type.builtin_type == Variant::INT && rh_type.builtin_type == Variant::REAL) {
@@ -8240,8 +8245,10 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
if (!rh_type.has_type && (op->op != OperatorNode::OP_ASSIGN || lh_type.has_type || op->arguments[0]->type == Node::TYPE_OPERATOR)) {
_mark_line_as_unsafe(op->line);
}
-#endif // DEBUG_ENABLED
op->datatype.has_type = type_match;
+#else
+ op->datatype.has_type = false;
+#endif // DEBUG_ENABLED
} break;
case OperatorNode::OP_CALL:
case OperatorNode::OP_PARENT_CALL: {
@@ -8484,11 +8491,8 @@ Error GDScriptParser::_parse(const String &p_base_path) {
current_class = main_class;
current_function = NULL;
current_block = NULL;
-#ifdef DEBUG_ENABLED
+
if (for_completion) check_types = false;
-#else
- check_types = false;
-#endif
// Resolve all class-level stuff before getting into function blocks
_check_class_level_types(main_class);