Wrong code generation in case statement
## Summary
The condition in case statement evaluates twice in certain cases.
## System Information
<!-- The more information are provided the easier it is to replicate the bug -->
- **Operating system:** Alt.Linux 10.1
- **Processor architecture:** x86-64
- **Compiler version:** 3.3.1
- **Device:** PC
## Steps to reproduce
Run attached example.
## Example Project

## What is the current bug behavior?
The HandleEntityReference method calls twice:

## What is the expected (correct) behavior?
The HandleEntityReference method must be called just once
issue