Fix #217: throw on invalid function declaration

This is a hard exit but at least there's a stack to show lines, seems OK to me.