aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/Trees.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-13 15:20:31 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-13 15:20:31 +0200
commit0b41954ac5ea6280dda4f4bcb052b29923a282a6 (patch)
treeb2624b75c15b9df5eef4b061a2a695dac5d63923 /src/dotty/tools/dotc/ast/Trees.scala
parent891aeba7ac64be808a7a5959fedecd4e2e41dcf3 (diff)
downloaddotty-0b41954ac5ea6280dda4f4bcb052b29923a282a6.tar.gz
dotty-0b41954ac5ea6280dda4f4bcb052b29923a282a6.tar.bz2
dotty-0b41954ac5ea6280dda4f4bcb052b29923a282a6.zip
Restrict treee copiers with default arguments to trees with more than 2 elements.
It's not really an abbreviation to do it for trees with fewer elements and it leads to unncessessary syntactic variation.
Diffstat (limited to 'src/dotty/tools/dotc/ast/Trees.scala')
-rw-r--r--src/dotty/tools/dotc/ast/Trees.scala78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala
index 3ff600f44..b28cb87e6 100644
--- a/src/dotty/tools/dotc/ast/Trees.scala
+++ b/src/dotty/tools/dotc/ast/Trees.scala
@@ -433,7 +433,7 @@ object Trees {
case class Select[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name)
extends RefTree[T] {
type ThisTree[-T >: Untyped] = Select[T]
- def withName(name: Name)(implicit ctx: Context): untpd.Select = untpd.cpy.Select(this)(name = name)
+ def withName(name: Name)(implicit ctx: Context): untpd.Select = untpd.cpy.Select(this)(qualifier, name)
}
class SelectWithSig[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name, val sig: Signature)
@@ -620,7 +620,7 @@ object Trees {
case class SelectFromTypeTree[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name)
extends RefTree[T] {
type ThisTree[-T >: Untyped] = SelectFromTypeTree[T]
- def withName(name: Name)(implicit ctx: Context): untpd.SelectFromTypeTree = untpd.cpy.SelectFromTypeTree(this)(name = name)
+ def withName(name: Name)(implicit ctx: Context): untpd.SelectFromTypeTree = untpd.cpy.SelectFromTypeTree(this)(qualifier, name)
}
/** left & right */
@@ -666,7 +666,7 @@ object Trees {
extends NameTree[T] with DefTree[T] with PatternTree[T] {
type ThisTree[-T >: Untyped] = Bind[T]
override def envelope: Position = pos union initialPos
- def withName(name: Name)(implicit ctx: Context): untpd.Bind = untpd.cpy.Bind(this)(name = name)
+ def withName(name: Name)(implicit ctx: Context): untpd.Bind = untpd.cpy.Bind(this)(name, body)
}
/** tree_1 | ... | tree_n */
@@ -1094,24 +1094,24 @@ object Trees {
}
// Copier methods with default arguments; these demand that the original tree
- // is of the same class as the copy
-
- def Select(tree: Select)(qualifier: Tree = tree.qualifier, name: Name = tree.name): Select =
- Select(tree: Tree)(qualifier, name)
- def Super(tree: Super)(qual: Tree = tree.qual, mix: TypeName = tree.mix): Super =
- Super(tree: Tree)(qual, mix)
- def Apply(tree: Apply)(fun: Tree = tree.fun, args: List[Tree] = tree.args): Apply =
- Apply(tree: Tree)(fun, args)
- def TypeApply(tree: TypeApply)(fun: Tree = tree.fun, args: List[Tree] = tree.args): TypeApply =
- TypeApply(tree: Tree)(fun, args)
- def Typed(tree: Typed)(expr: Tree = tree.expr, tpt: Tree = tree.tpt): Typed =
- Typed(tree: Tree)(expr, tpt)
- def NamedArg(tree: NamedArg)(name: Name = tree.name, arg: Tree = tree.arg): NamedArg =
- NamedArg(tree: Tree)(name, arg)
- def Assign(tree: Assign)(lhs: Tree = tree.lhs, rhs: Tree = tree.rhs): Assign =
- Assign(tree: Tree)(lhs, rhs)
- def Block(tree: Block)(stats: List[Tree] = tree.stats, expr: Tree = tree.expr): Block =
- Block(tree: Tree)(stats, expr)
+ // is of the same class as the copy. We only include trees with more than 2 elements here.
+
+ //def Select(tree: Select)(qualifier: Tree = tree.qualifier, name: Name = tree.name): Select =
+ // Select(tree: Tree)(qualifier, name)
+ //def Super(tree: Super)(qual: Tree = tree.qual, mix: TypeName = tree.mix): Super =
+ // Super(tree: Tree)(qual, mix)
+ //def Apply(tree: Apply)(fun: Tree = tree.fun, args: List[Tree] = tree.args): Apply =
+ // Apply(tree: Tree)(fun, args)
+ //def TypeApply(tree: TypeApply)(fun: Tree = tree.fun, args: List[Tree] = tree.args): TypeApply =
+ // TypeApply(tree: Tree)(fun, args)
+ //def Typed(tree: Typed)(expr: Tree = tree.expr, tpt: Tree = tree.tpt): Typed =
+ // Typed(tree: Tree)(expr, tpt)
+ //def NamedArg(tree: NamedArg)(name: Name = tree.name, arg: Tree = tree.arg): NamedArg =
+ // NamedArg(tree: Tree)(name, arg)
+ //def Assign(tree: Assign)(lhs: Tree = tree.lhs, rhs: Tree = tree.rhs): Assign =
+ // Assign(tree: Tree)(lhs, rhs)
+ //def Block(tree: Block)(stats: List[Tree] = tree.stats, expr: Tree = tree.expr): Block =
+ // Block(tree: Tree)(stats, expr)
def If(tree: If)(cond: Tree = tree.cond, thenp: Tree = tree.thenp, elsep: Tree = tree.elsep): If =
If(tree: Tree)(cond, thenp, elsep)
def Closure(tree: Closure)(env: List[Tree] = tree.env, meth: Tree = tree.meth, tpt: Tree = tree.tpt): Closure =
@@ -1120,20 +1120,20 @@ object Trees {
Match(tree: Tree)(selector, cases)
def CaseDef(tree: CaseDef)(pat: Tree = tree.pat, guard: Tree = tree.guard, body: Tree = tree.body): CaseDef =
CaseDef(tree: Tree)(pat, guard, body)
- def Return(tree: Return)(expr: Tree = tree.expr, from: Tree = tree.from): Return =
- Return(tree: Tree)(expr, from)
+ //def Return(tree: Return)(expr: Tree = tree.expr, from: Tree = tree.from): Return =
+ // Return(tree: Tree)(expr, from)
def Try(tree: Try)(expr: Tree = tree.expr, handler: Tree = tree.handler, finalizer: Tree = tree.finalizer): Try =
Try(tree: Tree)(expr, handler, finalizer)
- def SelectFromTypeTree(tree: SelectFromTypeTree)(qualifier: Tree = tree.qualifier, name: Name = tree.name):
- SelectFromTypeTree = SelectFromTypeTree(tree: Tree)(qualifier, name)
- def RefinedTypeTree(tree: RefinedTypeTree)(tpt: Tree = tree.tpt, refinements: List[Tree] = tree.refinements):
- RefinedTypeTree = RefinedTypeTree(tree: Tree)(tpt, refinements)
- def AppliedTypeTree(tree: AppliedTypeTree)(tpt: Tree = tree.tpt, args: List[Tree] = tree.args): AppliedTypeTree =
- AppliedTypeTree(tree: Tree)(tpt, args)
- def TypeBoundsTree(tree: TypeBoundsTree)(lo: Tree = tree.lo, hi: Tree = tree.hi): TypeBoundsTree =
- TypeBoundsTree(tree: Tree)(lo, hi)
- def Bind(tree: Bind)(name: Name = tree.name, body: Tree = tree.body): Bind =
- Bind(tree: Tree)(name, body)
+ //def SelectFromTypeTree(tree: SelectFromTypeTree)(qualifier: Tree = tree.qualifier, name: Name = tree.name):
+ // SelectFromTypeTree = SelectFromTypeTree(tree: Tree)(qualifier, name)
+ //def RefinedTypeTree(tree: RefinedTypeTree)(tpt: Tree = tree.tpt, refinements: List[Tree] = tree.refinements):
+ // RefinedTypeTree = RefinedTypeTree(tree: Tree)(tpt, refinements)
+ //def AppliedTypeTree(tree: AppliedTypeTree)(tpt: Tree = tree.tpt, args: List[Tree] = tree.args): AppliedTypeTree =
+ // AppliedTypeTree(tree: Tree)(tpt, args)
+ //def TypeBoundsTree(tree: TypeBoundsTree)(lo: Tree = tree.lo, hi: Tree = tree.hi): TypeBoundsTree =
+ // TypeBoundsTree(tree: Tree)(lo, hi)
+ //def Bind(tree: Bind)(name: Name = tree.name, body: Tree = tree.body): Bind =
+ // Bind(tree: Tree)(name, body)
def UnApply(tree: UnApply)(fun: Tree = tree.fun, implicits: List[Tree] = tree.implicits, patterns: List[Tree] = tree.patterns): UnApply =
UnApply(tree: Tree)(fun, implicits, patterns)
def ValDef(tree: ValDef)(mods: Modifiers = tree.mods, name: TermName = tree.name, tpt: Tree = tree.tpt, rhs: Tree = tree.rhs): ValDef =
@@ -1144,12 +1144,12 @@ object Trees {
TypeDef(tree: Tree)(mods, name, rhs, tparams)
def Template(tree: Template)(constr: DefDef = tree.constr, parents: List[Tree] = tree.parents, self: ValDef = tree.self, body: List[Tree] = tree.body): Template =
Template(tree: Tree)(constr, parents, self, body)
- def Import(tree: Import)(expr: Tree = tree.expr, selectors: List[untpd.Tree] = tree.selectors): Import =
- Import(tree: Tree)(expr, selectors)
- def PackageDef(tree: PackageDef)(pid: RefTree = tree.pid, stats: List[Tree] = tree.stats): PackageDef =
- PackageDef(tree: Tree)(pid, stats)
- def Annotated(tree: Annotated)(annot: Tree = tree.annot, arg: Tree = tree.arg): Annotated =
- Annotated(tree: Tree)(annot, arg)
+ //def Import(tree: Import)(expr: Tree = tree.expr, selectors: List[untpd.Tree] = tree.selectors): Import =
+ // Import(tree: Tree)(expr, selectors)
+ //def PackageDef(tree: PackageDef)(pid: RefTree = tree.pid, stats: List[Tree] = tree.stats): PackageDef =
+ // PackageDef(tree: Tree)(pid, stats)
+ //def Annotated(tree: Annotated)(annot: Tree = tree.annot, arg: Tree = tree.arg): Annotated =
+ // Annotated(tree: Tree)(annot, arg)
}
abstract class TreeMap(val cpy: TreeCopier = inst.cpy) {