Skip to content

bug in loop protection macro expansion #4183

Description

@TakagiHitoshi

p5.js version

1.11.11

What is your operating system?

Windows

Web browser and version

chrome 149.0.7827.104

Actual Behavior

"ReferenceError: _LP0 is not defined"

Expected Behavior

expected to run fine without errors.

Steps to reproduce

When run this code:
--- code begins --
//#つぶやきProcessing #p5js
t=0,h=.03
draw=_=>{
t||createCanvas(W=(w=200)2,W)+noStroke()+colorMode(HSB)
background(1,.1)
for(u=-4;u<4;u+=h)
for(i=0,x=u,y=u;i<t;i++)
[x,y]=[(x-y-x
(S=xx+yy))h+x,(x-y+yS)h+y],
rect(X=x
w+w,Y=yw+w,(fill(wcos(X-Y+t/17),w,w,.3),8))
t=++t%W}
--- code ends ---
Got this:
ReferenceError: LP0 is not defined
at /sketch.js:12:30
Instead, when run this code (with braces '{}')
--- code begins ---
//#つぶやきProcessing #p5js
t=0,h=.03
draw=
=>{
t||createCanvas(W=(w=200)2,W)+noStroke()+colorMode(HSB)
background(1,.1)
for(u=-4;u<4;u+=h)
{ // added
for(i=0,x=u,y=u;i<t;i++)
[x,y]=[(x-y-x
(S=xx+yy))h+x,(x-y+yS)h+y],
rect(X=x
w+w,Y=yw+w,(fill(wcos(X-Y+t/17),w,w,.3),8))
} // added
t=++t%W}
--- code ends ---
Runs fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError or unexpected behaviors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions