All Downloads are FREE. Search and download functionalities are using the official Maven repository.

parsley.internal.machine.XAssert.scala Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2020 Parsley Contributors 
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
package parsley.internal.machine

import scala.annotation.elidable, elidable.ASSERTION

import parsley.XAssert._

// $COVERAGE-OFF$
private [machine] object XAssert {
    @elidable(ASSERTION) @inline
    final def ensureRegularInstruction(ctx: Context): Unit = {
        assert(ctx.good && ctx.running, s"regular instructions can only be executed when the status is Good, it is ${ctx.status}")
    }

    @elidable(ASSERTION) @inline
    final def ensureHandlerInstruction(ctx: Context): Unit = {
        assert(!ctx.good && ctx.running, s"handler instructions can only be executed when the status is Recover, it is ${ctx.status}")
    }
}
// $COVERAGE-ON$




© 2015 - 2024 Weber Informatics LLC | Privacy Policy