gobuffalo / plush

The powerful template system that Go needs
MIT License
900 stars 56 forks source link

bug: Panic when `let` statement is not correctly used #170

Closed Mido-sys closed 1 year ago

Mido-sys commented 1 year ago

Description

When an uninitialized variable is called plush panics. Due to parseLetStatement() returns nil if the next token isn't =. As a result, when parseProgram() calls stmt.String() it panics as stmt is holding a nil value.

To Reproduce

let foo
if (foo){
 foo = 1
}
Mido-sys commented 1 year ago

@sio4 I sent a PR request

sio4 commented 1 year ago

(Note for future reference: The description is almost correct but the condition is not "when an uninitialized variable is called" but "the let statement is not correctly used without equal sign".)

sio4 commented 1 year ago

I reverted merged PR #171 with #172. Please take a look at the comments on PR #171 and please consider filing a new PR! I will do my best to review that this time! (Sorry again for the delayed review :-)

Mido-sys commented 1 year ago

@sio4, I sent another PR :)