Skip to content

Commit 8fe8947

Browse files
Reimplent soft access restriction for members prefixed with _
1 parent c61d609 commit 8fe8947

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/gdscript/gdscript_warning.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ class GDScriptWarning {
8989
NATIVE_METHOD_OVERRIDE, // The script method overrides a native one, this may not work as intended.
9090
GET_NODE_DEFAULT_WITHOUT_ONREADY, // A class variable uses `get_node()` (or the `$` notation) as its default value, but does not use the @onready annotation.
9191
ONREADY_WITH_EXPORT, // The `@onready` annotation will set the value after `@export` which is likely not intended.
92+
ACCESS_PRIVATE_MEMBER, // Accessing a private member from external places. E.g. accessing an `_`-prefixed member from other classes that are not derived from the class where the member is defined.
93+
CALL_PRIVATE_METHOD, // Calling a private method from external places. E.g. calling an `_`-prefixed method from other classes that are not derived from the class where the method is defined.
9294
#ifndef DISABLE_DEPRECATED
9395
PROPERTY_USED_AS_FUNCTION, // Function not found, but there's a property with the same name.
9496
CONSTANT_USED_AS_FUNCTION, // Function not found, but there's a constant with the same name.
@@ -146,6 +148,8 @@ class GDScriptWarning {
146148
ERROR, // NATIVE_METHOD_OVERRIDE // May not work as expected.
147149
ERROR, // GET_NODE_DEFAULT_WITHOUT_ONREADY // May not work as expected.
148150
ERROR, // ONREADY_WITH_EXPORT // May not work as expected.
151+
WARN, // ACCESS_PRIVATE_MEMBER
152+
WARN, // CALL_PRIVATE_METHOD
149153
#ifndef DISABLE_DEPRECATED
150154
WARN, // PROPERTY_USED_AS_FUNCTION
151155
WARN, // CONSTANT_USED_AS_FUNCTION

0 commit comments

Comments
 (0)