Created
September 7, 2019 01:56
-
-
Save bakpakin/1418bb2250bb5068e3b9237ecf2541cd to your computer and use it in GitHub Desktop.
Fix ambiguous Lua code emitted from Fennel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/fennel.lua b/fennel.lua | |
index c079085..dd7252f 100644 | |
--- a/fennel.lua | |
+++ b/fennel.lua | |
@@ -825,7 +825,8 @@ local function keepSideEffects(exprs, chunk, start, ast) | |
if se.type == 'expression' and se[1] ~= 'nil' then | |
emit(chunk, ('do local _ = %s end'):format(tostring(se)), ast) | |
elseif se.type == 'statement' then | |
- emit(chunk, tostring(se), ast) | |
+ local code = tostring(se) | |
+ emit(chunk, code:byte() == 40 and (";" .. code) or code , ast) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment