From c9eb65841200e7d9411accca8a2e2268d37ec333 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Tue, 19 Nov 2013 11:07:58 -0800 Subject: [PATCH] Made parser more fault-tolerant for DCD --- stdx/d/parser.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stdx/d/parser.d b/stdx/d/parser.d index bc00473..d484d57 100644 --- a/stdx/d/parser.d +++ b/stdx/d/parser.d @@ -851,8 +851,10 @@ alias core.sys.posix.stdio.fileno fileno; if (!currentIs(TokenType.rBrace)) node.declarationsAndStatements = parseDeclarationsAndStatements(); auto closeBrace = expect(TokenType.rBrace); - if (closeBrace is null) return null; - node.endLocation = closeBrace.startIndex; + if (closeBrace !is null) + node.endLocation = closeBrace.startIndex; + else + node.endLocation = size_t.max; return node; }