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

refactor(jsonc): prepare for noUncheckedIndexedAccess #4149

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

syhol
Copy link
Contributor

@syhol syhol commented Jan 10, 2024

Handling all noUncheckedIndexedAccess issues for the jsonc module, tracked in #4040

@syhol syhol requested a review from kt3k as a code owner January 10, 2024 16:09
@github-actions github-actions bot added the jsonc label Jan 10, 2024
@syhol
Copy link
Contributor Author

syhol commented Jan 10, 2024

Tests seem to be a little flakey, nothing to do with this PR though, recommend rerunning the checks.

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you, Simon.

@@ -118,7 +118,7 @@ class JSONCParser {
*#tokenize(): Generator<Token, void> {
for (let i = 0; i < this.#length; i++) {
// skip whitespace
if (this.#whitespace.has(this.#text[i])) {
if (this.#whitespace.has(this.#text[i]!)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: i is a number between 0 and this.#length. this.#length equals this.#text.length, as seen in the constructor. Therefore, this.#text[i] is always defined, and the non-null assertion is justified.

Ditto for the other change.

@iuioiua iuioiua merged commit 7bc2930 into denoland:main Jan 10, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants