(a) A juvenile who has been subjected to an adjudication pursuant to a petition alleging him or her to be delinquent shall not be tried later under criminal charges based upon facts alleged in the petition to find him or her delinquent.
(b) A juvenile who has been tried for a violation of the criminal laws of this state shall not be later subjected to a delinquency proceeding arising out of the facts that formed the basis of the criminal charges.