most of this method is redundant since it is only called from `public static CompilationMode GetCompilationMode(string file)` hence no need for arg checks. just merge it into calling method