diff options
author | Thakee Nathees <thakeenathees@gmail.com> | 2020-05-10 10:35:29 +0530 |
---|---|---|
committer | Thakee Nathees <thakeenathees@gmail.com> | 2020-05-13 22:12:23 +0530 |
commit | 687b1941b44f8ed560872cf2892bc66ea586db66 (patch) | |
tree | 6889a397e3ee1044b0b1e64c712d0fa5e475b557 /modules/gdscript | |
parent | ff5dfcdf68c20590bf123ade75ca06ed58276372 (diff) |
set parser error when infer type is null
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index c875846fcc..9337be1fac 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -7829,6 +7829,10 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) { _set_error("The assigned value doesn't have a set type; the variable type can't be inferred.", v.line); return; } + if (expr_type.kind == DataType::BUILTIN && expr_type.builtin_type == Variant::NIL) { + _set_error("The variable type cannot be inferred because its value is \"null\".", v.line); + return; + } v.data_type = expr_type; v.data_type.is_constant = false; } @@ -8211,6 +8215,10 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { _set_error("The assigned value doesn't have a set type; the variable type can't be inferred.", lv->line); return; } + if (assign_type.kind == DataType::BUILTIN && assign_type.builtin_type == Variant::NIL) { + _set_error("The variable type cannot be inferred because its value is \"null\".", lv->line); + return; + } lv->datatype = assign_type; lv->datatype.is_constant = false; } |