Added resolve in code generation to get dependency chain and detect cycles.