adding codegen for foreach  statement