From 0b8a24108c4107bff10d82aeeb03d4a9cd193dab Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 8 Apr 2015 12:01:07 +0700 Subject: [PATCH] parser: reuse child location when possible Signed-off-by: Jean Privat --- src/parser/parser_work.nit | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parser/parser_work.nit b/src/parser/parser_work.nit index 41d6741..29588b4 100644 --- a/src/parser/parser_work.nit +++ b/src/parser/parser_work.nit @@ -220,7 +220,11 @@ private class ComputeProdLocationVisitor var endl = _last_location assert endl != null - n.location = new Location(startl.file, startl.line_start, endl.line_end, startl.column_start, endl.column_end) + if startl == endl then + n.location = startl + else + n.location = new Location(startl.file, startl.line_start, endl.line_end, startl.column_start, endl.column_end) + end if not _need_after_epsilons.is_empty then var loc = new Location(endl.file, endl.line_end, endl.line_end, endl.column_end, endl.column_end) -- 1.7.9.5