summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThakee Nathees <thakeenathees@gmail.com>2020-05-02 16:20:39 +0530
committerThakee Nathees <thakeenathees@gmail.com>2020-05-03 11:45:11 +0530
commitce978517e0cbc9976208a7f69ae2c143ae28310b (patch)
tree92ecd9a8d524a7e89c91b052acaebd4b89c6e94a
parent92d4a0cbd231508221b0e977ae9a0e9d4207e328 (diff)
parser error for static func access non-static variables
Fix: #38408
-rw-r--r--modules/gdscript/gdscript_parser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index a37fc579e7..5c4b6fe289 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;
}