-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix and small optimization #2
Fix and small optimization #2
Conversation
#Conflicts: # modules/gdscript/gdscript_cache.cpp
- Now when we create a trait, the first line is "trait_name trait extends parent". - Methods list now doesn't show non-existant function inherited from the trait. - Fixed the ability to create 2 GDT with the same name. - Fixed a gutter icon bug for non-existant function that where inside the trait but not inside the script.
…ript) was one the same line: The gutter icon for virtual function wasn't shown. - Did a little optimization on the "get_function_names_recursively" function (using Vector and not HashMap) this allow us to gain ~10% in time when running (HashMap average ~= 9.8µs / Vector average ~= 8.8µs).
… feature/traits
So, i'm probably gonna have to just pull the diff here and do fix this PR on my side because i had to create a new branch for the trait feature called feature/traits-fix No big deal i can fix it, but it does mess up the credit on the log so i'll just reference this PR |
Okk, no problem at all, don't worry :) |
Closing this, We need to re-open a new PR with the correct branch this branch was very broken and i had to create a new branch to fix it |
So as I said here: Redot-Experimental#11 (comment) there was a bug when we get 2 functions on the same line in trait file and script file. This is now fixed!
Also I did a small optimization on the
get_function_names_recursively
function insidegdscript_editor.cpp
this should allow us to gain ~10% (from 9.8µs to 8.8µs).In fact: The fix and the optimization are linked.
Before when Redot was getting the function name inside the script, it was checking for the function name inside the script file (.gd) and added them to a
HashMap<int, String>
(int = starting line of the function, string = function name), then it was checking for the function name inside the traits files (.gdt), but then if 1 function was on the same line than the script file, the function inside the traits files would "override" it.Now they are "pre-concat" then added to a vector.
Some explanation:
First, a simple example:
Here we have 2 functions on the same line (3): MyTraitFunction and _process, Redot would first get the function from the script so
MyScript.gd
here, giving this result:Then Redot would get the function from the trait, here
MyTrait.gdt
, but as the functionMyTraitFunction
is on the same line, here is the result:We can see that we losed "_process".
In this fix, as we use vector, we directly format the string as awaited for next function, with the new version, we would get something like that: