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: avoid ASI hazard with computed class members #22

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

acutmore
Copy link
Collaborator

@acutmore acutmore commented Nov 7, 2024

Fixes #21

Describe your changes
This change defends against a ASI hazard. When a computed class member name has a leading type modifier (public/private/protected/readonly/override) a ; is inserted in it's place to avoid being interpreted as index lookup of the previous class member. For example:

class C {
    f = 1
    public ["computed"] = 2
}

now becomes:

class C {
    f = 1
    ;      ["computed"] = 2
}

Testing performed
New test fixtures have been added and all ecosystem tests were run. All tests passing.

@acutmore acutmore merged commit c4071ba into main Nov 7, 2024
2 checks passed
@acutmore acutmore deleted the computed-class-field-asi branch November 7, 2024 11:42
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.

ASI hazard for computed class field.
3 participants