Small optimization when getting the spans

- loop earlier if the kind is not the one we want

Change-Id: I5b020f20a144678ad2f7a4bca8fef64eb6ae491f
1 file changed