Skip to content

Commit

Permalink
Scalameta: don't use deprecated methods (v4.7.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Feb 13, 2023
1 parent d2001ab commit 07fc177
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class FormatOps(
val fullInfix = InfixSplits.findEnclosingInfix(app)
val ok = isEnclosedInParens(fullInfix) || fullInfix.parent.forall {
case t: Defn.Val => t.rhs eq fullInfix
case t: Defn.Var => t.rhs.contains(fullInfix)
case t: Defn.Var => t.body eq fullInfix
case _ => true
}
if (ok)
Expand Down Expand Up @@ -2656,7 +2656,6 @@ class FormatOps(
def getBlocks(ft: FormatToken, nft: FormatToken, all: Boolean): Result =
ft.meta.leftOwner match {
case t: Ctor.Secondary => Some((t, seq(all, t.init, t.stats)))
case t: Defn.Var => t.rhs.map(_ -> Nil)
case t: Tree.WithBody => Some((t.body, Nil))
case _ => BlockImpl.getBlocks(ft, nft, all)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,8 @@ object TreeOps {
@tailrec
def defDefBody(tree: Tree): Option[Tree] =
tree match {
case d: Defn.Def => Some(d.body)
case d: Defn.Macro => Some(d.body)
case d: Defn.Given => Some(d.templ)
case d: Defn.GivenAlias => Some(d.body)
case d: Defn.Val => Some(d.rhs)
case d: Defn.Var => d.rhs
case t: Defn.Class => Some(t.templ)
case t: Defn.Trait => Some(t.templ)
case t: Defn.Enum => Some(t.templ)
case t: Defn.ExtensionGroup => Some(t.body)
case d: Defn with Tree.WithBody => Some(d.body)
case d: Defn with Stat.WithTemplate => Some(d.templ)
case t: Ctor.Secondary => Some(t.init)
case _: Ctor.Primary | _: Pat.Var | _: Term.Name =>
tree.parent match {
Expand Down Expand Up @@ -451,7 +443,6 @@ object TreeOps {
new FormatToken.ExtractFromMeta(_.leftOwner match {
case _: Enumerator => None // it's WithBody
case t: Ctor.Secondary => Some(t.init)
case t: Defn.Var => t.rhs.orElse(Some(t)) // `_` replaced with None
case t: Tree.WithBody => Some(t.body)
case t: Term.Param => t.default
case _ => None
Expand Down Expand Up @@ -739,7 +730,8 @@ object TreeOps {
t.parent match {
case Some(ts: Term.Select) if ts.name.value == "stripMargin" =>
ts.parent match {
case Some(Term.Apply(_, List(arg: Lit.Char))) => Some(arg.value)
case Some(Term.Apply.Initial(_, List(arg: Lit.Char))) =>
Some(arg.value)
case _ => Some('|')
}
case _ => None
Expand Down

0 comments on commit 07fc177

Please sign in to comment.