Skip to content

Commit 2de2b0e

Browse files
Inline xLiteralPattern
1 parent 689dfd5 commit 2de2b0e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

compiler/src/dotty/tools/dotc/parsing/MarkupParsers.scala

+9-4
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,11 @@ object MarkupParsers {
315315
}
316316

317317
/** Some try/catch/finally logic used by xLiteral and xLiteralPattern. */
318-
private def xLiteralCommon(f: () => Tree, ifTruncated: String => Unit): Tree = {
319-
try return f()
320-
catch {
318+
@inline private def xLiteralCommon(f: () => Tree, ifTruncated: String => Unit): Tree = {
319+
var result: Tree = null
320+
try {
321+
result = f()
322+
} catch {
321323
case c @ TruncatedXMLControl =>
322324
ifTruncated(c.getMessage)
323325
case c @ (MissingEndTagControl | ConfusedAboutBracesControl) =>
@@ -327,7 +329,10 @@ object MarkupParsers {
327329
}
328330
finally parser.in resume Tokens.XMLSTART
329331

330-
parser.errorTermTree
332+
if (result == null)
333+
parser.errorTermTree
334+
else
335+
result
331336
}
332337

333338
/** Use a lookahead parser to run speculative body, and return the first char afterward. */

0 commit comments

Comments
 (0)