Skip to content

Commit dcc31b7

Browse files
committed
Add comment with an explanation
1 parent 547bc8b commit dcc31b7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/webgl/ShaderGenerator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ function shadergenerator(p5, fn) {
1919
if (shaderModifier instanceof Function) {
2020
let generatorFunction;
2121
if (options.parser) {
22+
// #7955 Wrap function declaration code in brackets so anonymous functions are not top level statements, which causes an error in acorn when parsing
23+
// https://github.com/acornjs/acorn/issues/1385
2224
const sourceString = `(${shaderModifier.toString()})`;
2325
const ast = parse(sourceString, {
2426
ecmaVersion: 2021,

0 commit comments

Comments
 (0)