skia2/tests/sksl/runtime_errors/LoopStructureErrors.rte
Brian Osman 77ba8103d3 In runtime effects, verify that loops conform to ES2 rules
Bug: skia:11094
Change-Id: I68a08e79d29579901b74daca3c22f5112fbb3c8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353356
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-01-13 21:49:44 +00:00

13 lines
508 B
Plaintext

// Expect 5 errors
void loop_length_ok() { for (int i = 0; i < 128; i++) {} } // LEGAL: See kMaxUnrollableLoopLength
void loop_too_long() { for (int i = 0; i < 129; i++) {} }
void infinite_loop() { for (int i = 0; i < 1; i += 0) {} }
void set(out int x) { x = 1; }
void inc(inout int x) { x++; }
void index_modified() { for (int i = 0; i < 2; i++) { i++; } }
void index_out_param() { for (int i = 0; i < 1; i++) { set(i); } }
void index_inout_param() { for (int i = 0; i < 1; i++) { inc(i); } }