robertkrimen / otto

A JavaScript interpreter in Go (golang)
http://godoc.org/github.com/robertkrimen/otto
MIT License
8.01k stars 584 forks source link

Add BadStatement case to walk.go to avoid panic #495

Closed amaicode closed 1 year ago

amaicode commented 1 year ago

This PR is to address what I think might have been an oversight in the ast package walk.go file.

When the switch runs across a BadStatement node, this causes it to default (and panic).

I have added an empty case for this node type similar to BadExpression to get around this as well as a unit test.

stevenh commented 1 year ago

If you rebase to master, I fixed the lint issues @amaicode

amaicode commented 1 year ago

If you rebase to master, I fixed the lint issues @amaicode

Just rebased :)