bring math;
test "test" {
let characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
let randomChar = characters.at(math.floor(math.random() * characters.length));
log(randomChar);
}
This happened:
✘ [ERROR] "await" can only be used inside an "async" function
target/test/main.wsim/.wing/inflight.$Closure1-1.cjs:12:43:
12 │ const randomChar = ((args) => { if ((await $math_Util.floor(((await $math_Util.random()) * characters.length))) >= characters.length || (await $math_Util....
╵
I expected this:
No response
Is there a workaround?
Move intermediate calculation out of the .at()
bring math;
test "test" {
let characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
let randomNumber = math.floor(math.random() * characters.length);
let randomChar = characters.at(randomNumber);
log(randomChar);
}
Anything else?
This probably happens with all macros when called inflight with call expression arguments
Wing Version
No response
Node.js Version
No response
Platform(s)
No response
Community Notes
Please vote by adding a 👍 reaction to the issue to help us prioritize.
If you are interested to work on this issue, please leave a comment.
I tried this:
This happened:
I expected this:
No response
Is there a workaround?
Move intermediate calculation out of the
.at()
Anything else?
This probably happens with all macros when called inflight with call expression arguments
Wing Version
No response
Node.js Version
No response
Platform(s)
No response
Community Notes