TurboScript
TurboScript copied to clipboard
Strange compilation error detection
Code:
export function grayscaleImage(data: Array<int8>, width: int32, height: int32): void {
let len: int32 = width * height;
let i: int32 = 0;
while (i < len)
let r: float32 = data[i * 4 + 0] as float32;
let g: float32 = data[i * 4 + 1] as float32;
let b: float32 = data[i * 4 + 2] as float32;
let result: int8 = (0.2126 * r + 0.7152 * g + 0.0722 * b) as int8;
data[i * 4 + 0] = result;
data[i * 4 + 1] = result;
data[i * 4 + 2] = result;
i++;
}
}
Error:
(10:34)
ERROR:
terminal.ts:24 No symbol named 'r' here
terminal.ts:24 let result: int8 = (0.2126 * r + 0.7152 * g + 0.0722 * b) as int8;
But problem with skipped open brace '{' after while
Nice catch. I will investigate it.