@@ -153,7 +153,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
153
153
ta.assignType(untpd.SeqLiteral (elems, elemtpt), elems, elemtpt)
154
154
155
155
def JavaSeqLiteral (elems : List [Tree ], elemtpt : Tree )(implicit ctx : Context ): JavaSeqLiteral =
156
- ta.assignType(new untpd.JavaSeqLiteral (elems, elemtpt), elems, elemtpt).asInstanceOf [JavaSeqLiteral ]
156
+ ta.assignType(untpd.JavaSeqLiteral (elems, elemtpt), elems, elemtpt).asInstanceOf [JavaSeqLiteral ]
157
157
158
158
def Inlined (call : Tree , bindings : List [MemberDef ], expansion : Tree )(implicit ctx : Context ): Inlined =
159
159
ta.assignType(untpd.Inlined (call, bindings, expansion), bindings, expansion)
@@ -231,7 +231,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
231
231
def valueParamss (tp : Type ): (List [List [TermSymbol ]], Type ) = tp match {
232
232
case tp : MethodType =>
233
233
val isParamDependent = tp.isParamDependent
234
- val previousParamRefs = if (isParamDependent) new mutable.ListBuffer [TermRef ]() else null
234
+ val previousParamRefs = if (isParamDependent) mutable.ListBuffer [TermRef ]() else null
235
235
236
236
def valueParam (name : TermName , origInfo : Type ): TermSymbol = {
237
237
val maybeImplicit =
@@ -294,7 +294,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
294
294
val newTypeParams =
295
295
for (tparam <- cls.typeParams if ! (bodyTypeParams contains tparam))
296
296
yield TypeDef (tparam)
297
- val findLocalDummy = new FindLocalDummyAccumulator (cls)
297
+ val findLocalDummy = FindLocalDummyAccumulator (cls)
298
298
val localDummy = ((NoSymbol : Symbol ) /: body)(findLocalDummy.apply)
299
299
.orElse(ctx.newLocalDummy(cls))
300
300
val impl = untpd.Template (constr, parents, Nil , selfType, newTypeParams ++ body)
@@ -391,7 +391,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
391
391
private def followOuterLinks (t : Tree )(implicit ctx : Context ) = t match {
392
392
case t : This if ctx.erasedTypes && ! (t.symbol == ctx.owner.enclosingClass || t.symbol.isStaticOwner) =>
393
393
// after erasure outer paths should be respected
394
- new ExplicitOuter .OuterOps (ctx).path(toCls = t.tpe.widen.classSymbol)
394
+ ExplicitOuter .OuterOps (ctx).path(toCls = t.tpe.widen.classSymbol)
395
395
case t =>
396
396
t
397
397
}
@@ -538,9 +538,9 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
538
538
}
539
539
540
540
override val cpy : TypedTreeCopier = // Type ascription needed to pick up any new members in TreeCopier (currently there are none)
541
- new TypedTreeCopier
541
+ TypedTreeCopier ()
542
542
543
- val cpyBetweenPhases : TimeTravellingTreeCopier = new TimeTravellingTreeCopier
543
+ val cpyBetweenPhases : TimeTravellingTreeCopier = TimeTravellingTreeCopier ()
544
544
545
545
class TypedTreeCopier extends TreeCopier {
546
546
def postProcess (tree : Tree , copied : untpd.Tree ): copied.ThisTree [Type ] =
@@ -746,16 +746,16 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
746
746
}
747
747
748
748
def shallowFold [T ](z : T )(op : (T , tpd.Tree ) => T )(implicit ctx : Context ): T =
749
- new ShallowFolder (op).apply(z, tree)
749
+ ShallowFolder (op).apply(z, tree)
750
750
751
751
def deepFold [T ](z : T )(op : (T , tpd.Tree ) => T )(implicit ctx : Context ): T =
752
- new DeepFolder (op).apply(z, tree)
752
+ DeepFolder (op).apply(z, tree)
753
753
754
754
def find [T ](pred : (tpd.Tree ) => Boolean )(implicit ctx : Context ): Option [tpd.Tree ] =
755
755
shallowFold[Option [tpd.Tree ]](None )((accum, tree) => if (pred(tree)) Some (tree) else accum)
756
756
757
757
def subst (from : List [Symbol ], to : List [Symbol ])(implicit ctx : Context ): ThisTree =
758
- new TreeTypeMap (substFrom = from, substTo = to).apply(tree)
758
+ TreeTypeMap (substFrom = from, substTo = to).apply(tree)
759
759
760
760
/** Change owner from `from` to `to`. If `from` is a weak owner, also change its
761
761
* owner to `to`, and continue until a non-weak owner is reached.
@@ -766,7 +766,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
766
766
loop(from.owner, from :: froms, to :: tos)
767
767
else {
768
768
// println(i"change owner ${from :: froms}%, % ==> $tos of $tree")
769
- new TreeTypeMap (oldOwners = from :: froms, newOwners = tos).apply(tree)
769
+ TreeTypeMap (oldOwners = from :: froms, newOwners = tos).apply(tree)
770
770
}
771
771
}
772
772
if (from == to) tree else loop(from, Nil , to :: Nil )
@@ -788,7 +788,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
788
788
}
789
789
val owners = ownerAcc(immutable.Set .empty[Symbol ], tree).toList
790
790
val newOwners = List .fill(owners.size)(newOwner)
791
- new TreeTypeMap (oldOwners = owners, newOwners = newOwners).apply(tree)
791
+ TreeTypeMap (oldOwners = owners, newOwners = newOwners).apply(tree)
792
792
}
793
793
794
794
/** After phase `trans`, set the owner of every definition in this tree that was formerly
@@ -1008,7 +1008,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1008
1008
}
1009
1009
1010
1010
/** Replace Ident nodes references to the underlying tree that defined them */
1011
- def underlying (implicit ctx : Context ): Tree = new MapToUnderlying ().transform(tree)
1011
+ def underlying (implicit ctx : Context ): Tree = MapToUnderlying ().transform(tree)
1012
1012
1013
1013
// --- Higher order traversal methods -------------------------------
1014
1014
@@ -1030,7 +1030,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1030
1030
1031
1031
/** All subtrees of this tree that satisfy predicate `p`. */
1032
1032
def filterSubTrees (f : Tree => Boolean )(implicit ctx : Context ): List [Tree ] = {
1033
- val buf = new mutable.ListBuffer [Tree ]
1033
+ val buf = mutable.ListBuffer [Tree ]()
1034
1034
foreachSubTree { tree => if (f(tree)) buf += tree }
1035
1035
buf.toList
1036
1036
}
@@ -1137,7 +1137,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1137
1137
def applyOverloaded (receiver : Tree , method : TermName , args : List [Tree ], targs : List [Type ],
1138
1138
expectedType : Type , isContextual : Boolean = false )(implicit ctx : Context ): Tree = {
1139
1139
val typer = ctx.typer
1140
- val proto = new FunProtoTyped (args, expectedType)(typer, isContextual)
1140
+ val proto = FunProtoTyped (args, expectedType)(typer, isContextual)
1141
1141
val denot = receiver.tpe.member(method)
1142
1142
assert(denot.exists, i " no member $receiver . $method, members = ${receiver.tpe.decls}" )
1143
1143
val selected =
@@ -1162,7 +1162,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1162
1162
val fun = receiver.select(selected).appliedToTypes(targs)
1163
1163
1164
1164
val apply = untpd.Apply (fun, args)
1165
- new typer.ApplyToTyped (apply, fun, selected, args, expectedType).result.asInstanceOf [Tree ] // needed to handle varargs
1165
+ typer.ApplyToTyped (apply, fun, selected, args, expectedType).result.asInstanceOf [Tree ] // needed to handle varargs
1166
1166
}
1167
1167
1168
1168
@ tailrec
@@ -1221,7 +1221,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
1221
1221
}
1222
1222
1223
1223
/** A key to be used in a context property that tracks enclosing inlined calls */
1224
- private val InlinedCalls = new Property .Key [List [Tree ]]
1224
+ private val InlinedCalls = Property .Key [List [Tree ]]()
1225
1225
1226
1226
/** Record an enclosing inlined call.
1227
1227
* EmptyTree calls (for parameters) cancel the next-enclosing call in the list instead of being added to it.
0 commit comments