Skip to content

Commit c56508c

Browse files
committed
wip
1 parent a74b518 commit c56508c

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

compiler/src/dotty/tools/dotc/transform/localopt/StringInterpolatorOpt.scala

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ class StringInterpolatorOpt extends MiniPhase {
2222
override def phaseName: String = "stringInterpolatorOpt"
2323

2424
/** Matches a list of constant literals */
25-
private object Literals {
26-
def unapply(tree: SeqLiteral)(implicit ctx: Context): Option[List[Literal]] = {
27-
tree.elems match {
28-
case literals if literals.forall(_.isInstanceOf[Literal]) =>
29-
Some(literals.map(_.asInstanceOf[Literal]))
30-
case _ => None
31-
}
32-
}
33-
}
34-
35-
private object StringContextApply {
36-
def unapply(tree: Select)(implicit ctx: Context): Boolean = {
37-
tree.symbol.eq(defn.StringContextModule_apply) && {
38-
val qualifier = tree.qualifier
39-
qualifier.isInstanceOf[Ident] && qualifier.symbol.eq(defn.StringContextModule)
40-
}
41-
}
42-
}
25+
// private object Literals {
26+
// def unapply(tree: SeqLiteral)(implicit ctx: Context): Option[List[Literal]] = {
27+
// tree.elems match {
28+
// case literals if literals.forall(_.isInstanceOf[Literal]) =>
29+
// Some(literals.map(_.asInstanceOf[Literal]))
30+
// case _ => None
31+
// }
32+
// }
33+
// }
34+
//
35+
// private object StringContextApply {
36+
// def unapply(tree: Select)(implicit ctx: Context): Boolean = {
37+
// tree.symbol.eq(defn.StringContextModule_apply) && {
38+
// val qualifier = tree.qualifier
39+
// qualifier.isInstanceOf[Ident] && qualifier.symbol.eq(defn.StringContextModule)
40+
// }
41+
// }
42+
// }
4343

4444
// override def transformApply(tree: Apply)(implicit ctx: Context): Tree = {
4545
// /** Matches an s or raw string interpolator */
@@ -68,18 +68,18 @@ class StringInterpolatorOpt extends MiniPhase {
6868
// } else tree
6969
// }
7070

71-
private def interpolate(strs: List[Literal], elems: List[Tree])(implicit ctx: Context): Tree = {
72-
val stri = strs.iterator
73-
val elemi = elems.iterator
74-
var result: Tree = stri.next
75-
def concat(tree: Tree): Unit = {
76-
result = result.select(defn.String_+).appliedTo(tree)
77-
}
78-
while (elemi.hasNext) {
79-
concat(elemi.next)
80-
val str = stri.next
81-
if (!str.const.stringValue.isEmpty) concat(str)
82-
}
83-
result
84-
}
71+
// private def interpolate(strs: List[Literal], elems: List[Tree])(implicit ctx: Context): Tree = {
72+
// val stri = strs.iterator
73+
// val elemi = elems.iterator
74+
// var result: Tree = stri.next
75+
// def concat(tree: Tree): Unit = {
76+
// result = result.select(defn.String_+).appliedTo(tree)
77+
// }
78+
// while (elemi.hasNext) {
79+
// concat(elemi.next)
80+
// val str = stri.next
81+
// if (!str.const.stringValue.isEmpty) concat(str)
82+
// }
83+
// result
84+
// }
8585
}

0 commit comments

Comments
 (0)