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

language/lexer: fixes panic on empty blockstrings #456

Merged
merged 5 commits into from
Mar 12, 2019

Conversation

chris-ramon
Copy link
Member

@chris-ramon chris-ramon commented Mar 10, 2019

Overview

Test plan

  • go test ./...

@coveralls
Copy link

Coverage Status

Coverage remained the same at 92.17% when pulling 750c09f on fix-panic-blockstring into c13c47a on master.

if isBlank := lineIsBlank(lines[0]); !isBlank {
break
}
for len(lines) > 0 && lineIsBlank(lines[0]) {
Copy link
Member Author

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();
  }

@chris-ramon
Copy link
Member Author

chris-ramon commented Mar 10, 2019

If you could take a look to this PR when you get a chance 😃 — A PR review approval is appreciate it.

/cc: @miiton @Fontinalis

Copy link
Contributor

@miiton miiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🤩

@chris-ramon chris-ramon merged commit cc858c0 into master Mar 12, 2019
@chris-ramon chris-ramon deleted the fix-panic-blockstring branch March 12, 2019 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants