diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-09 21:32:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 21:32:28 +0200 |
commit | c04cdc2bf1b02248c880b17deb2f340cdf89134f (patch) | |
tree | af85fe5e99ad563a70a9b3cb6ebe777873bcb064 | |
parent | 4eb566c80cd85fbfd71c4e51349c364b16845b2d (diff) | |
parent | ce978517e0cbc9976208a7f69ae2c143ae28310b (diff) |
Merge pull request #38412 from ThakeeNathees/static-func-var-access
parser error for static func access non-static variables
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 17077567c7..a80582432a 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; } |