on master help sign in
Merge pull request #936 from david-christiansen/executor-arg-count

Stop getArgs from crashing executor

commitda8d3962058d559dc331ee9753992a5a48a9b4e5 authorEdwin Brady <edwin.brady@gmail.com> dateFri 28 Feb 2014, 11:13 (13 years ago) parentd9b6399360bbda
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