aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/SuperAccessors.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-07-06 18:26:24 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-13 14:54:05 +0200
commita878d19e48455ca600f3fbe6e36c6ddd687e14ff (patch)
tree624773cda76db0702fc9b3ca3dcdd338f8177c49 /src/dotty/tools/dotc/transform/SuperAccessors.scala
parent34f73ded3519a1df7d278685f3f33facd00f1c58 (diff)
downloaddotty-a878d19e48455ca600f3fbe6e36c6ddd687e14ff.tar.gz
dotty-a878d19e48455ca600f3fbe6e36c6ddd687e14ff.tar.bz2
dotty-a878d19e48455ca600f3fbe6e36c6ddd687e14ff.zip
Changes to tree copying
1) Add copiers with default arguments, to avoid boilerplate 2) All copiers are now curried wrt first argument (which is the original tree). We already make use of the new features in cpy.DefDef, but not yet elsewhere.
Diffstat (limited to 'src/dotty/tools/dotc/transform/SuperAccessors.scala')
-rw-r--r--src/dotty/tools/dotc/transform/SuperAccessors.scala12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/transform/SuperAccessors.scala b/src/dotty/tools/dotc/transform/SuperAccessors.scala
index 2496cf5a9..62dd7f0c0 100644
--- a/src/dotty/tools/dotc/transform/SuperAccessors.scala
+++ b/src/dotty/tools/dotc/transform/SuperAccessors.scala
@@ -222,7 +222,7 @@ class SuperAccessors extends MacroTransform with IdentityDenotTransformer { this
// Don't transform patterns or strange trees will reach the matcher (ticket #4062)
// TODO Query `ctx.mode is Pattern` instead.
case CaseDef(pat, guard, body) =>
- cpy.CaseDef(tree, pat, transform(guard), transform(body))
+ cpy.CaseDef(tree)(pat, transform(guard), transform(body))
case TypeDef(_, _, impl: Template) =>
val cls = sym.asClass
@@ -295,7 +295,7 @@ class SuperAccessors extends MacroTransform with IdentityDenotTransformer { this
val body1 = forwardParamAccessors(transformStats(impl.body, tree.symbol))
accDefs -= currentClass
ownStats ++= body1
- cpy.Template(tree, impl.constr, impl.parents, impl.self, body1)
+ cpy.Template(tree)(impl.constr, impl.parents, impl.self, body1)
}
transformTemplate
@@ -368,9 +368,9 @@ class SuperAccessors extends MacroTransform with IdentityDenotTransformer { this
}
transformSelect
- case DefDef(mods, name, tparams, vparamss, tpt, rhs) =>
- val rhs1 = if (isMethodWithExtension(sym)) withInvalidOwner(transform(rhs)) else transform(rhs)
- cpy.DefDef(tree, mods, name, tparams, vparamss, tpt, rhs1)
+ case tree@DefDef(_, _, _, _, _, rhs) =>
+ cpy.DefDef(tree)(
+ rhs = if (isMethodWithExtension(sym)) withInvalidOwner(transform(rhs)) else transform(rhs))
case TypeApply(sel @ Select(qual, name), args) =>
mayNeedProtectedAccessor(sel, args, goToSuper = true)
@@ -391,7 +391,7 @@ class SuperAccessors extends MacroTransform with IdentityDenotTransformer { this
case Apply(fn, args) =>
val MethodType(_, formals) = fn.tpe.widen
- cpy.Apply(tree, transform(fn), transformArgs(formals, args))
+ cpy.Apply(tree)(transform(fn), transformArgs(formals, args))
case _ =>
super.transform(tree)