Skip to content
This repository was archived by the owner on Feb 28, 2018. It is now read-only.
This repository was archived by the owner on Feb 28, 2018. It is now read-only.

Strange compilation error detection #116

@MaxGraey

Description

@MaxGraey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions