Skip to content

jsgen: fix direct map key access and map.len (fix #24616, fix #24605) #24620

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

Conversation

gchumillas
Copy link
Contributor

  • Replace in key with key.hasOwnProperty, since the in operator fails on scalars (string, numbers, etc).
  • Fix len init in map constructor.
  • Add a few tests

Fixes #24616 and #24605

Copy link

Connected to Huly®: V_0.6-22981

@gchumillas gchumillas changed the title Fix cannot access map values using explicit keys jsgen: fix direct map key access (fix #24616, fix #24605) May 30, 2025
@gchumillas gchumillas changed the title jsgen: fix direct map key access (fix #24616, fix #24605) jsgen: fix direct map key access and map.len (fix #24616, fix #24605) May 30, 2025
@gchumillas gchumillas force-pushed the fix_cannot_access_map_values_using_explicit_keys branch from a28ab2f to 5e32392 Compare May 30, 2025 18:10
@gchumillas gchumillas force-pushed the fix_cannot_access_map_values_using_explicit_keys branch from 5e32392 to a4af2f9 Compare May 30, 2025 19:33
Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit b84512d into vlang:master May 31, 2025
74 checks passed
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.

jsgen: maps created on the fly do not have a valid size
2 participants