diff options
author | George Marques <george@gmarqu.es> | 2020-01-08 11:36:50 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-01-08 11:36:50 -0300 |
commit | 899f7999b4cdc0ed52cc9961ad4340f8b86596c8 (patch) | |
tree | 7bf0ab32a5f03c231e9d1e7928a70ab9f10d9d27 /modules/gdscript/gdscript_parser.cpp | |
parent | ae21664655a16526b1a8e3e30f4e03d9a7c9c67c (diff) | |
download | redot-engine-899f7999b4cdc0ed52cc9961ad4340f8b86596c8.tar.gz |
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.
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 112569a8d6..4a28114a7d 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -8047,6 +8047,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { last_var_assign = lv->assign; if (lv->assign) { + lv->assign_op->arguments[0]->set_datatype(lv->datatype); DataType assign_type = _reduce_node_type(lv->assign); #ifdef DEBUG_ENABLED if (assign_type.has_type && assign_type.kind == DataType::BUILTIN && assign_type.builtin_type == Variant::NIL) { |