Fix incorrect pattern capture in declaration codegen.