p5.js version
No response
What is your operating system?
Windows
Web browser and version
Edge 148.0.3967.83
Actual Behavior
When transforming a do-while loop with a standalone comment, the infinite loop guard erroneously treats the while (...); as if it were the start of a standalone while loop.
Expected Behavior
The loop guard should not be treating the while statement after a do while loop as standalone and should not add an infinite loop detector.
Steps to reproduce
Steps:
- Make a project, whether its saves or not or version doesn't matter.
- Paste in the following snippet into anywhere, it can be setup, draw, or even outside any function
- Press run (also crashes in the full view)
Snippet:
do{
// Hello this is a comment and this comment is very important to this bug
}while (false);
Link is here
Transformed code
The code that actually runs according to inspect is here:
{;loopProtect.protect({ line: 7, reset: true }); do{;if (loopProtect.protect({ line: 7 })) break;
}{;loopProtect.protect({ line: 9, reset: true }); while (false){if (loopProtect.protect({ line: 9 })) break;;}}
When the bug occurs
This bug only occurs in a do while loop. When the do statement has no comment, the bug does not occur. A inline comment does not trigger this. Both single and multi-line comments trigger this. This does not happen when the loop has // noprotect. EDIT: This also can trigger when code is within the do clause as long as the comment is standalone.
p5.js version
No response
What is your operating system?
Windows
Web browser and version
Edge 148.0.3967.83
Actual Behavior
When transforming a do-while loop with a standalone comment, the infinite loop guard erroneously treats the
while (...);as if it were the start of a standalone while loop.Expected Behavior
The loop guard should not be treating the while statement after a do while loop as standalone and should not add an infinite loop detector.
Steps to reproduce
Steps:
Snippet:
Link is here
Transformed code
The code that actually runs according to inspect is here:
When the bug occurs
This bug only occurs in a do while loop. When the do statement has no comment, the bug does not occur. A inline comment does not trigger this. Both single and multi-line comments trigger this. This does not happen when the loop has
// noprotect. EDIT: This also can trigger when code is within the do clause as long as the comment is standalone.