@@ -301,7 +301,26 @@ jsSubst var new (JSCond conds) =
301301
302302jsSubst _ _ js = js
303303
304+
305+isJSConstant :: JS -> Bool
306+isJSConstant js
307+ | JSString _ <- js = True
308+ | JSChar _ <- js = True
309+ | JSNum _ <- js = True
310+ | JSType _ <- js = True
311+
312+ | JSApp (JSIdent "__IDRRT__bigInt") _ <- js = True
313+ | otherwise = False
314+
304315inlineJS :: JS -> JS
316+inlineJS (JSApp (JSIdent "__IDR__mEVAL0") [val])
317+ | isJSConstant val = val
318+
319+inlineJS (JSApp (JSIdent "__IDRRT__tailcall") [
320+ JSFunction [] (JSReturn val)
321+ ])
322+ | isJSConstant val = val
323+
305324inlineJS (JSApp (JSFunction [] (JSSeq ret)) []) =
306325 JSApp (JSFunction [] (JSSeq (map inlineJS ret))) []
307326
@@ -373,6 +392,9 @@ inlineJS (JSCond cases) =
373392inlineJS (JSObject fields) =
374393 JSObject (map (second inlineJS) fields)
375394
395+inlineJS (JSOp op lhs rhs) =
396+ JSOp op (inlineJS lhs) (inlineJS rhs)
397+
376398inlineJS js = js
377399
378400reduceJS :: [JS] -> [JS]