Changeset 17043 for src/Pugs/Eval.hs

Show
Ignore:
Timestamp:
07/14/07 04:05:02 (17 months ago)
Author:
audreyt
Message:

* Pugs.Eval: Eliminate all dead code paths discovered by the

excellent ghc -fhpc (Haskell Program Coverage) too.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Eval.hs

    r16415 r17043  
    297297                            if lv then evalExp (Sym SOur var mempty Noop (Var var)) else retEmpty 
    298298 
    299 _scalarContext :: Cxt 
    300 _scalarContext = CxtItem $ mkType "Scalar" 
    301  
    302299reduceStmts :: Exp -> Exp -> Eval Val 
    303300reduceStmts Noop rest           = reduce rest 
     
    422419        fmap VCode (recloseCode code) 
    423420 
    424 reduceSyn "()" [exp] = reduce exp 
    425  
    426421reduceSyn "named" [keyExp, valExp] = do 
    427422    key <- enterEvalContext cxtItemAny keyExp 
     
    463458 
    464459    -- Close over outer lexical scope. 
    465     -- error "XXX - clone should operate on sub now" 
    466     -- newBody <- transformExp cloneBodyStates $ subBody sub 
    467460    -- add &?BLOCK &?ROUTINE etc here 
    468461    started     <- if isCompileTime env then return Nothing else fmap Just (stm $ newTVar False) 
    469462    inner       <- clonePad (subInnerPad sub)  
    470 --  lpads       <- cloneLexPads (subOuterPads sub) 
    471 --  warn "mooooose" $ envLexPads env 
    472463    return $ VCode sub 
    473464        { subCont       = cont 
     
    477468        } 
    478469    where 
    479     cloneLexPads chain = forM chain $ \lpad -> case lpad of 
    480         PRuntime p      -> do 
    481             p'  <- snapPad p 
    482             return (PRuntime p') 
    483         _               -> return lpad 
    484 --    cloneBodyStates (Pad scope pad exp) | scope <= SMy = do 
    485 --        pad' <- clonePad pad 
    486 --        return $ Pad scope pad' exp 
    487     cloneBodyStates x = return x -- XXX! 
    488     snapPad pad = stm $ do 
    489         fmap listToPad $ forM (padToList pad) $ \(var, entry) -> do 
    490             case entry of 
    491                 PELexical{} -> do 
    492                     store <- newTVar =<< readTVar (pe_store entry) 
    493                     return (var, entry{ pe_store = store }) 
    494                 _   -> return (var, entry) 
    495470    clonePad pad = stm $ do 
    496471        fmap listToPad $ forM (padToList pad) $ \(var, entry) -> do 
     
    654629                then evalVal refVal 
    655630                else readRef ref 
    656  
    657 reduceSyn "::=" exps = reduce (Syn ":=" exps) 
    658631 
    659632reduceSyn ":=" exps 
     
    880853    to   <- fromVal =<< reduce toExp 
    881854    return $ VSubst (MkTrans from to) 
    882  
    883 -- XXX - Runtime mixin 
    884 reduceSyn "is" (lhs:_) = reduce lhs 
    885 reduceSyn "does" (lhs:_) = reduce lhs 
    886855 
    887856reduceSyn "package" [kind, exp] = reduceSyn "namespace" [kind, exp, emptyExp] 
     
    14611430                _           -> evalVal val 
    14621431    where 
    1463     tryRecBind :: Var -> Pad -> Pad -> Eval () 
    1464     tryRecBind var pad pad2 = case lookupPad var pad of 
    1465         Just{} -> case lookupPad var pad2 of 
    1466             Just c  -> do 
    1467                 ref <- fromVal (VCode origSub) 
    1468                 stm $ writeTVar (pe_store c) ref 
    1469             _  -> return () 
    1470         _  -> return () 
    14711432    applyMacroResult :: Val -> Eval Val 
    14721433    applyMacroResult (VObject o)