move canCompile method to util