Skip to content
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 expression parse order #3942

Merged
merged 1 commit into from
May 3, 2021

Conversation

TPGamesNL
Copy link
Member

Description

The order of the Skript#expressions field was partially reversed:
https://pastebin.com/auvMwfnc: Registered is the order it was registered, Detected is the order of the list after registration. Note that the order of registration shouldn't exactly match the order of the list, as expression with the same ExpressionType should be grouped together. Also note that ExprDamageCause is registered earlier due to BukkitClasses#L1302.

This is the new result: https://pastebin.com/b41zBNrV


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@TPGamesNL TPGamesNL added enhancement Feature request, an issue about something that could be improved, or a PR improving something. 2.5 labels May 3, 2021
@FranKusmiruk
Copy link
Member

I am failing to understand how this changes aynthing at all? Or is it only useful to those who make use of the pre load event to change order?

@TPGamesNL
Copy link
Member Author

I am failing to understand how this changes aynthing at all? Or is it only useful to those who make use of the pre load event to change order?

For example, if you have two expressions with the same ExpressionType: ExprA and ExprB. You register ExprA before ExprB. If there is a string matching both expressions (patternwise and init-wise), you'd expect ExprA to be chosen (since it makes more sense with the order of registration, and because that's how all other eyntax elements work), but ExprB will be chosen instead.
This would be very rare to come across however, because this doesn't apply to two expressions with differing ExpressionTypes, they are (relatively) in the right order.

@FranKusmiruk FranKusmiruk merged commit 9884fb1 into SkriptLang:master May 3, 2021
@TPGamesNL TPGamesNL deleted the fix/expr-parse-order branch May 4, 2021 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants