-
Notifications
You must be signed in to change notification settings - Fork 832
Fixed line directive ranges when not applying a line directive #7011
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
cartermp
left a comment
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.
Stupid question time: this doesn't lead to big allocations, right? Since this is just adding a newline to the buffer, not the whole file?
It doesn't add it to the file, just the buffer. We also do this sort of thing in other places in |
| if not skip then (HASH_LINE (LexCont.Token !args.ifdefStack)) else token args skip lexbuf } | ||
| else | ||
| // add a newline when we don't apply a directive since we consumed a newline getting here | ||
| newline lexbuf |
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'm actually unsure about putting this here.
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 can confirm this is needed as well.
I tested by turning "skip" off.
|
|
||
| else | ||
| // add a newline when we don't apply a directive since we consumed a newline getting here | ||
| newline lexbuf |
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.
This is the line that really fixes the problem.
|
This is great, you see that @smoothdeveloper :)? |
Resolves this issue: #7000
Lexing a line directive would consume a newline which would put the LexBuffer in an invalid state, but is adjusted once the line directive was applied. In tooling, we disable applying the line directive which means the LexBuffer would remain in an invalid state. Adding a newline corrects this in cases where we don't apply the line directive.