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

scala.meta.internal.parsers.NestedContext.scala Maven / Gradle / Ivy

There is a newer version: 4.12.2
Show newest version
package scala.meta.internal.parsers

/** Utility for tracking a context, like whether we are inside a pattern or a quote. */
private[parsers] trait NestedContext {
  private var nested = 0
  def within[T](body: => T): T = {
    nested += 1
    try {
      body
    } finally {
      nested -= 1
    }
  }
  def isInside() = nested > 0
}

private[parsers] object QuotedSpliceContext extends NestedContext

private[parsers] object QuotedPatternContext extends NestedContext

private[parsers] object ReturnTypeContext extends NestedContext




© 2015 - 2025 Weber Informatics LLC | Privacy Policy