Skip to content

Commit a74b518

Browse files
committed
wip
1 parent 0ee13ca commit a74b518

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

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

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,32 @@ class StringInterpolatorOpt extends MiniPhase {
4141
}
4242
}
4343

44-
override def transformApply(tree: Apply)(implicit ctx: Context): Tree = {
45-
/** Matches an s or raw string interpolator */
46-
if (tree.symbol.eq(defn.StringContextRaw) || tree.symbol.eq(defn.StringContextS)) {
47-
tree match {
48-
case Apply(Select(Apply(StringContextApply(), List(Literals(strs))), _),
49-
List(SeqLiteral(elems, _))) if elems.length == strs.length - 1 =>
50-
/** Match trees that resemble s and raw string interpolations. In the case of the s
51-
* interpolator, escapes the string constants. Exposes the string constants as well as
52-
* the variable references.
53-
*/
54-
if (tree.symbol == defn.StringContextRaw) interpolate(strs, elems)
55-
else { // tree.symbol == defn.StringContextS
56-
try {
57-
val escapedStrs = strs.map { str =>
58-
val escapedValue = StringContext.processEscapes(str.const.stringValue)
59-
cpy.Literal(str)(Constant(escapedValue))
60-
}
61-
interpolate(escapedStrs, elems)
62-
} catch {
63-
case _: StringContext.InvalidEscapeException => tree
64-
}
65-
}
66-
case _ => tree
67-
}
68-
} else tree
69-
}
44+
// override def transformApply(tree: Apply)(implicit ctx: Context): Tree = {
45+
// /** Matches an s or raw string interpolator */
46+
// if (tree.symbol.eq(defn.StringContextRaw) || tree.symbol.eq(defn.StringContextS)) {
47+
// tree match {
48+
// case Apply(Select(Apply(StringContextApply(), List(Literals(strs))), _),
49+
// List(SeqLiteral(elems, _))) if elems.length == strs.length - 1 =>
50+
// /** Match trees that resemble s and raw string interpolations. In the case of the s
51+
// * interpolator, escapes the string constants. Exposes the string constants as well as
52+
// * the variable references.
53+
// */
54+
// if (tree.symbol == defn.StringContextRaw) interpolate(strs, elems)
55+
// else { // tree.symbol == defn.StringContextS
56+
// try {
57+
// val escapedStrs = strs.map { str =>
58+
// val escapedValue = StringContext.processEscapes(str.const.stringValue)
59+
// cpy.Literal(str)(Constant(escapedValue))
60+
// }
61+
// interpolate(escapedStrs, elems)
62+
// } catch {
63+
// case _: StringContext.InvalidEscapeException => tree
64+
// }
65+
// }
66+
// case _ => tree
67+
// }
68+
// } else tree
69+
// }
7070

7171
private def interpolate(strs: List[Literal], elems: List[Tree])(implicit ctx: Context): Tree = {
7272
val stri = strs.iterator

0 commit comments

Comments
 (0)