-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Improve function detection to avoid accidental conversion #75002
Improve function detection to avoid accidental conversion #75002
Conversation
444e457
to
b98e643
Compare
Technically other preceding characters like Otherwise, the approach in this PR is probably "good enough" for the use case, so we can also stick to this if preferred. |
I thought about this as well. But wasn't sure if I may miss something. |
Yeah that seems correct: Line 3392 in 26a5841
There could also be things like |
b98e643
to
28e451d
Compare
Changed the logic to match the if statement above. This is approach is much safer. Thanks! |
28e451d
to
4b32ad5
Compare
I think it makes sense to also check for the "$" sign. Since in this case it is also not a function call. |
4b32ad5
to
e7acb2a
Compare
e7acb2a
to
7829dff
Compare
7829dff
to
2db1db9
Compare
2db1db9
to
d9ee20f
Compare
d9ee20f
to
76c2c7a
Compare
When converting a function like "connect(", we do not want to detect a function like "reconnect(" as a possible candidate for conversion.
76c2c7a
to
bd599d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay reviewing. Looks good to me!
Thanks! |
Thanks so much! |
Fixes: #74650
This PR improves the function detection in the project converter by checking if the function really is standalone and not part of a method or similar.
E.g. when checking and converting a function like
connect(
, we do not want to detect and convert a function likereconnect(
.We achieve this by checking the previous character when the function name is detected in a line.
To recognize the function as standalone and not as part of a name, the following previous characters are checked:
A-Za-z0-9
->econnect
or9connect
- not a function call_
->_connect
- not a function call$
->$connect
- not a function call@
->@connect
- not a function callOr in other words:
connect()
is a function callconnect()
is a function callobject.connect()
is a function call