on master help sign in
Stop getArgs from crashing executor
commit360bbdabacf53799b0a18739ab87eae2dc5c9961 authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateWed 26 Feb 2014, 10:15 (13 years ago) parent3bc4846
1 file changed+7
src/Idris/Core/Execute.hs+7
src/Idris/Core/Execute.hs+7
@@ -320,6 +320,13 @@ execApp' env ctxt (EP _ fp _) (_:fn:EConstant (Str s):rest)
320320 = let res = ioWrap . EConstant . I $ 0
321321 in execApp' env ctxt res (tail rest)
322322
323+-- Right now, there's no way to send command-line arguments to the executor,
324+-- so just return 0.
325+execApp' env ctxt (EP _ fp _) (_:fn:rest)
326+ | fp == mkfprim,
327+ Just (FFun "idris_numArgs" _ _) <- foreignFromTT fn
328+ = let res = ioWrap . EConstant . I $ 0
329+ in execApp' env ctxt res (tail rest)
323330-- Throw away the 'World' argument to the foreign function
324331
325332execApp' env ctxt f@(EP _ fp _) args@(ty:fn:xs) | fp == mkfprim