Some of my dreams are weird also.
I have had dreams about designing and writing programs for a non-existent computer. I worked for a couple companies who made Mainframes. In my dreams, the company I worked for did not exist in the real world, and the computer was a bit weird. I have dreamed about this non-existent company and its computer quite a few times. The dreams have a high degree of consistency with each other and seem to make sense. I have a feeling that the projects I am working on are critically important. When I wake up, neither the computer nor the programming projects seem realistic.
I have never dreamed about a program at the detailed statement level. On a few occasions, I have had dreams in which I came up with algorithms that were workable solutions to programming projects with which I had been having trouble during the day.
Sophtware as resident head shrinker......
.....my suggestion would be to get over your code complex by spending the next week down the boozer drinking your own body weight in alcohol. I would prescribe pints of beer with whisky chasers.