From 55b4e0c44aa68c5ffcd77f83a6e015862434ba25 Mon Sep 17 00:00:00 2001 From: Thakee Nathees Date: Sat, 2 May 2020 16:20:39 +0530 Subject: [PATCH] parser error for static func access non-static variables Fix: #38408 (cherry picked from commit ce978517e0cbc9976208a7f69ae2c143ae28310b) --- modules/gdscript/gdscript_parser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 798ff5cf0d7..5e57f79b3a2 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -7571,6 +7571,10 @@ GDScriptParser::DataType GDScriptParser::_reduce_identifier_type(const DataType } if (_get_member_type(base_type, p_identifier, member_type)) { + if (!p_base_type && current_function && current_function->_static) { + _set_error("Can't access member variable (\"" + p_identifier.operator String() + "\") from a static function.", p_line); + return DataType(); + } return member_type; }