-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.Unit: JSBugs/feature requests, that are related to the JavaScript backend.Bugs/feature requests, that are related to the JavaScript backend.
Description
Describe the bug
The runes() method call crashes in code generated by the JS backend.
Reproduction Steps
foo := "hello🎅".runes()
println(foo)Expected Behavior
Expected both C and JS backends to produce the same output.
Current Behavior
$ v run runes.v # runs okay
[`h`, `e`, `l`, `l`, `o`, `🎅`]
$ v -o runes.js runes.v && node runes.js
/home/justinas/vlang-testcases/runes.js:3963
let r = new rune(new u8('0')); r = new rune(s.str[i.val].charCodeAt())
^
TypeError: Cannot read properties of undefined (reading 'charCodeAt')
at string_runes (/home/justinas/vlang-testcases/runes.js:3963:62)
at js_main (/home/justinas/vlang-testcases/runes.js:6022:15)
at /home/justinas/vlang-testcases/runes.js:6079:25
Node.js v18.18.2
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.4 ac2dcc2
Environment details (OS name and version, etc.)
NixOS 23.11 (Tapir)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.Unit: JSBugs/feature requests, that are related to the JavaScript backend.Bugs/feature requests, that are related to the JavaScript backend.