Skip to content

Instantly share code, notes, and snippets.

@bakpakin
Created September 7, 2019 01:56
Show Gist options
  • Save bakpakin/1418bb2250bb5068e3b9237ecf2541cd to your computer and use it in GitHub Desktop.
Save bakpakin/1418bb2250bb5068e3b9237ecf2541cd to your computer and use it in GitHub Desktop.
Fix ambiguous Lua code emitted from Fennel
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