Civet
Civet copied to clipboard
Attempted pattern matching ternary
trafficstars
undo := => engine = Engine.fromJSON json if json? := history.pop()
const undo = () =>(const json? = history.pop()? engine = Engine.fromJSON(json):void 0)
Workaround: put the function body on the next line
undo := =>
engine = Engine.fromJSON json if json? := history.pop()
A workaround for now:
undo := =>
engine = Engine.fromJSON json if json? := history.pop()
So this is probably specific to the "don't wrap fat arrow in braces if it's a one-line expression" rule.
Looks like this works now with the recent changes: https://civet.dev/playground?code=dW5kbyA6PSA9PiBlbmdpbmUgPSBFbmdpbmUuZnJvbUpTT04ganNvbiBpZiBqc29uPyA6PSBoaXN0b3J5LnBvcCgpCg%3D%3D
Indeed! Probably this commit: https://github.com/DanielXMoore/Civet/pull/1441/commits/bc49fe964b2c8cca4a35e909c7e5a8a0ae2c3e84 which makes fat arrows treat postfix if like an expressionized statement.