Merge pull request #2486 from ralucado/master

Fix Index Error in Python3 GetChild
This commit is contained in:
Terence Parr 2019-02-06 17:38:12 -08:00 committed by GitHub
commit 1c6c62afc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -212,3 +212,4 @@ YYYY/MM/DD, github id, Full name, email
2018/11/29, hannemann-tamas, Ralf Hannemann-Tamas, ralf.ht@gmail.com 2018/11/29, hannemann-tamas, Ralf Hannemann-Tamas, ralf.ht@gmail.com
2018/12/20, WalterCouto, Walter Couto, WalterCouto@users.noreply.github.com 2018/12/20, WalterCouto, Walter Couto, WalterCouto@users.noreply.github.com
2018/12/23, youkaichao, Kaichao You, youkaichao@gmail.com 2018/12/23, youkaichao, Kaichao You, youkaichao@gmail.com
2019/02/06, ralucado, Cristina Raluca Vijulie, ralucris.v[at]gmail[dot]com

View File

@ -113,7 +113,7 @@ class ParserRuleContext(RuleContext):
def getChild(self, i:int, ttype:type = None): def getChild(self, i:int, ttype:type = None):
if ttype is None: if ttype is None:
return self.children[i] if len(self.children)>=i else None return self.children[i] if len(self.children)>i else None
else: else:
for child in self.getChildren(): for child in self.getChildren():
if not isinstance(child, ttype): if not isinstance(child, ttype):