Section 97. A person who has contracted to construct the whole or a specified part of such railroad or railway shall not have such right of action.