checkFile do the same thing as buildVisitor implementation