Restore compiler bridge source for Scala < 2.10

This commit is contained in:
Martin Duhem 2016-01-24 18:54:03 +01:00
parent a93f1e50c8
commit 1ebe86b704
2 changed files with 6 additions and 11 deletions

View File

@ -45,15 +45,10 @@ abstract class Compat {
val Nullary = global.NullaryMethodType
val ScalaObjectClass = definitions.ScalaObjectClass
// `afterPostErasure` doesn't exist in Scala < 2.10
implicit def withAfterPostErasure(global: Global): WithAfterPostErasure = new WithAfterPostErasure(global)
class WithAfterPostErasure(global: Global) {
def afterPostErasure[T](op: => T): T = op
}
// `exitingPostErasure` was called `afterPostErasure` in 2.10
implicit def withExitingPostErasure(global: Global): WithExitingPostErasure = new WithExitingPostErasure(global)
class WithExitingPostErasure(global: Global) {
def exitingPostErasure[T](op: => T): T = global afterPostErasure op
// `transformedType` doesn't exist in Scala < 2.10
implicit def withTransformedType(global: Global): WithTransformedType = new WithTransformedType(global)
class WithTransformedType(global: Global) {
def transformedType(tpe: Type): Type = tpe
}
private[this] final class MiscCompat {

View File

@ -277,7 +277,7 @@ class ExtractAPI[GlobalType <: CallbackGlobal](val global: GlobalType,
val beforeErasure = makeDef(processType(in, dropConst(returnType)))
val afterErasure =
if (inspectPostErasure) {
val erasedReturn = dropConst(transformedType(viewer(in).memberInfo(s))) map {
val erasedReturn = dropConst(global.transformedType(viewer(in).memberInfo(s))) map {
case MethodType(_, r) => r
case other => other
}
@ -288,7 +288,7 @@ class ExtractAPI[GlobalType <: CallbackGlobal](val global: GlobalType,
}
}
def parameterS(erase: Boolean)(s: Symbol): xsbti.api.MethodParameter = {
val tp = if (erase) transformedType(s.info) else s.info
val tp = if (erase) global.transformedType(s.info) else s.info
makeParameter(simpleName(s), tp, tp.typeSymbol, s)
}