GDScript: properly set type of local variable initialization
Properly sets the type of the identifier for the local variable that is stored in the assignment operation. This makes sure that the compiler is aware of typing for local variables when they are initialized with the declaration.
This commit is contained in:
parent
ae21664655
commit
899f7999b4
|
@ -8047,6 +8047,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
|
||||||
|
|
||||||
last_var_assign = lv->assign;
|
last_var_assign = lv->assign;
|
||||||
if (lv->assign) {
|
if (lv->assign) {
|
||||||
|
lv->assign_op->arguments[0]->set_datatype(lv->datatype);
|
||||||
DataType assign_type = _reduce_node_type(lv->assign);
|
DataType assign_type = _reduce_node_type(lv->assign);
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (assign_type.has_type && assign_type.kind == DataType::BUILTIN && assign_type.builtin_type == Variant::NIL) {
|
if (assign_type.has_type && assign_type.kind == DataType::BUILTIN && assign_type.builtin_type == Variant::NIL) {
|
||||||
|
|
Loading…
Reference in New Issue