diff options
Diffstat (limited to 'src/dotty/tools/backend/jvm/DottyBackendInterface.scala')
-rw-r--r-- | src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 1710c1325..585b54e58 100644 --- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -68,6 +68,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ type ApplyDynamic = NonExistentTree type ModuleDef = NonExistentTree type LabelDef = tpd.DefDef + type Closure = tpd.Closure val NoSymbol = Symbols.NoSymbol val NoPosition: Position = Positions.NoPosition @@ -100,6 +101,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ val BoxesRunTimeClass = toDenot(BoxesRunTimeModule).moduleClass.asClass val nme_valueOf: Name = StdNames.nme.valueOf + val nme_apply = StdNames.nme.apply val NothingClass: Symbol = defn.NothingClass val NullClass: Symbol = defn.NullClass val ObjectClass: Symbol = defn.ObjectClass @@ -180,6 +182,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ implicit val ApplyDynamicTag: ClassTag[ApplyDynamic] = ClassTag[ApplyDynamic](classOf[ApplyDynamic]) implicit val SuperTag: ClassTag[Super] = ClassTag[Super](classOf[Super]) implicit val ConstantClassTag: ClassTag[Constant] = ClassTag[Constant](classOf[Constant]) + implicit val ClosureTag: ClassTag[Closure] = ClassTag[Closure](classOf[Closure]) /* dont emit any annotations for now*/ def isRuntimeVisible(annot: Annotation): Boolean = false @@ -776,5 +779,18 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{ def _3: List[TypeDef] = Nil } + object Closure extends ClosureDeconstructor { + def _1 = field.env + def _2 = field.meth + def _3 = { + val t = field.tpt.tpe.typeSymbol + if(t.exists) t + else { + val arity = field.meth.tpe.widenDealias.paramTypes.size - _1.size + ctx.requiredClass(("scala.compat.java8.JFunction"+arity).toTermName) + } + } + } + def currentUnit = ctx.compilationUnit }
\ No newline at end of file |