janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
122 stars 35 forks source link

emit-declaration: when called by emit-statement, there is a semi in caller emit-block #117

Closed kamisori closed 1 year ago

kamisori commented 1 year ago

i feel if this breaks do-declare, it should be fixed in do-declare... like adding a (print ";") there, but emit-statement is only called by emit-block which already emits a semicolon

kamisori commented 1 year ago

so, previously: emit-declaration and emit-block were emitting ";\n" emit-block uses emit-statement uses emit-declaration -> if you had no expression to assign to your declaration you would end up with a superfluous semicolon

here, i moved the ";\n" from emit-declaration to do-declare, the only other caller of emit-declaration, aside emit-statement.