mirror of https://github.com/sbt/sbt.git
Avoid copy-paste of Flags.MACRO with source-compatibility trickery.
This commit is contained in:
parent
72e41c3329
commit
a1cc62a598
|
|
@ -273,9 +273,9 @@ final class API(val global: Global, val callback: xsbti.AnalysisCallback) extend
|
||||||
}
|
}
|
||||||
private def getModifiers(s: Symbol): xsbti.api.Modifiers =
|
private def getModifiers(s: Symbol): xsbti.api.Modifiers =
|
||||||
{
|
{
|
||||||
import Flags._; val MACRO = 0x00008000 // From Flags.MACRO in 2.10.0+
|
import Flags._
|
||||||
new xsbti.api.Modifiers(s.hasFlag(ABSTRACT) || s.hasFlag(DEFERRED), s.hasFlag(OVERRIDE),
|
new xsbti.api.Modifiers(s.hasFlag(ABSTRACT) || s.hasFlag(DEFERRED), s.hasFlag(OVERRIDE),
|
||||||
s.isFinal, s.hasFlag(SEALED), isImplicit(s), s.hasFlag(LAZY), s.hasFlag(MACRO))
|
s.isFinal, s.hasFlag(SEALED), isImplicit(s), s.hasFlag(LAZY), hasMacro(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
private def isImplicit(s: Symbol) = s.hasFlag(Flags.IMPLICIT)
|
private def isImplicit(s: Symbol) = s.hasFlag(Flags.IMPLICIT)
|
||||||
|
|
|
||||||
|
|
@ -130,12 +130,21 @@ abstract class Compat
|
||||||
def LOCALCHILD = sourceCompatibilityOnly
|
def LOCALCHILD = sourceCompatibilityOnly
|
||||||
|
|
||||||
def NullaryMethodType = NullaryMethodTpe
|
def NullaryMethodType = NullaryMethodTpe
|
||||||
|
|
||||||
|
def MACRO = DummyValue
|
||||||
}
|
}
|
||||||
// in 2.9, NullaryMethodType was added to Type
|
// in 2.9, NullaryMethodType was added to Type
|
||||||
object NullaryMethodTpe {
|
object NullaryMethodTpe {
|
||||||
def unapply(t: Type): Option[Type] = None
|
def unapply(t: Type): Option[Type] = None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val DummyValue = 0
|
||||||
|
def hasMacro(s: Symbol): Boolean =
|
||||||
|
{
|
||||||
|
val MACRO = Flags.MACRO // will be DummyValue for versions before 2.10
|
||||||
|
MACRO != DummyValue && s.hasFlag(MACRO)
|
||||||
|
}
|
||||||
|
|
||||||
private[this] def sourceCompatibilityOnly: Nothing = throw new RuntimeException("For source compatibility only: should not get here.")
|
private[this] def sourceCompatibilityOnly: Nothing = throw new RuntimeException("For source compatibility only: should not get here.")
|
||||||
|
|
||||||
private[this] final implicit def miscCompat(n: AnyRef): MiscCompat = new MiscCompat
|
private[this] final implicit def miscCompat(n: AnyRef): MiscCompat = new MiscCompat
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue