-
Notifications
You must be signed in to change notification settings - Fork 842
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
language/lexer: fixes panic on empty blockstrings #456
Conversation
if isBlank := lineIsBlank(lines[0]); !isBlank { | ||
break | ||
} | ||
for len(lines) > 0 && lineIsBlank(lines[0]) { |
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.
Consolidates the following couple of loops to remove blank lines, follows the graphql-js reference implementation:
// Remove leading and trailing blank lines.
while (lines.length > 0 && isBlank(lines[0])) {
lines.shift();
}
while (lines.length > 0 && isBlank(lines[lines.length - 1])) {
lines.pop();
}
- Ref: Link
If you could take a look to this PR when you get a chance 😃 — A PR review approval is appreciate it. /cc: @miiton @Fontinalis |
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.
LGTM 🤩
Overview
Test plan
go test ./...