Fixes #3216 for declarations in object literals

Fixes #3216, along with unreported cases (`when` and `by`).

Super ugly, if anyone has any better ideas...