summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-03-01 21:07:27 -0800
committerPaul Phillips <paulp@improving.org>2012-03-01 21:07:27 -0800
commitd6dfddfaffd2d6a09b9a8d852a0b44c4bc7555b4 (patch)
tree92430363772caf5815ef47b02d5cd4795023cfb7 /src
parentc5ac8005e23fc533e464d86e2c4ba5a4457844fe (diff)
parentf7324281f4fdffd3382955e2813240252d7088cb (diff)
downloadscala-d6dfddfaffd2d6a09b9a8d852a0b44c4bc7555b4.tar.gz
scala-d6dfddfaffd2d6a09b9a8d852a0b44c4bc7555b4.tar.bz2
scala-d6dfddfaffd2d6a09b9a8d852a0b44c4bc7555b4.zip
Merge branch 'develop'
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala27
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala10
2 files changed, 25 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 2626ca26a6..2895d02dfe 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -670,12 +670,18 @@ trait Scanners extends ScannersCommon {
next.offset = charOffset - 1
}
if (ch == '"') {
- nextRawChar()
- if (!multiLine || isTripleQuote()) {
+ if (multiLine) {
+ nextRawChar()
+ if (isTripleQuote()) {
+ setStrVal()
+ token = STRINGLIT
+ } else
+ getStringPart(multiLine)
+ } else {
+ nextChar()
setStrVal()
token = STRINGLIT
- } else
- getStringPart(multiLine)
+ }
} else if (ch == '$') {
nextRawChar()
if (ch == '$') {
@@ -698,12 +704,15 @@ trait Scanners extends ScannersCommon {
} else {
syntaxError("invalid string interpolation")
}
- } else if ((ch == CR || ch == LF || ch == SU) && !isUnicodeEscape) {
- syntaxError("unclosed string literal")
} else {
- putChar(ch)
- nextRawChar()
- getStringPart(multiLine)
+ val isUnclosedLiteral = !isUnicodeEscape && (ch == SU || (!multiLine && (ch == CR || ch == LF)))
+ if (isUnclosedLiteral) {
+ syntaxError(if (!multiLine) "unclosed string literal" else "unclosed multi-line string literal")
+ } else {
+ putChar(ch)
+ nextRawChar()
+ getStringPart(multiLine)
+ }
}
}
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 7d66549a52..ee565530b7 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -469,6 +469,7 @@ abstract class UnCurry extends InfoTransform
deriveDefDef(dd)(_ => body)
case _ => tree
}
+ def isNonLocalReturn(ret: Return) = ret.symbol != currentOwner.enclMethod || currentOwner.isLazy
// ------ The tree transformers --------------------------------------------------------
@@ -570,6 +571,9 @@ abstract class UnCurry extends InfoTransform
case Assign(lhs, _) if lhs.symbol.owner != currentMethod || lhs.symbol.hasFlag(LAZY | ACCESSOR) =>
withNeedLift(true) { super.transform(tree) }
+ case ret @ Return(_) if (isNonLocalReturn(ret)) =>
+ withNeedLift(true) { super.transform(ret) }
+
case Try(block, catches, finalizer) =>
if (needTryLift || shouldBeLiftedAnyway(tree)) transform(liftTree(tree))
else super.transform(tree)
@@ -675,9 +679,9 @@ abstract class UnCurry extends InfoTransform
applyUnary()
case Select(_, _) | TypeApply(_, _) =>
applyUnary()
- case Return(expr) if (tree.symbol != currentOwner.enclMethod || currentOwner.isLazy) =>
- debuglog("non local return in "+tree.symbol+" from "+currentOwner.enclMethod)
- atPos(tree.pos)(nonLocalReturnThrow(expr, tree.symbol))
+ case ret @ Return(expr) if (isNonLocalReturn(ret)) =>
+ debuglog("non local return in "+ret.symbol+" from "+currentOwner.enclMethod)
+ atPos(ret.pos)(nonLocalReturnThrow(expr, ret.symbol))
case TypeTree() =>
tree
case _ =>