diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-12-14 20:09:15 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-12-14 20:09:32 -0800 |
| commit | 64ba8aee074ea415b1a02715af2ec7ae99f3f37d (patch) | |
| tree | c2a3ee1bf8b08a439b9356876198ff8fbb16c385 /nomsu_decompiler.lua | |
| parent | 2360ada21fac914a4bc5eeec752966cb3f3bba71 (diff) | |
Parenthesizing inline method targets when needed.
Diffstat (limited to 'nomsu_decompiler.lua')
| -rw-r--r-- | nomsu_decompiler.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nomsu_decompiler.lua b/nomsu_decompiler.lua index 0666e00..2fe484a 100644 --- a/nomsu_decompiler.lua +++ b/nomsu_decompiler.lua @@ -85,7 +85,11 @@ tree_to_inline_nomsu = function(tree) end return nomsu elseif "MethodCall" == _exp_0 then - local nomsu = NomsuCode:from(tree.source, tree_to_inline_nomsu(tree[1]), "|") + local target_nomsu = tree_to_inline_nomsu(tree[1]) + if tree[1].type == "Action" or tree[1].type == "MethodCall" or tree[1].type == "Block" then + target_nomsu:parenthesize() + end + local nomsu = NomsuCode:from(tree.source, target_nomsu, "|") for i = 2, #tree do if i > 2 then nomsu:add("; ") |
