diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-12 11:10:07 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-12 11:10:07 +0200 |
commit | cf5999c497635cc891fbff65671479467e42bc5a (patch) | |
tree | ab16543fa1cc2217ca190beabfc1caf6bc351453 /src/dotty/tools/dotc/ast/tpd.scala | |
parent | 765960f1bdacc228d51f3841acfa2fd2317f2814 (diff) | |
download | dotty-cf5999c497635cc891fbff65671479467e42bc5a.tar.gz dotty-cf5999c497635cc891fbff65671479467e42bc5a.tar.bz2 dotty-cf5999c497635cc891fbff65671479467e42bc5a.zip |
Remove appliedIfMethod use ensureApplied instead
Diffstat (limited to 'src/dotty/tools/dotc/ast/tpd.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index 2a6ec9d78..9b7c9cbae 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -44,9 +44,6 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def Apply(fn: Tree, args: List[Tree])(implicit ctx: Context): Apply = ta.assignType(untpd.Apply(fn, args), fn, args) - def ensureApplied(fn: Tree)(implicit ctx: Context): Tree = - if (fn.tpe.widen.isParameterless) fn else Apply(fn, Nil) - def TypeApply(fn: Tree, args: List[Tree])(implicit ctx: Context): TypeApply = ta.assignType(untpd.TypeApply(fn, args), fn, args) @@ -566,13 +563,6 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def appliedToNone(implicit ctx: Context): Apply = appliedToArgs(Nil) - def appliedIfMethod(implicit ctx: Context): Tree = { - tree.tpe.widen match { - case fntpe: MethodType => appliedToArgs(Nil) - case _ => tree - } - } - def appliedToType(targ: Type)(implicit ctx: Context): Tree = appliedToTypes(targ :: Nil) @@ -582,6 +572,9 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def appliedToTypeTrees(targs: List[Tree])(implicit ctx: Context): Tree = if (targs.isEmpty) tree else TypeApply(tree, targs) + def ensureApplied(implicit ctx: Context): Tree = + if (tree.tpe.widen.isParameterless) tree else tree.appliedToNone + def isInstance(tp: Type)(implicit ctx: Context): Tree = tree.select(defn.Any_isInstanceOf).appliedToType(tp) @@ -638,7 +631,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { val mname = ("to" + numericCls.name).toTermName val conversion = tree.tpe member mname if (conversion.symbol.exists) - ensureApplied(tree.select(conversion.symbol.termRef)) + tree.select(conversion.symbol.termRef).ensureApplied else if (tree.tpe.widen isRef numericCls) tree else { |