Skip to content

Commit

Permalink
fix CensoredUsername#237, incorrect handling of broken keywords.
Browse files Browse the repository at this point in the history
  • Loading branch information
CensoredUsername committed Aug 16, 2024
1 parent 872e61c commit a22815d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions decompiler/sl2decompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ def print_displayable(self, ast, has_block=False):
and isinstance(ast.children[0], sl2.slast.SLDisplayable)
and ast.children[0].children
and (not ast.keyword
or ast.children[0].location[1] > ast.keyword[-1][1].linenumber)
# this line shoudln't be necessary, but guards against broken keywords
or (ast.keyword[-1][1] is not None and
ast.children[0].location[1] > ast.keyword[-1][1].linenumber
))
and (atl_transform is None
or ast.children[0].location[1] > atl_transform.loc[1])):

Expand Down Expand Up @@ -589,7 +592,7 @@ def print_keyword_or_child(self, item, first_line=False, has_block=False):

if ty == "keywords_broken":
self.write(sep())
self.write(item[3])
self.write(item[3][0])

if first_line and has_block:
self.write(":")

0 comments on commit a22815d

Please sign in to comment.