-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
TypedArray forEach method have an unknown error #1051
Comments
AssermblyScript doesn't support closures yet |
Strange though that this is still hitting an assertion, will investigate. |
Yeah, after #955 it should emit error properly. Hmm |
Is there any recommend ways? Now I change to:
And the error still the same |
Seems this affects compound expressions like |
Because it still capture
let a: u32 = 0;
export function sum(arr: Uint32Array): u32 {
arr.forEach(value => { a += value });
return a;
}
export function sum(arr: Uint32Array): u32 {
return arr.reduce((a, b) => a + b, 0 as u32);
} |
Ohhhhh~~~ I got that. "doesn't support closures" means I cannot use any ref params outside forEach in the loop function. Looks little wierd~~. |
Thank you so much~~~, finally I change to the for loop. it works. |
Half a fix for at least the assertion in #1046, but would probably be better to have a |
here is my demo code:
as the code sample means, function sum will return the array's sum. I use forEach to get the sum to param: a, and then return. but when i execute
asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --validate --debug
command and then gets an error, with useless detail. I still cannot know whats going on?The error in terminal is:
The text was updated successfully, but these errors were encountered: