|
@@ -7298,7 +7298,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
|
|
DataType cont = _resolve_type(c.type, c.expression->line);
|
|
|
DataType expr = _resolve_type(c.expression->get_datatype(), c.expression->line);
|
|
|
|
|
|
- if (!_is_type_compatible(cont, expr)) {
|
|
|
+ if (check_types && !_is_type_compatible(cont, expr)) {
|
|
|
_set_error("Constant value type (" + expr.to_string() + ") is not compatible with declared type (" + cont.to_string() + ").",
|
|
|
c.expression->line);
|
|
|
return;
|
|
@@ -7342,7 +7342,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
|
|
|
if (v.expression) {
|
|
|
DataType expr_type = _reduce_node_type(v.expression);
|
|
|
|
|
|
- if (!_is_type_compatible(v.data_type, expr_type)) {
|
|
|
+ if (check_types && !_is_type_compatible(v.data_type, expr_type)) {
|
|
|
// Try supertype test
|
|
|
if (_is_type_compatible(expr_type, v.data_type)) {
|
|
|
_mark_line_as_unsafe(v.line);
|
|
@@ -7804,7 +7804,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (!lh_type.has_type) {
|
|
|
+ if (!lh_type.has_type && check_types) {
|
|
|
if (op->arguments[0]->type == Node::TYPE_OPERATOR) {
|
|
|
_mark_line_as_unsafe(op->line);
|
|
|
}
|
|
@@ -7826,7 +7826,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
|
|
bool valid = false;
|
|
|
rh_type = _get_operation_type(oper, lh_type, arg_type, valid);
|
|
|
|
|
|
- if (!valid) {
|
|
|
+ if (check_types && !valid) {
|
|
|
_set_error("Invalid operand types ('" + lh_type.to_string() + "' and '" + arg_type.to_string() +
|
|
|
"') to assignment operator '" + Variant::get_operator_name(oper) + "'.",
|
|
|
op->line);
|
|
@@ -7849,7 +7849,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
|
|
}
|
|
|
#endif // DEBUG_ENABLED
|
|
|
|
|
|
- if (!_is_type_compatible(lh_type, rh_type)) {
|
|
|
+ if (check_types && !_is_type_compatible(lh_type, rh_type)) {
|
|
|
// Try supertype test
|
|
|
if (_is_type_compatible(rh_type, lh_type)) {
|
|
|
_mark_line_as_unsafe(op->line);
|
|
@@ -7885,9 +7885,11 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
|
|
#endif // DEBUG_ENABLED
|
|
|
}
|
|
|
}
|
|
|
+#ifdef DEBUG_ENABLED
|
|
|
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
|
|
|
} break;
|
|
|
case OperatorNode::OP_CALL:
|
|
|
case OperatorNode::OP_PARENT_CALL: {
|
|
@@ -8124,7 +8126,6 @@ Error GDScriptParser::_parse(const String &p_base_path) {
|
|
|
check_types = false;
|
|
|
#endif
|
|
|
|
|
|
-#ifdef DEBUG_ENABLED
|
|
|
// Resolve all class-level stuff before getting into function blocks
|
|
|
_check_class_level_types(main_class);
|
|
|
|
|
@@ -8139,6 +8140,8 @@ Error GDScriptParser::_parse(const String &p_base_path) {
|
|
|
return ERR_PARSE_ERROR;
|
|
|
}
|
|
|
|
|
|
+#ifdef DEBUG_ENABLED
|
|
|
+
|
|
|
// Resolve warning ignores
|
|
|
Vector<Pair<int, String> > warning_skips = tokenizer->get_warning_skips();
|
|
|
bool warning_is_error = GLOBAL_GET("debug/gdscript/warnings/treat_warnings_as_errors").booleanize();
|