Interesting. How would a line compile on its own if it's, say, "n += 2;" without providing the n?
Another way would be to operate at block- instead of line-level and just not allow local variable to be shared between blocks. Ie
int i = 5 ↵
printf("%i", i) ↵
would fail, but { ↵
int i = 5; ↵
printf("%i", i); ↵
} ↵
would not.