Added semantic analysis for dictionary comprehension
Factorred out common code