From dfba8c68dbc31d95f916b085bad1da8ae5221d92 Mon Sep 17 00:00:00 2001 From: jkmar Date: Wed, 27 Dec 2017 22:14:17 +0100 Subject: [PATCH 1/2] [Python3] return result instead of None in visitor --- contributors.txt | 1 + runtime/Python3/src/antlr4/tree/Tree.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contributors.txt b/contributors.txt index b85abf0ed..ffd3b9b2e 100644 --- a/contributors.txt +++ b/contributors.txt @@ -178,3 +178,4 @@ YYYY/MM/DD, github id, Full name, email 2017/12/01, DavidMoraisFerreira, David Morais Ferreira, david.moraisferreira@gmail.com 2017/12/01, SebastianLng, Sebastian Lang, sebastian.lang@outlook.com 2017/12/03, oranoran, Oran Epelbaum, oran / epelbaum me +2017/12/27, jkmar, Jakub Marciniszyn, marciniszyn.jk@gmail.com diff --git a/runtime/Python3/src/antlr4/tree/Tree.py b/runtime/Python3/src/antlr4/tree/Tree.py index 0c2f1d775..2b9db2d1c 100644 --- a/runtime/Python3/src/antlr4/tree/Tree.py +++ b/runtime/Python3/src/antlr4/tree/Tree.py @@ -38,7 +38,7 @@ class ParseTreeVisitor(object): n = node.getChildCount() for i in range(n): if not self.shouldVisitNextChild(node, result): - return + return result c = node.getChild(i) childResult = c.accept(self) From 63267252707469b39b88a576ec9ec5fe648161fa Mon Sep 17 00:00:00 2001 From: jkmar Date: Mon, 1 Jan 2018 20:28:43 +0100 Subject: [PATCH 2/2] [Python2] return result instead of None in visitor --- runtime/Python2/src/antlr4/tree/Tree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/Python2/src/antlr4/tree/Tree.py b/runtime/Python2/src/antlr4/tree/Tree.py index 14b5f29ec..5a6fa15b6 100644 --- a/runtime/Python2/src/antlr4/tree/Tree.py +++ b/runtime/Python2/src/antlr4/tree/Tree.py @@ -40,7 +40,7 @@ class ParseTreeVisitor(object): n = node.getChildCount() for i in range(n): if not self.shouldVisitNextChild(node, result): - return + return result c = node.getChild(i) childResult = c.accept(self)