Skip to content

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

Merged
spytheman merged 2 commits into
vlang:masterfrom
gchumillas:fix_cannot_access_map_values_using_explicit_keys
May 31, 2025
Merged

jsgen: fix direct map key access and map.len (fix #24616, fix #24605)#24620
spytheman merged 2 commits into
vlang:masterfrom
gchumillas:fix_cannot_access_map_values_using_explicit_keys

Conversation

@gchumillas

Copy link
Copy Markdown
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

@huly-for-github

Copy link
Copy Markdown

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

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

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