Handle if elif else case for 3.5

This commit is contained in:
x0ret
2019-06-27 08:58:11 +04:30
committed by rocky
parent c8b945fb56
commit 76eef9a149

View File

@@ -674,7 +674,7 @@ class SourceWalker(GenericASTTraversal, object):
n = n[0][0]
elif n[0].kind in ('lastc_stmt', 'lastl_stmt'):
n = n[0]
if n[0].kind in ('ifstmt', 'iflaststmt', 'iflaststmtl', 'ifelsestmtl'):
if n[0].kind in ('ifstmt', 'iflaststmt', 'iflaststmtl', 'ifelsestmtl', 'ifelsestmtc'):
# This seems needed for Python 2.5-2.7
n = n[0]
pass
@@ -682,7 +682,7 @@ class SourceWalker(GenericASTTraversal, object):
elif ( len(n) > 1 and 1 == len(n[0]) and n[0] == 'stmt'
and n[1].kind == "stmt" ):
else_suite_stmts = n[0]
if else_suite_stmts.kind not in ('ifstmt', 'iflaststmt', 'ifelsestmtl'):
if else_suite_stmts[0].kind not in ('ifstmt', 'iflaststmt', 'ifelsestmtl'):
if not preprocess:
self.default(node)
return