summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorDominik Gruntz <dominik.gruntz@fhnw.ch>2012-07-06 13:08:37 +0200
committerDominik Gruntz <dominik.gruntz@fhnw.ch>2012-07-06 14:52:17 +0200
commit70f493dc438f464c865e5deb38b46e4e0e773486 (patch)
tree9bb0b8dfc7877b9222d741293475d6dede8a2498 /src/library
parent623b739bde7abce5271416fbd07e91dd547fd33f (diff)
downloadscala-70f493dc438f464c865e5deb38b46e4e0e773486.tar.gz
scala-70f493dc438f464c865e5deb38b46e4e0e773486.tar.bz2
scala-70f493dc438f464c865e5deb38b46e4e0e773486.zip
adds the sha1 files of the new starr / stringContext.f
This commit provides the new sha1 codes of the new STARR. Moreover, it replaces the implementation of StringContext.f to `macro ???`. The implementation is magically hardwired into `scala.tools.reflect.MacroImplementations.macro_StringInterpolation_f` by the new STARR.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/StringContext.scala39
1 files changed, 2 insertions, 37 deletions
diff --git a/src/library/scala/StringContext.scala b/src/library/scala/StringContext.scala
index ea58078d93..f11dfb72ae 100644
--- a/src/library/scala/StringContext.scala
+++ b/src/library/scala/StringContext.scala
@@ -82,43 +82,8 @@ case class StringContext(parts: String*) {
* string literally. This is achieved by replacing each such occurrence by the
* format specifier `%%`.
*/
- def f(args: Any*): String = {
- checkLengths(args: _*)
- val pi = parts.iterator
- val bldr = new java.lang.StringBuilder
- def copyString(first: Boolean): Unit = {
- val str = treatEscapes(pi.next())
- val strIsEmpty = str.length == 0
- var start = 0
- var idx = 0
- if (!first) {
- if (strIsEmpty || (str charAt 0) != '%') {
- bldr append "%s"
- }
- idx = 1
- }
- if (!strIsEmpty) {
- val len = str.length
- while (idx < len) {
- if (str(idx) == '%') {
- bldr append (str substring (start, idx)) append "%%"
- start = idx + 1
- }
- idx += 1
- }
- bldr append (str substring (start, idx))
- }
- }
- copyString(first = true)
- while (pi.hasNext) {
- copyString(first = false)
- }
- bldr.toString format (args: _*)
- }
-
-// TODO The above method will be replaced by the following two lines as soon as the new STARR is available
-// // The implementation is magically hardwired into `scala.tools.reflect.MacroImplementations.macro_StringInterpolation_f`
-// def f(args: Any*): String = macro ???
+ // The implementation is magically hardwired into `scala.tools.reflect.MacroImplementations.macro_StringInterpolation_f`
+ def f(args: Any*): String = macro ???
}
object StringContext {