<commit_before>package scala.async.internal

import scala.tools.nsc.Global
import scala.tools.nsc.transform.TypingTransformers

object AsyncMacro {
  def apply(c: reflect.macros.Context, base: AsyncBase): AsyncMacro = {
    import language.reflectiveCalls
    val powerContext = c.asInstanceOf[c.type { val universe: Global; val callsiteTyper: universe.analyzer.Typer }]
    new AsyncMacro {
      val global: powerContext.universe.type   = powerContext.universe
      val callSiteTyper: global.analyzer.Typer = powerContext.callsiteTyper
      val macroApplication: global.Tree        = c.macroApplication.asInstanceOf[global.Tree]
      // This member is required by `AsyncTransform`:
      val asyncBase: AsyncBase                 = base
      // These members are required by `ExprBuilder`:
      val futureSystem: FutureSystem           = base.futureSystem
      val futureSystemOps: futureSystem.Ops {val universe: global.type} = futureSystem.mkOps(global)
    }
  }
}

private[async] trait AsyncMacro
  extends TypingTransformers
  with AnfTransform with TransformUtils with Lifter
  with ExprBuilder with AsyncTransform with AsyncAnalysis with LiveVariables {

  val global: Global
  val callSiteTyper: global.analyzer.Typer
  val macroApplication: global.Tree

  lazy val macroPos = macroApplication.pos.makeTransparent
  def atMacroPos(t: global.Tree) = global.atPos(macroPos)(t)

  def suppressExpansion() {
    // Have your cake : Scala IDE sees original trees and hyperlinking, etc within async blocks "Just Works"
    // Eat it too     : (domain specific errors like "unsupported use of await"
    //
    // TODO roll this idea back into scala/scala

    import global.Tree
    type Suppress = { def suppressMacroExpansion(a: Tree): Tree }
    try {
      global.asInstanceOf[Suppress].suppressMacroExpansion(macroApplication)
    } catch {
      case _: NoSuchMethodException =>
        global.analyzer.asInstanceOf[Suppress].suppressMacroExpansion(macroApplication)
    }
  }
<commit_msg>Update TODO comment about pres. compiler friendliness.<commit_after>package scala.async.internal

import scala.tools.nsc.Global
import scala.tools.nsc.transform.TypingTransformers

object AsyncMacro {
  def apply(c: reflect.macros.Context, base: AsyncBase): AsyncMacro = {
    import language.reflectiveCalls
    val powerContext = c.asInstanceOf[c.type { val universe: Global; val callsiteTyper: universe.analyzer.Typer }]
    new AsyncMacro {
      val global: powerContext.universe.type   = powerContext.universe
      val callSiteTyper: global.analyzer.Typer = powerContext.callsiteTyper
      val macroApplication: global.Tree        = c.macroApplication.asInstanceOf[global.Tree]
      // This member is required by `AsyncTransform`:
      val asyncBase: AsyncBase                 = base
      // These members are required by `ExprBuilder`:
      val futureSystem: FutureSystem           = base.futureSystem
      val futureSystemOps: futureSystem.Ops {val universe: global.type} = futureSystem.mkOps(global)
    }
  }
}

private[async] trait AsyncMacro
  extends TypingTransformers
  with AnfTransform with TransformUtils with Lifter
  with ExprBuilder with AsyncTransform with AsyncAnalysis with LiveVariables {

  val global: Global
  val callSiteTyper: global.analyzer.Typer
  val macroApplication: global.Tree

  lazy val macroPos = macroApplication.pos.makeTransparent
  def atMacroPos(t: global.Tree) = global.atPos(macroPos)(t)

  def suppressExpansion() {
    // Have your cake : Scala IDE sees original trees and hyperlinking, etc within async blocks "Just Works"
    // Eat it too     : (domain specific errors like "unsupported use of await"
    //
    // TODO remove this once we unsupport 2.10.x, scalac 2.11 does this automatically.

    import global.Tree
    type Suppress = { def suppressMacroExpansion(a: Tree): Tree }
    try {
      global.asInstanceOf[Suppress].suppressMacroExpansion(macroApplication)
    } catch {
      case _: NoSuchMethodException =>
        global.analyzer.asInstanceOf[Suppress].suppressMacroExpansion(macroApplication)
    }
  }

{'fraction_non_alphanumeric': 0.07682896990457548, 'fraction_numerical': 0.0014680694886224615, 'mean_word_length': 3.5984251968503935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7655067', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1132, 'n_words': 315}