diff options
author | Martin Odersky <odersky@gmail.com> | 2014-09-01 14:21:16 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-09-01 14:22:12 +0200 |
commit | 2558c49984611935fff91b0b062f6af5a61e71ce (patch) | |
tree | a59b677e96cdb69e220ff42350f937279eb081cc /src/dotty/tools/dotc/transform/Erasure.scala | |
parent | 2788547565d178f9bca93adc0df69029024bf4e6 (diff) | |
download | dotty-2558c49984611935fff91b0b062f6af5a61e71ce.tar.gz dotty-2558c49984611935fff91b0b062f6af5a61e71ce.tar.bz2 dotty-2558c49984611935fff91b0b062f6af5a61e71ce.zip |
Completed outer paths.
Outer paths, parameters and arguments are inserted in erasure, using methods provided
by OuterAccessors.
Also fixed a stupid bug in Erasure#constant
Diffstat (limited to 'src/dotty/tools/dotc/transform/Erasure.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/Erasure.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index 6e82f050a..d22fdc669 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -106,7 +106,7 @@ object Erasure { } def constant(tree: Tree, const: Tree)(implicit ctx: Context) = - if (isPureExpr(tree)) Block(tree :: Nil, const) else const + if (isPureExpr(tree)) const else Block(tree :: Nil, const) final def box(tree: Tree, target: => String = "")(implicit ctx: Context): Tree = ctx.traceIndented(i"boxing ${tree.showSummary}: ${tree.tpe} into $target") { tree.tpe.widen match { @@ -274,6 +274,10 @@ object Erasure { override def typedSelectFromTypeTree(tree: untpd.SelectFromTypeTree, pt: Type)(implicit ctx: Context) = untpd.Ident(tree.name).withPos(tree.pos).withType(erasedType(tree)) + override def typedThis(tree: untpd.This)(implicit ctx: Context): Tree = + if (tree.symbol == ctx.owner.enclosingClass || tree.symbol.isStaticOwner) promote(tree) + else outer.path(tree.symbol) + private def runtimeCallWithProtoArgs(name: Name, pt: Type, args: Tree*)(implicit ctx: Context): Tree = { val meth = defn.runtimeMethod(name) val followingParams = meth.info.firstParamTypes.drop(args.length) @@ -305,7 +309,7 @@ object Erasure { case fun1 => fun1.tpe.widen match { case mt: MethodType => - val outers = outerArgs(fun1) map untpd.TypedSplice + val outers = outer.args(fun1) map untpd.TypedSplice val args1 = (outers ::: args ++ protoArgs(pt)).zipWithConserve(mt.paramTypes)(typedExpr) untpd.cpy.Apply(tree)(fun1, args1) withType mt.resultType case _ => |