-
Notifications
You must be signed in to change notification settings - Fork 85
Fix infix rule CST issues #2023
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
Conversation
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.
See remark below.
// The specified item could be a datatype ($type is symbol), fragment ($type is undefined) or infix rule ($infix exists) | ||
// Only if the $type is a string, we actually assign the element | ||
if (typeof item.$type === 'string') { | ||
if (typeof item.$type === 'string' && !('$infix' in item)) { |
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.
Wrt. performance: Would it be advantageous to add $infix?: boolean
to the type def of item
and just test !item.$infix
?
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.
I don't think it matters, but it makes it more readable 👍
9afd63a
to
b6855fc
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.
Nice!
@msujew should sth like this still happen with 4.0.1 ![]() |
@cdietrich Not really, but I'm not sure whether it's actually feasible to rewrite the whole CST during the binary operation AST rewrite. I'm quite unhappy with the feature myself (see also #1733) - it works better in another project where we embed the CST in the AST (non-langium project). |
Follow up on #2011 which fixes an issue where the infix rules object was stored in the CST
astNode
item by accident.