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

fix: js optional chaining with bracket notation #757 #758

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

ksw2000
Copy link
Contributor

@ksw2000 ksw2000 commented Oct 24, 2024

The issue #757 occurs because both m.write(optChainBytes) and the branch inside if isIdent := js.AsIdentifierName(lit.Data[1 : len(lit.Data)-1]); isIdent call m.write(dotBytes), which can result in writing two dots .. simultaneously, causing an error.

The solution is to use an additional boolean variable to control and prevent writing two dots simultaneously. I have also added unit tests to verify this fix and replaced the deprecated ioutil package by os.

@tdewolff
Copy link
Owner

tdewolff commented Oct 24, 2024 via email

@tdewolff tdewolff merged commit 77c1c98 into tdewolff:master Oct 24, 2024
@tdewolff
Copy link
Owner

I've merged the PR and updated it, releasing new version now.

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.

2 participants