-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
[3.x] Fix parsing 'preload': increase/decrease parenthesis count #52521
[3.x] Fix parsing 'preload': increase/decrease parenthesis count #52521
Conversation
I feel like this is not the proper way to go in this case. If you have something like this: preload(
"res://"
+
"my_resource.tres"
) It won't work with this fix since it only skip newlines right after the opening parenthesis and before the closing one. I know it's a weird construct but functions allow newlines anywhere in the argument expression, so preload should do the same. A way to solve this would be to just increment and decrement the godot/modules/gdscript/gdscript_parser.cpp Line 270 in 673612f
|
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.
Needs changes as advised by @vnen.
2477753
to
2dcb05a
Compare
I've updated the PR. |
2dcb05a
to
835143b
Compare
Tested with a weird case, it seems to work well 👍 const enemy_class = preload(
"res://" +
# Hello :)
"enemies/enemy.gd"
# Hi!
) |
Thanks! |
This PR fixes #52499. The fix is very simple and safe - we just skip newline tokens if we encounter them after the '(' and before the ')'.
This fix is intended only for 3.4 version. The version 4.0 doesn't have this problem since all the parsing code is rewritten.