TurboScript icon indicating copy to clipboard operation
TurboScript copied to clipboard

Strange compilation error detection

Open MaxGraey opened this issue 8 years ago • 1 comments

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

MaxGraey avatar Jun 15 '17 18:06 MaxGraey

Nice catch. I will investigate it.

nidin avatar Jun 16 '17 03:06 nidin