-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Godot] Implement access modifiers, private and protected, to GDScript to protect a class member from being accessed externally. #734
base: master
Are you sure you want to change the base?
Conversation
It is simply GDScript, also what is the reasoning for closing your Godot PR? |
This is great! Has anyone tested this ? Also does this work with autocomplete? |
Autocomplete, or intelliguess, is planned (in the check list of the top thread). But according to original proposal, it seems that the original proposer wanted to make a ordered list of the autocomplete. |
Btw, currently a C# script can painlessly access a private or protected member in GDScript, but I haven't checked runtime and vm how C#'s |
0ab9d2b
to
8c028ad
Compare
9415389
to
96bfd8a
Compare
This is my first contribution to redot. If there is any mistake, please let me know and I'm here to hear that. :)
Trying implementing redot-proposal-#7.
This pr provides RDScript users a way to protect their members accessibility, and prevent any illegal access from external classes.
We will have
@private
and@protected
annotations in RDScript soon:Introduction of new annotations
@private
@private
annotation allows a member (currently a constant, a variable or a method) to be accessible only within the current class scope:@protected
@protected
annotation allows a member (currently a constant, a variable or a method) to be accessible only within the current class scope, or the scope of derived classes:Common features:
@private
or@protected
will hide its documentation from auto-generated doc API, even if you use##
to document it (except@export_*
-ed properties and signals).Remaining WIP
reduce_identifier()
(√) andreduce_call()
. (RDScriptAnalyzer)set()
(Set()
in C#) andget()
(Get()
in C#) unable to access external protected members. (RDScriptCompiler & RDScriptVM)@private
and@protected
should be keywords or annotations. Allow@export_*
work with@private
and@protected
Remaining WIP after being converted into Review
.gd
and.out
files. (Unit test)Tracking after this PR gets merged:
Closes Redot-Engine/redot-proposals#7