TS8009
Front-end code BREAK_OUTSIDE
A break with no loop or switch around it.
The registry has no documentation comment for this constant, so the line above is written by this site from the messages the compiler raises it with.
The registry text and every compiler message on these pages are the compiler's own English.
Example
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { if (uv.x > 0.5) { break } return vec4(uv, 0., 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8009 error, line 6: break is only valid inside a loop or switch.
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
@fragmentexport function main(@location(0) uv: vec2): vec4 { if (uv.x > 0.5) { return vec4(0., 0., 0., 1.) } return vec4(uv, 0., 1.)}See also
Source
Where the compiler raises this code at commit 26de7be8, one line per file:
-
src/compiler/ts/lower/statement.ts:232(2 sites)